Challenge

Week 2- 2R Robotic Arm Challenge

Aim: To simulate The 'Forward Kinematics ' of A 2R Robotic ARM manipulater

Theory: A 2R ARM manipulator end effector movement determines the workspace where the robotic arm can be applicable . Our motive is to animate the movement of robotic arm with the subsequent relative motion between the two links .In this 2R arm manipulater there is some inputs which is used to explain and work of 2R arm , (x0 , y0) is starting point of link 1, (x1 ,y1) are the end point of link 1 and starting point of link 2 , (x2 ,y2) is end point of link2 , l1 is length of link attached to the base , l2 is length of link between the first link and the end link , here theta1 is the angle made by link 1 with x-axis and theta2 is the angle made by link 2 with x-axis .

Matlab code:

%Forward Kinematics of a 2R robotic arm manipulater

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

Matlab code Explanation :First of all we define the lenght of the robbotic arms , that is l1 and l2 . Then theta1 and theta2 is taken and array with linspace command after this we use For command for differents values of the desired variable . And one more time use the For command for providing movement to the second robotic arm. Defining the coodinates of both the robotics arms . Plotting all the coordinate values and writting commands . All figures are assigned to a variable M, one at a time using ct following by termination of for loop and at the end ,movie command is used to all the figures saved in the M file to make an movie .

Results: At the end youtube link.

https://youtu.be/R86EWOGCjLw

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.