Project

Robotic Arm Manipulator

2R ROBOTIC ARM

AIM: MATLAB Program for two arm robot manupulator.

EQUATIONS USED(to obtail coordinates of the linkages):

  1. x1=l1⋅cos(θ1)
  2. y1=l1⋅sin(θ1)
  3. x2=x1+l2⋅cos(θ2)
  4. y2=y1+l2⋅sin(θ2)

OBJECTIVES:

  • To create a Manipulator wich explores a given two dimensional workspace.
  • the manipulator would help the syncronization of the two linkages in the given space to carry out various function.
  • The linkages has two Degree of Freedoms in the workspace.
  • For various positions of the first link , the socnd link is capable to at various angles with respect to the first.

DETAILS:

Programming Language used: MATLAB v2020a

Concept Used: Synthesis of Mechanism

Loops used: For loo(nested)

Errors Faced: "Error Using Movie: Movie contains uninitialized frame"

Methods to Overcome Error: increment of counter should be decleared after the getframe cmd

Problems Faced: multiple plots are created if we use "line' cmd instea of 'plot' thus making it difficult to analyze, as shown below-

Line of Code:

line([x0 x1], [y0 y1],'LineWidth',3)
line([x1 x2],[y1 y2],'LineWidth',3)

Pause Time: a optimum pause time must be alloted to make the animation to be analyzed easily

PROGRAM AND STEP-WISE EXPLAINATION:

% forward kinematics of a 2r robotic arm manupulator
%% inputs
clear all
close all
clc
l1 = 1;  %%  length of link 1
l2 = 0.5;   %  %  length of link 1
ct = 1;    % initail value of couunter as 1
theta1 = linspace(0,90,10);  % linear vector from 0 to 90 consiting of 10 values
theta2 = linspace(0,90,10);  
for i = 1:length(theta1)    % to iterate through each loop from 1 to 10
    THETA1 = theta1(i)    % to assign variavle THETA1 to each value of i in theta 1
    for  j = 1:length(theta2)  % create a nested for loop for each angle of link 2
        THETA2 = theta2(j) %to assign the variable THETA2 to each valur oj j in link 2 
        x0 = 0;    % fixed cordinates of ARM 1
        y0 = 0;
        % to determine the coordinates of eaxh linkages
        x1 = l1*cosd(THETA1)  ;
        y1 = l1*sind(THETA1);
        x2 = x1 + l2*cosd(THETA2);
        y2 = y1 + l2*sind(THETA2);
        %% plotting of the arm in x and y cordinates
        plot([x0 x1], [y0 y1], [x1 x2],[y1 y2],'LineWidth',3); 
        axis([-0.1  1.5 0 1.5])   % gives limit in x and y axis for each arm
        pause(0.03);
        M(ct) = getframe(gcf); %frames of figure saved in array 'M'
        ct = ct + 1; % the value of counter increase by 1 for each iteration
    end
end
movie(M);  % this creates a movie of array M
videofile = VideoWriter('forward_kinematics.avi','Uncompressed AVI'); %format for saving
open(videofile);     % opends the movie file
writeVideo(videofile,M);  % writes the video in the file of given array
close(videofile);

ERRORS:

  1. "Error using movie
Movie contains uninitialized frames"
SOLUTION: increment in the counter frame must be decleared after assigning the array using 'getframe' cmd to a variable

2. "Unrecognized function or variable 'l1'"

SOLUTION: this error occours when the initials are not decleared, could overcome by assigning the value of arm lengths 'l1' and 'l2'.

https://youtu.be/LJfRu0lJnY4

OUTPUT:

LINK:- https://youtu.be/LJfRu0lJnY4

Refer the above link to see the output animation

CONCLUSION:

  • From this manipulator the robotic arm can perform basic functions like exploring a 2-D workspace
  • Drawback:- the restriction of all the degree of freedom is a drawback for the manipulator as it could only move in a single plane
  • In future many manipulations can be made in the project to make it explore multi-dimensional workspace
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.