Challenge

Week 2- 2R Robotic Arm Challenge

Aim:

To program and simulate Forward Kinematics of a 2R Robotic Arm using Matlab Software.

Procedure:

To calculate the Forward Kinematics of a 2R Robotic Arm we use the below formula

Formula for 1st Arm:

x1=l1*cosθ

y1=l1*sinθ

Formula for 2nd arm:

x2=x1+l2*cosθ

y2=y1+l2*sinθ

where,

l = Length of the Arm.

θ = degree of the arm

x = value of arm in x-axis

y = value of arm in y-axis

Coding:

% use input commands

theta is valued from 0° to 90° with interval of 5 for 0° to 90°.

'for' loop is used to calculate the values of intervals of a with respect to theta.

Animation is played with 0.03 seconds of time interval

Movie file has been created as below,

% Forward Kinematic of a 2R Robotic Arm
clear all
close all
clc

% inputs
l1=2;
l2=0.8;
theta1=[1:5:90];
theta2=[1:5:90]

ct=1
for a = 1:length(theta1);
    THETA1= theta1(a);
    for b = 1:length(theta2);
        THETA2= theta2(b);

        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);
        xlabel('X-Axis');
        ylabel('Y-Axis');
        axis([0 3 0 3]);
        pause(0.03);
        M(ct) = getframe(gcf);
        ct=ct+1
    end
end

movie(M)
videofile = VideoWriter('Forward Kinematic of a 2R Robotic Arm.avi', 'Uncompressed AVI')
open(videofile)
writeVideo(videofile,M)
close(videofile)

Once the above codings are given, click on 'Run' button to get the results.

Output Result File:

The Output result file animation is attached in below Youtube Link and sample image is attached

https://youtu.be/2xY6o8vdIe0

Conclusion:

The above coding and simulation attached shows the 2R Robotic Arm using Forward Kinematics and the errors occured is also attached.

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.