Forward Kinematics of a Robotic arm
ROBOTIC ARM
Robotic arms are frequently used now a day in various fields of work.
They are used for doing simple works by replacing the human labour.
They can be used for performing various functions like picking an object , placing an objcect and various operations they are programmed to.
An robotic arm consists of two links two rotational joints.
one end of the link one is connected to the fixed suppot and the other end is connected to the bottom end of the link 2.
the rotational joints has to be lubricated regularly inorder to reduse the friction in the joints while moving.
The bottom end of the link 2 is connected with the upper end of the link 1.
since the robotic arm perform the work as programmed hence the manupulator.
according to the work of the manupulator it can be used for constructional purpose or machining.
so,in order to assign a program for the arm first we have to calculate the poisition of the allignment of the links.
since one end of the link one is fixed to a rigid body let us consider the initial position of the link 1 as
(0,0).
whereas the upper end of the link one will be ( l1cos[theta1],l1sin[theta1])
by considering the length of link 1 as l1.
similarly ,the position of link 2 will be ( l1cos[theta1],l1sin[theta1]) which is the lower end
the upper end will be (x1+l2cos[theta2],y1+l2sin[theta2])
where, theta1 is the angle between the link 1 and the rigid body .
theta2 is the angle between the link 1 and link 2.
now after assigning the coordinates of the joints it is easy for us to demonstrate how actually a robotic functions with the help of matlab or octave softwares.
clear all
close all
clc
%inputs
l1=1;
l2=0.5;
theta1=linspace(0,90,4);
theta2=linspace(0,90,4);
ct=1;
for i=1:length(theta1)
THETA1=theta1(i);
for j=1:length(theta2)
THETA2=theta2(j);
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);
axis([-0.1,1.5,0,1.5]);
pause(0.3);
TEXT=sprintf('test%d.png',ct);
saveas(1,TEXT)
ct=ct+1;
end
end
To code for the functioning of the robotic arm in octave .
we have to start of with the assigning initial values that is the length of link 1 and link 2.
the values of theta1 and theta2 can be saved in array using linspace command.
the function of linspace command is to select and assign random values in between arrays,
for example linspace(0,90,10) will give 10 random values between o and 90 as shown below.
followed by an for loop which helps in performing a function again and again inside aarray.
hence here the for loop is used to store in the values assigned to i.
followed by another for loop to store in the values assigned to j.
By assuming ct=1 before the first for loop and ct=ct+1 by the end of second for loop the function repeats it self untill it reaches the ct+1 limit.
the value of x0,x1,x2,y0,y1,y2 are given inside the second for loop.
the values must be assigned correctly in order to get greater accuracy in the result.
this is followed by plotting .
here it must be noted that the values of x must be assigned in the x array and the values of y must be assigned in the y array.that is the values must be assigned seperately, not in a single array.
therefore the plot command must be done in the above mentioned way only.
the linewidth command is used to increase the boldness of the line .
the 3 is given in order to mention the thickness of the line plotted.
the axis command is given in order to assign the axis in which the plot lies .
pause command followed by the numerical value in the bracket is for pausing the plot by 0.3
time period hence is vissible to the human naked eyes.
the sprintf command is used for taking a snap of the plots .
whereas the saveas command is used inorder to perform save the image.