Forward kinematics of a 2R Robotic Arm
AIM:-
To write a program in Matlab to simulate the forward kinematics of a 2R Robotic Arm
INTRODUCTION:-
Forward kinematics refers to the use of the kinematics equations of a robot to compute the position of the end-effector from specified values for the joint parameters.
The kinematics equations of the robot are used in robotics, computer games, and animation. The reverse process that computes the joint parameters that achieve a specified position of the end-effector is known as inverse kinematics.
A Robotic Arm (not robotic hand) is a type of mechanical arm, usually programmable, with similar functions to a human arm; the arm may be the sum total of the mechanism or may be part of a more complex robot. The links of such a manipulator are connected by joints allowing either rotational motion (such as in an articulated robot) or translational (linear) displacement. The links of the manipulator can be considered to form a kinematic chain. The terminus of the kinematic chain of the manipulator is called the end effector and it is analogous to the human hand.
CODE:-
clear all
close all
clc
%Inputs
theta1=linspace(0,90,8)
theta2=linspace(0,90,10)
% lengths of link
l1=1;
l2=0.5;
% For looping
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
% To generate images for making animation
figure(ct)
hold on
plot([x0 x1],[y0 y1],[x1 x2],[y1 y2],'linewidth',3,'color','b')
axis ([-0.1 1.5 0 1.5])
file_text=sprintf('robo%05d.png',ct)
saveas (gca, file_text)% saving images generated
pause(0.03)
ct=ct+1;
endfor
endfor
Youtube Link Of Animation Video :-
Errors encountered:-
Faced certain syntax errors one of them is as follows:-
Error message that came in command window
Output:-
One of the Image generated:-