Week 2- 2R Robotic Arm Challenge
https://drive.google.com/file/d/1lFOTIFOCy6RX56h78LS-mZGYM-tb7_ew/view?usp=sharing
clear all
close all
clc
%inputs
l1 = 1;
l2 = 0.5;
theta1 = linspace(0,90,10);
theta2 = linspace(0,90,10);
ct = 1
for i = 1 : length(theta1)
THETA1 = theta1(i);
for j = 1 : length(theta2)
THETA2 = theta2(j);
L1 = 1;
L2 = 0.5;
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])
M(ct)= getframe(gcf)
ct = ct+1
end
end
movie(M)
videofile = VideoWriter('forward kinematics.avi');
open(videofile)
writeVideo(videofile, M)
close(videofile)
-------------------------------------------------------------------------------------------------------------------------------------------
Program Report :
i. First start with clear all, close all, clc.
ii. Second give the input commands L1, L2 ,theta1&2 , while creating a movie the values of theta should be in a linspace command so that multiple values can be taken.
iii. Next start a for loop for theta 1 as i and agin start a for loop for theta2 as j.
iv. Now calculate the values of the co_ordinates x0, y0, x1, y1 ,x2, y2, by using cos and sin theta.
v. After that plot the co_ordinates along with the axis and the frame command and then end the for loop.
vi. Now type the commands to create a animation of the kinematics of the robotic arm and save the file as movie.
vii. At last run the program so that we can able to see a animated movie of the kinematics of the robotic arm was created.