2 ARM ROBOT FORWARD KINEMATICS USING MATLAB
OBLECT:
TO CRATE A MOVIE OF FILE OF FORWARD KINEMATICS OF 2D MANIPULATOR:
Kinematics is a branch of mathematics, physics and classic mechanical engineering. There are 2 mostly used kinematics in robotic field, they are : forward kinematics and inverse kinematics. Forward kinematics is frequently used to calculate the position of end effector when we know angle of each link,
To calculate forward kinematic, we can use simple trigonometry
L1=longer link or base arm
L2=shorter linkj or effector arm
x1=L1cos(theta1)
y1=L1sin(theta1)
x2=x1+L2cos(theta2)
y2=y1+L2sin(theta2)
PROGRAM TO OBTAIN MOVIE FILE OF FORWARD KINEMATICS:
clear all
close all
clc
%input
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);
%coordinate
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])
pause(0.03)
M(ct) = getframe(gcf);
ct = ct+1;
end
end
movie(M)
videofile = VideoWriter('forward kinematics.avi','uncompressed AVI');
open(videofile)
writeVideo(videofile,M)
close(videofile)
VIDEO FILE OF THE PROGRAM:
EXPLANATIOPN OF THE CODE:
1. first we give input values of link length of 1 or 2.
2. to assighn angle values , linspace command is use.
3. use counter and movie command to grab each frame of movie.
4. read file and write file command use to store each image frame.