Week 2- 2R Robotic Arm Challenge
Introduction:
simulation forward kinematics of a 2R robotic arm using for loop in MATLAB. we are writing a program to obtain a animated form video ploted the position of the two links in 2D workspace.
Explanation of the code:
1. length of both the links are taken as input. Length of link-1 (L1) is taken as 1m and length of
link-2 (L2)is taken as 0.5m.
2. angle traced by both the links, for link-1 and for link-2 is taken as input. The angle traced are
varied over a range to simulate the movement of the robotic arm.
3. base position of link-1(x0,y0) is consider as origin(0,0).
4. then two for loop are used to iterate over the range of angle traced by both the link. For each
particular angle of link-1,link-2 is moved over its entire range, to obtain different position of end
effector at that angle of link-1.
5. for particular value of θ1 and θ2 ,the end position of link-1 is calculated by these equations.
x1=x0+L1⋅cosd(θ1)
y1=y0+L1⋅sind(θ1)
The end position of link-1 is also the start position of link two.the end position for link-2 is
calculated by these equations.
x2=x1+L2⋅cosd(θ2)
y2=y1+L2⋅sind(θ2)
6. then for each particular position of link-1 and link-2 a plot is made which is then captured frame
by frame to make a movie.
movie(M);
7. a video file of ‘.avi’ formate is made to save the movie.
V= videowriter (filename , profile);
some types in profile are;
Archival
Motion JPEG AVI
Motion JPEG 2000
MPEG-4
uncompressed AVI
Indexed AVI
Grayscale AVI
8. the movie is then written into the videofile and the final animation is the created.
conclusion:
we got the ploted animated video by simulation of forward kinematics of a 2R robotic arm using MATLAB program