Week 2- 2R Robotic Arm Challenge
REPORT
Writing a Matlab program to stimulate forward kinematics of 2R robotic arm manipulator :
12th may,2022 by-Mayank Tiwari
With the help of this program we are able to figure out that how the robot is going to move,in other words we are figuring out robot's workspace(possible locations that the robot can reach).Before this one should know about kinematics of linkages

Inputs for forward kinematics-
x0=0,y0=0
x1=l1*cos(theta1),y1=l1*sin(theta1)
x2=x1+l2*cos(theta2),y2=y1+l2*sin(theta2)
#Calculating final position of manipulator :
step1-calculate position of link1(already done above)
step2-calculate position of link2(already done above)
step3-now for different values of theta1 and theta2 we can figure out final position of manipulator.
#Explanation of the code :
1.At first we have to provide inputs for link1,link2,theta1 and theta2.For theta1 and theta2 we are using linspace command, as it generates linearly spaced vectors between the two values.
2.Now what we want is that for different values of theta1 and theta2,the link1 and link2together creates an animation.But for each value of theta1,link 2 can have multiple values of theta2.So here we use the concept of for loop.
3.We are using two for loops,first for loop contains the array theta1 of loop counter variable(i) in variable called THETA1,similarly second for loop contains array theta2 of loop counter variable(j) in variable called THETA2.
4.After this we will provide the co-ordinates(x0,y0,x1,y1,x2,y2).
5.The final aim is to generate the animation of robotic arm,so for this we will use single line plot satement using plot command,setting the axis accordingly with a pause duration of 0.3 sec.Now we are using counter variable ct=ct+1,it basically increments by a specific step value in every iteration of loop.
#Errors faced while programming :
1.While writing plot command i have not provided commas.
2.I have not provided the input value for ct.
3.Also while defining co-ordinates i have put theta1,theta2 instead of THETA1,THETA2.
4.I have not provided the input argument for videofile.
#Youtube link address -
https://www.youtube.com/watch?v=anfH1p3SLzg