2R Robotic Arm
Aim:
The forward kinematics of 2R(two revolute joints) robotic manipulator and generating the required workspace of 2R robot.
Governing Equation:
DH parameters are particularly used in case of forward kinematics to determine the position of spatial linkage in attaching reference frames, whereas it’s application is much complex and doesn’t seem to be much applicable as we are only considering motion in plane(2D).
Objective of the project:
To determine the position of manipulator with given values of `theta`1 and `theta`2.
close all;
clear ll
clc
%% forward kinematics of robotic arm
%Inputs
l1=1; % length of link1 is 1 unit
l2=.5; % length of link2 is 0.5 unit
theta1= linspace(0,90,10); % theata1 extends from 0 to 90 with 10 inbetween steps.
theta2=linspace(0,90,10);% theata2 extends from 0 to 90 with 10 inbetween steps.
ct=1; %counter for each single loop
for i= 1:length(theta1)% loop, in which 'i' extands from 1 to length of theta1(i.e. 10)
THEATA1=theta1(i); % for every single value of theta1 a loop will be there assigning the variable THETA1
for j= 1:length(theta2)% loop, in which 'j' extands from 1 to length of theta2(i.e. 10) and it is within the upper for loop meaning that, for every single step of above a whole another loop will be performed within.
THEATA2= theta2(j);% for every single value of theta2 a loop will be there assigning the variable THETA2
%initial coordinates of robotic arms
x0=0;
y0=0;
% coordinates of link1
x1= l1*cosd(THEATA1);% x-component of link1
y1=l1*sind(THEATA1);% y-component of link1
%coordinates of link2 as the link will be after link1
x2= x1+ l2*cosd(THEATA2);% x-component of link2
y2= y1+ l2*sind(THEATA2);% x-component of link2
%plotting hte graph
plot([x0 x1], [y0 y1],[x1 x2],[y1 y2],'linewidth',3);%providing the coordinates of link1 and link2 respectively
axis([-1 2 0 2]); %axis of x from -1 to 2 and y from 0 to 2
pause(.03);% pause of .3 sec is given for each plot
M(ct)= getframe(gcf);% craeting a array to get the current frame of plot
ct= ct+1; %incrementaion in counter after each for looop
end
end
% creating a movie of namipulator
movie(M)% creating the movie
videofile= VideoWriter('frwrd_kinematics.avi','Uncompressed AVI');%writing the movie
open(videofile);%opening the video file
writeVideo(videofile,M);
close(videofile);% closing the video file.
Video link:
Rectified Error:
Cordinates of link1 section:
The X1 must be equals to l1*cosd(THETA1) instead of theta1.
Conclusion
- The given system has two links, and the operating angles for each link is from 0 to 90 degree. The links are connected through revolute joints in such a way that for every 10 degree rotation of link one, link2 rotates by 90 degree.
- We can play with the rotation angles and also with the number of links intact.
- There is possibility of visualization of c-space of a robotic arm.
- A 3D environment simulation and conceptualization is much towards the reality of robotic arm manipulators.