Challenge

Week 2- 2R Robotic Arm Challenge

CHALLENGE REPORT:

AIM:

To Write a program in Matlab to simulate the forward kinematics of a 2R Robotic Arm

OBJECTIVE:

*To calculate the position of link1,

*To calculate the position of link2,

*To calculate the position of link1 & link2 for multiple degree of theta.

* To simulate the forward kinematics of a 2R Robotic Arm.

PROGRAMES IN MATLAB:

i)To calculate the position of link1 and link2 for theta1=45 & theta2=30:

clear all

close all

clc

%inputs

L1=1;

L2=0.5;

theta1=45;

theta2=30;

%coordintes

X0=0;

Y0=0;

X1=L1*cosd(theta1);

Y1=L1*sind(theta1);

X2=X1+L2*cosd(theta2);

Y2=Y1+L2*sind(theta2);

line([X0 X1],[Y0 Y1],"linewidth",3,"color",'r')

line([X1 X2],[Y1 Y2],"linewidth",3,"color",'b')

ii) To calculate the position of link1 & link2 for multiple degree of theta.

clear all

close all

clc

%inputs

L1=1;

L2=0.5;

theta1=linspace(0,90,10);

theta2=linspace(0,90,10);

ct=1;

for i=1:length(theta1)

THETA1=theta1(i);

for j=1:length(theta2)

THETA2=theta2(j);

X0=0;

Y0=0;

Y1=L1*sind(THETA1);

X1=L1*cosd(THETA1);

X2=X1+L2*cosd(THETA2);

Y2=Y1+L2*sind(THETA2);

plot([X0 X1],[Y0 Y1],[X1 X2],[Y1 Y2],'linewidth',3)

axis([-0.1 1.5 0 1.5])

pause(0.3)

ct=ct+1;

end

end

iii)To simulate the forward kinematics of a 2R Robotic Arm

clear all

close all

clc

%inputs

L1=1;

L2=0.5;

theta1=linspace(0,90,10);

theta2=linspace(0,90,10);

ct=1;

for i=1:length(theta1)

THETA1=theta1(i);

for j=1:length(theta2)

THETA2=theta2(j);

X0=0;

Y0=0;

Y1=L1*sind(THETA1);

X1=L1*cosd(THETA1);

X2=X1+L2*cosd(THETA2);

Y2=Y1+L2*sind(THETA2);

plot([X0 X1],[Y0 Y1],[X1 X2],[Y1 Y2],'linewidth',3)

axis([-0.1 1.5 0 1.5])

pause(0.3)

M(ct)=getframe(gcf);

ct=ct+1;

end

end

movie(M)

videofile=VideoWriter('forwardkinamatics.avi','uncompressed AVI')

open(videofile)

writeVideo(videofile,M)

close(videofile)

CODE EXPLANATION:

i)

*First provide the inputs values and coordinates

*Using the line command make two lines for 3 coordinates((X0,Y0),(X1,Y1),(X2,Y2)).

ii)

* first provide the inputs values (using linspace command for theta1 & theta2),

*putting the length of theta1 & theta2 in for loop, as follows the coordinates((X0,Y0),(X1,Y1),(X2,Y2)) and using the plot command plot the coordinates wth the given axis and end up with end.

iii)

* first provide the inputs values (using linspace command for theta1 & theta2),

*putting the length of theta1 & theta2 in for loop, as follows the coordinates((X0,Y0),(X1,Y1),(X2,Y2)) and using the plot command plot the coordinates wth the given axis and end up with end.

* using getframe we are capturing each frame,videofile helps to name the file and formate of video.

CONCULSION:

i)

ii)

iii)

YOUTUBE LINKS:https://youtu.be/r2B3-zfFAHY

drive link:https://drive.google.com/file/d/1futzZ6XDFwP8MCrQZP7xm7255r_cyUp2/view?usp=sharing

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.