Week 2- 2R Robotic Arm Challenge
FORWARD KINEMATICS OF 2R ROBOTIC ARM
Robotics is a branch of engineering that involves the conception, design, manufacture and operation of robots. The objective of the robotics field is to create intelligent machines that can assist humans in variety of ways. Robots implement the mechanical concepts or processes with the help of mechanical parts, electrical and electronics components and programming. The importants of robots are mostly in industrial areas to perform repetitive tasks and improve productivity.
This program is about the working of a 2R Robotic Arm to perform its tasks that supposed to do. The 2R Robotic Arm contains two links and two rotational joints to perform its work in 2 diamensions.

The link between two rotational joint is link1 and the the link follows the link1 is link2.
L1 is the length of link1
L2 is the length of link2
Theta1 is the angle that link1makes with respect to x-axis
Theta2 is the angle that link2 makes with respect to x-axis
If Theta1 and Theta2 are given, we can find the final positions of the manipulator. Depending upon the application we can perform the function with the help of program. we can use the same concepts to do different variety of areas using programming.
Steps to solve the program
we only require the different coordinates of both link at different positions of robotic arm motion to solve the entire problem.
step1- Calculate the position of link1
as The link1 is having two point, the starting and the ending point. The starting point is fixed to its base and ending point is connected to starting point of link2. Consider the starting point as origin. The coordinate of starting points as(0,0) and the coordinate of ending point is(L1cos(Theta1), L1sin(Theta1)).

Step2-Calculate the position of link2

Here the link1 is represented as a imagianry line. The coordinate of the staring point of link2 is the coordinateof the end piont of link1. We assume the coordinate of starting point of link2 into (x1,y1)
and enpoint into (x2,y2).
Therefore,
x1 = L1cos(Theta1)
y1 = L1sin(Theta1)
x2 = x1+L2cos(Theta2)
y2 = y1+L2sin(Theta2)
Now the program is,
% FORWARD KINEMATICS OF 2R ROBOTIC ARM
%Inputs
L1 = 1;
L2 = 0.5;
x0 = 0; % cordinate of starting point of link1 or origin
y0 = 0;
Theta1 = linspace(0,90,10);
Theta2 = linspace(0,90,10); % changing angle of both link of robotic arm
ct =1
% we have to change the values of Theta1 and Theta2 by programming, so we use for loop to perform that process
for i =1:length(Theta1); % assigning the lenth of Theta1 to i
THETA1 = Theta1(i);
%for each value of Theta1 there is whole set of Theta2 values, so another for loop is introduced inside the primary for loop
for j = 1:length(Theta2); %i&j is loop counters that determines how many times the loop is going to be executed
THETA2 = Theta2(j);
x1 = L1*cosd(THETA1); %coordinate of end point of link1 and starting point of link2
y1 = L1*sind(THETA1);
x2 = x1+L2*cosd(THETA2); %coordinate of end point of link2
y2 = y1+L2*sind(THETA2);
plot([x0,x1],[y0,y1],[x1,x2],[y1,y2],'linewidth',3); % solution set
axis([-0.5 2 0 2]);
M(ct) = getframe(gcf); %it is an array to store each frame
ct =ct+1;
end
end
movie(M); %creating a video file
videofile = VideoWriter('Forward_Kinematics_of_2R_Robotic_Arm.avi','Uncompressed AVI');
open(videofile);
writeVideo(videofile,M);
close(videofile);
Conclusion
This program is about the working of a 2R Robotic Arm to perform its tasks in 2 diamisions.We can easily make a video of the positions of a 2R Robotic Arm by knowing the physical dimensions and different coordinates of both link at different positions in its motion.
Referance
Video file : https://youtu.be/H-DW4ZmPwB0
Errors
The errors that i made was negligible. It is like spellinging mistakes, not providing parantheses and that can easily solved by the errors shown in the command window.