Challenge

Week 2- 2R Robotic Arm Challenge

AIM:

Simulating forward kinematices of a 2R robotic arm using MATLAB programin.

OBJECTIVES:

  • write a program in matlab to simulate the forward kinematic of 2r robotic arm.
  • create an animation file of the plot.
  • step wise explanation of your code.
  • mention the errors faced while programming.

THEORY:

  • A robotic arm is made up of mechanical linkage so that can be used similarly to a human arm.
  • A robotic arm can provide more amount of degree of freedom as campared to human arm.
  • the working of a robotic is shown in this given solution by using MATLAB program in a animation from.
  • the links of manipulator can be consider to from a kinematic chain
  • robotic arm used in various industial application such as drilling , metal casting
  • the link 1 is attached to the base and end of link one is connected to link2 and end of link 2 is connected to the end effector whiche preproms we will restrict the movement of the link in a 2d plane.

PROGRAM:

% a program to simulate the forward kinematics of a 2r robotic arm

close all
clear all
clc
%Input
l1 = 1;
l2 = 0.5;
theta1 = linspace(0,100,10);
theta2 = linspace(0,100,10);
ct=1
for
for i =1:length(theta1)
THETA1 = theta1(i);
for j = 1:length (theta2)
for
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('kinematic_loop_video.avi','uncompressed AVI');
open(videofile)
writeVideo(videofile,M)
close(videofile)
ERRORS FACHING:
  • Problem faced inconverting code in anmation becouse of small mistake of spelling .
  • problem faced in code in file saveing becouse of i miss some cammand.
EXPLANATION OF PROGRAM

1. Lengths of both the links are taken as input. Length of link-1 (l1) is taken as Im and length of link-2 (l2) is taken as 0.5m.

2. Angles find by both the links, for link-1 and for link-2 is taken as input. The angles find are varied over a range to simulate the movement of the robotic arm.

3. Then two for loops are used to iterate over the range of angles find by both the links. For each particular angle of link-1, link-2 is moved over its entire range, to obtain different positions of end effector at that angle of link-1.

4. For a particular value of THETA and

the end position of link-1 is calculated by these equations.
x1=l1*cosd(THETA1);

y1=l1*sind(THETA1)

The end position of link-1 is also the start position of link two. The end position for link-2 is calculated by these equations.

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

5. Then for each particular position of linK-1 and link-2, a plot is made which is then captured frame by frame to make a movie.

6. A video file of '.avi' format is made to save the movie.

7. The movie is then written into the videofile and the final animation is thus created.

RESULT:

This animation can be viewed by visiting the link mentioned below.

https://youtu.be/xhwPO_ATySw

a simulation of the forward kainematice of 2R robotic arm 2d work in 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.