Project

Simulation of the forward kinematics of a 2R Robotic Arm using MATLAB.

Simulation of the forward kinematics of a 2R Robotic Arm using MATLAB.

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.

In this we will study of Simulation of the forward kinematics of a 2R Robotic Arm using MATLAB.

2R Robotic Arm consists of two rotary joints and two Links. Forward kinematics of 2R Robotic arm deals with study of movement of Robotic arm to know the accessibility of it. It has many applications such as Gas welding, Arc welding and handling machine tools.

Process involved in forward kinematics of a 2R Robotic Arm using MATLAB.

  1. Position of link 1 is calculated by using 2 end Coordinates i.e. at base & end link 1

(x0,y0) = (0,0)

(x1,y1) = (l­­1­­*cos(θ1), l­­1­­*sin(θ1))

  1. Position of link 2 is calculated by using the arm manipulator end using

(x2,y2) = (x1 + l­­2­­*cos(θ2), y1 + l­­2*sin(θ2))

  1. Simulation of 2R Robotic arm involves in variation of position of θ1 & θ2.
% 2R Robotic Arm Simulation
clear all
close all
clc

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
        %figure(ct)
        plot([x0 x1],[y0,y1],[x1 x2],[y1 y2],'linewidth',3)
        axis([-0.1 1.5 0 1.5])
        pause(0.01)
        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)

Animation of 2R Robotic Arm:

https://youtu.be/yevi6gBcoJw

Errors faced while Coding in MATLAB:

The above errors occured due to typo of key Word 'videowriter' instead of 'VideoWriter'. This type of errors can be rectified by putting track on keywords.

Conclusion: Hence Simulation of 2R Robotic Arm is acheived by 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.