Project

Forward Kinematics of 2R Robotic Arm using MATLAB

  • Aim:

To create a program in Matlab to sumilate the forward kinematics of a 2R Robotic Arm.

  • To Find:

If theta1 and theta2 is given what will the final position of the manipulator.

  • Kinematics:

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 kinematics equations of the robot are used in robotics, computer games, and animation.

  • 2R Roboarm:

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 or translational (linear) displacement. The links of the manipulator can be considered to form a kenimatic chain. The terminus of the kinematic chain of the manipulator is called the end effector and it is analogous to the human hand.

  • Procedure: Program Using MATLAB.

Step 1:

Calculate the position of link 1 is calculated by using two endcordinates of arm.

Starting point of link (x0,y0) = (0,0)

origin point of link (x1,y1) = (l1*cos(θ1),l1*sin(θ1))

Note : End point of link one is the starting point of link two.

Step 2 :

Calculate the position of the link 2 till the starting point of manipulator.

(x1,y1)

End point of manipulator x2,y2=(x1+l2*cos(θ2),y1+l2*sin(θ2))

now,

x2 = x1+l2cosθ2

y2 = y1+l2sinθ2

Solution set:

[x0,y0], [x1,y1], [x2,y2]

With these three coordinates we will be able to plot the position of the two links.

Step 3 :

programming the simulation using MATLAB for the given coordinates θ1 and θ2.

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);
    
    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('v9roboarm2.avi','Uncompressed AVI')
 open(videofile)
 writeVideo(videofile,M)
 close(videofile)

Key points to be noted while programming,

i = 1:length(theta1)
    THETA1 = theta1(i);
    for j = 1:length(theta2)
    THETA2 = theta2(j);
  1. Both the values of theta are same.
  2. We have to change the value of theta1 and theta2 using "for" program.
  3. Capital "THETA1" and upper case "theta1" is avariable its not an array.
  4. In theta1 lower case contains 10 values.

Errors:

This error poped up because i used the ct=ct+1; before a command so focus on commands procedure vise.

In this error i have typed small "Videowriter" insterd VideoWriter so focus on commands and keybord while typing.

Youtube Link: https://youtu.be/1B9I5NbjQlc

Conclution:

Hence simulation of 2R robotic arm is achived by using MATLAB.

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.