Week 2- 2R Robotic Arm Challenge
clear all
close all
clc
%inputs
l1=1; Length of first arm
l2=0.5;Length of second arm
theta1=linspace(0,90,10);(degree of first arm w.r.t x axis)
theta2=linspace(0,90,10);(degree of 2nd arm w.r.t x axis)
ct=1; counter
for i=1:length(theta1)
THETA1=theta1(i);
for j=1:length(theta2)
THETA2=theta2(j);
x0=0; (value of X axis at 0 Position)
y0=0; (value of y axis at 0 Position)
x1=l1*cosd(THETA1); (value of X axis at 1 Position)
y1=l1*sind(THETA1); (value of y axis at 1 Position)
x2=x1+l2*cosd(THETA2); value of X axis at 2 Position
y2=y1+l2*sind(THETA2); value of y axis at 2 Position
%plotting
Figure(1)
plot([x0 x1],[y0 y1],[x1 x2],[y1 y2],'linewidth',3) Plotting the graph
axis([-0.1 1.5 0 1.5])
M(ct)=getframe(gcf);
ct=ct+1;
end
end
movie(M)
videofile = VideoWriter('forward_kinematics.mp4');
open(videofile)
writeVideo(videofile,M)
close(videofile)
While solving the solution i had faced many difficulties such as
1)forgetting to provide the input values
2)Not typing the same command as provided in the videos
3)i was not able to open the video file as per attached screenshot but i could resolve it with the help of a support engineer
who helped me rectify my commands and small mistakes which i had done
Youtube video animation link:https://youtu.be/UKATjGINYCo