Project

Forward Kinematics of a 2R Robotic Arm

AIM

To simulate the forward kinematics of a 2R Robotic Arm.

OBJECTIVES

  • To study the motion of Robotic Arm
  • To get animation video of the movement of Robotic Arm.

THEORY

Kinematics deals with the motion of a body or the motion of a group of bodies. It doesn’t include the mass of the body/bodies and the forces acting on the body/bodies.

A Robotic Arm includes a manipulator which is connected with a series of mechanical links and joints. The links helps to move its external neighbour link with respect to its internal neighbour link. One end of the series of links is connected with the fixed base and other end is eligible to move through space freely. The manipulator is used to hold the tools. Thus the Robotic Arm is widely used in industry.

The kinematics of a Robotic arm is of two types:

  • Forward Kinematics: In this case, the position of the links and joints are given and the final position of the manipulator i.e., end effector e.g., a gripper, a welder has to be found out.
  • Inverse Kinematics: In this case, the position of the manipulator i.e., end effector is given and the positions of the links and joints have to be found out.

For the current problem, Forward Kinematics will be required.

Figure: Schematic diagram of a Robotic Arm

The above figure is a schematic diagram of a 2R Robotic Arm which is designed using AutoCAD.

In the diagram the Kinematic Arm has two links i.e., Link 1 and Link 2. Link 1 is of length l1 and Link 2 is of length l2. The one end of Link 1 is connected with the base and we are assuming the co-ordinates of this point as the origin`(0,0)` . The other end of Link 1 is connected with the Link 2 by a joint whose co-ordinates are assumed to be `(x_1,y_1)`. Link 2 is connected with the manipulator or the end effector at a point whose co-ordinates are assumed to be `(x_2,y_2)`.

The Link 1 is making an angle `θ_1` with the horizontal plane and the Link 2 is making an angle `θ_2` with the horizontal plane.

By calculation, the co-ordinates are `x_1=l_1 cos⁡θ_1 , y_1 =l_1 sin⁡θ_1`

and `x_2=x_1+ l_2 cos⁡θ_2 , y_2=y_1+ l_2 sin⁡θ_2`

PROGRAM

  • Program to simulate the forward kinematics of a 2R Robotic Arm
%Program to simulate the forward kinematics of a 2R Robotic Arm
clear all 
close all
clc

%inputs
l1 = 1;                                   %Assigning the values of length of the two links
l2 = 0.5;

theta1 = linspace(0,90,10);               %Assigning the values of angle of two links with the horizontal plane
theta2 = linspace(0,90,10);

ct=1;                                     %Assigning command to count the figure number

for i = 1:length(theta1)                  %Assigning for loops to execute all values of theta2 for each value of theta1
    THETA1 = theta1(i);                   %Assigning THETA1 to read the value of theta1 one by one
    for j = 1:length(theta2)
        THETA2 = theta1(j);               %Assigning THETA2 to read the value of theta2 one by one
        
        %Co-ordinates                     %Assigning values of co-ordinates of each joint        
        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 2 0 2])                %Assigning the range of axis to shown in simulation
        pause(0.1)                        %Assigning command to pause each frame
        M(ct) = getframe(gcf);            %Assigning command to get current figure into an array called 'M'           
        ct=ct+1;                          %Assigning command to run the loop for each set of angle
    end
end


movie(M)                                  %Assigning command to generate a movie with all the frames 
videofile = VideoWriter('forward_kinematics1.avi','Uncompressed AVI');       %Assigning command to create a AVI file to store the movie
open(videofile)                           %Assigning command to open the video file
writeVideo(videofile,M)                   %Assigning command to write the frames in the videofile
close(videofile)                          %Assigning command to close the videofile

RESULT

Animation

https://youtu.be/-QekIIpV2I8

CONCLUSION

  • At first the Kinematics of a Robotic Arm is studied. For the current problem, Forward Kinematics was required. The positions of the links and the joints are given. The position of the manipulator is found out by the MATLAB code.
  • The animated video of the movement of Robotic Arm is generated by MATLAB.

ERRORS

The function ‘movie’ was misspelled as ‘Movie’ and this was rectified by rewriting it as ‘movie’.

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.