Week 2- 2R Robotic Arm Challenge
AIM:
To simulate the forward kinematics of a 2R Robotic Arm using matlab.
THEORY:
- Kinematics is the study of motion of a system of bodies without directly considering the forces or potential fields affecting the motion. In other words, kinematics examines how the momentum and energy are shared among interacting bodies.
- Forward kinematics refers to the use of the kinematic equations of a robot to compute the position of the end-effector from specified values for the joint parameters.
- The links are the smallest unit of the Machine, similar to the cell in the Human Body. By a combination of the link, pair is formed and pair together forms a chain and which further causes linkage formation, and at last, the combination of Linkage forms Machine. The Machine is the basis of the Robotics.
PROGRAM:
clear all;
close all;
clc;
%inputs
l1= 1;
l2= 0.5;
%angle
theta1= linspace(0,90,10);
theta2= linspace(0,90,10);
%counter value
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 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)
EXPLANATION:
- At first all the inputs value which are needed are given.
- The valus of x0,y0 is considered as 0.
- The values of x1,y1,x2,y2 are calculated using the trigonometric relations.
- Then for loop command is used to run the concecative program in repeated mode.
- The graphs of all position of links that have been obtained are plotted.
- The pause cammand is used to get a better animation speed.
- The getframe command was used to capture the motion of lines.
- To make a movie of all plots movie command is used.
- To save the movie videofile command is used.
- Then the video avi file is opened after the plot.
RESULT:
REFERENCES: