Challenge

Week 3.2 - 2R Robotic Arm Challenge

AIM: To simulate the forward kinematics of a 2R Robotic Arm,

GOVERNING EQUATION:-

Equation and Cordinates used-

x0=0;
y0=0;

x1=l1*cosd(theta1);
y1=l2*sind(theta1);

x2=x1 + l2*cosd(theta2);
y2=y1 + l2*sind(theta2);

OBJECTIVE- The main objective of the programme is to simulate a forward kinematics -2R Robotic Arm.

and

THEORY-

A robotic arm is a type of mechanical arm, usually programmable, with similar functions to a human arm, the arm may be the sum total of the mechanism or may be part of a more complex robots. The links of such a manipulator are connected by joints allowing either rotational motion or translational (linear) displacement. The links of the manipulator can be considered to form a kinematic chain.

co-ordinates

  • X0 and y0 are the lower cordinates of link 1 with L1 length and angle theta1.
  • x1 and y1 are the upper co-ordinates of link 1.
  • link2 join at the upper end point of the link1 with angle theta2.
  • x2 and y2 are the co-ordinates of the link2 upper end.
  • link1 is attached with base with its first end.
  • L1 is the length of the first arm or link 1.
  • L2 is the length of the secondd arm or link2.

MATLAB CODE

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=l2*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])
        ct=ct+1
        M(ct)=getframe(gcf)
    end
end
Movie(M)
videofile=videowriter('forward_kinematics.avi','uncompressed AVI');
open(videofile)
close(videofile)

CODE EXPLANATION

  • Programming language use Matlab.
  • start the programme by using comments.
  • define the lengths of the arm.
  • provide input variables.
  • provide the values to angle for the roation of arm with using linspace command.
  • write the equation for the co-ortionates for movement of arm.
  • use for loop for movement of the arm.
  • use plot command to plot the graph and simulation.
  • end the for loop.
  • figure save in M file to make an annimation.
  • at end save the movie in .avi format.

GRAPH

ERROR

RESULT- Thus we create a programme for 2R Robotic arm and simulate it, and also create a movie/annimation obtained from the programme.

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.