Week 2- 2R Robotic Arm Challenge
AIM
%inputs parameters like length of linls and different angle positions
L1 = 1; % length of link 1
L2 = 2; % length of link 2
theta1 = linspace(0,90,35);
theta2 = linspace(0,90,35);
ct = 1;
%for every angle of theta1 there will be 10 respective angles of theta2, this can be achived by for loop function
for i = 1:length(theta1)
THETA1 = theta1(i);
for j = 1:length(theta2)
THETA2 = theta2(j);
% coordinatespoints of links at starting and ending positions
x0 = 0;
y0 = 0;
x1 = L1*cosd(THETA1);
y1 = L1*sind(THETA1);
x2 = x1 + L2*cosd(THETA2);
y2 = y1 + L2*sind(THETA2);
%plotting
plot([x0 x1],[y0 y1],[x1 x2],[y1 y2],'LineWidth',3)
grid on
axis([-0.1, 1.5, 0, 1.5]);
pause(0.1)
m(ct) = getframe(gcf);
ct = ct+1;
end
end
%movie generation code
movie(m)
videofile = VideoWriter('forward_kinematic.avi','uncompressed AVI');
open("videofile")
writeVideo(videofile,m)
close(videofile)
: Finding possible location that a robot arm/end effector can move in workspace/work envelope of 2R robotic arm
THEORY :
FORWARD KINEMATICS = It is a process of obtaining position and velocity of end effector, given the known joints angles (theta1,theta2) and velocities .
Here we are find coordinates of end effector of 2R(rotating) robot arm.
It has two links link1, link2
Steps to be followed to find the coordinates of end effector
- Calculate position of link1,coordinate of link1 starting point is (0,0) = (x0, y0) and coordinate point of end of link 1 (x1,y1) = (L1cos(theta1), L2sine(theta2))
- similarly coordinate points of link two i.e starting point of link 2 (x1, y1) = (L1cos(theta1), L2sine(theta2)) and ending point (x1 + L2cos(theta2), y1 + L2sin(theta2))
TOTAL 3 coordinate points