Week 2- 2R Robotic Arm Challenge
% Forward kinematics of 2R robotics arm manipulator
Nowdays robotics are used in majority of the industries for welding, assembly operation, machine loading and unloading etc. In forward kinematics is the analysis of motion, the robot needs only length and degree of freedom of the manipulator.
it consists of base, two arm or kinematic links and two rotational joints. These links will have motion in then where they are programmed
Base
X0 = 0
Y0 = 0
X1 = L1*cosd(THETA1)
Y1 = L1*sind(THETA1)
X2 = L2*cosd(THETA2)
Y1 = L1*sind(THETA2)
% Forward kinematics of 2R robotic arm manipulator
clear all
close all
clc
% inputs
l1 = 2;
l2 = 1;
theta1 = linspace(0,90,20);
theta2 = linspace(0,90,20);
ct=1;
for i = 1:length(theta1)
THETA1 = theta1(i);
for j = 1:length(theta2)
THETA2 = theta2(j);
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 3 0 2])
pause(0.1)
M(ct) = getframe(gcf);
ct=ct+1;
end
end
%conversion of plot into video
movie(M)
videofile = VideoWriter('Forward_kinematics_with_forloop.m','Uncompressed AVI');
open(videofile)
writeVideo(videofile,M)
close(videofile)
Error faced while programing
M(ct) = getframe(gcf)
movie coversion
videofile (line 41)
The final animation drive link
https://drive.google.com/file/d/1u7V0zyOvvSS-mO5mDU7MziouDbmwJU55/view?usp=sharing
The final animation youtube link