Challenge

Week 2- 2R Robotic Arm Challenge

% forward kinematics of a 2R robotic arm manipulator
clear all
close all
clc
%inputs
L1 = 1;
L2 = 0.5;
theta1 = 45;
theta2 = 0;
%coordinates
x0 = 0;
y0 = 0;
x1 = L1*cosd(theta1);
y1 = L2*sind(theta1);
x2 = x1+L2*cosd(theta2);
y2 = y1+L2*sind(theta2);
% ploting
line([x0 x1],[y0 y1],'linewidth',3,'color','b')
line([x1 x2],[y1 y2],'linewidth',3,'color','r')
 
 
 
%animation of forward kinematic robotic arm
%inputs
l1=1;
l2=0.5;
theta1= linspace(0,90,4);
theta2= linspace(0,90,4);
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);
%ploting
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_kinematic.avi','uncompressed avi');
open(videofile)
writeVideo(videofile,M)
close(videofile)
 

report on animation of forward kinematic 2R robotic arm manipulator

2R robotic arm manipulator is a fixed robot which is used in the industries for welding cutting purpose.

it was fixed on the base and it contain two links and a manipulator.

the arm moves in different direction to promote different operations.

the manipulator and arms makes angels with fixed base that are linkL1 makes (theta1) and link2 makes 30(theta2).

finding the position of manipulator.

step1:calcaluting the position of link1

        l1=1

        l2=0.5

        theta1=45

        theta2=30

      coordinates of link1:

         staring(x0,y0)=(0,0)

         ending (x1,y1)=(lcos theta1,lsin theta1)=(0.7071,0.3536)

step2: starting point of link2 is ending point of link1

        starting (x1,y1)

        ending   (x2,y2)=(x1+lcos theta2,y1+lsin theta2)=(1.2071,0.3536)

step3: plotting by using line command linewidth of 3 and color blue and red.

      link (x0,x1) (y0,y1)

      link2 (x1,x2) (y1,y2)

step4: animating the plot for different positions by varing angle.

       taking theta1 and theta2 0 to 90 in 10 positions with command linspace(0,90,10).

       using for loop to calculate and plot 10 different positions of arm.

step5: adding a counter ct and commends, plotting with plot command.

      then we get the error of plotting 16 different plots.

       we make the plot 2 commands to single command,  the plot looks like different colors in single plot.

       we use the hold on command to adjust the color.

       plot comes in single window

step6: we use pause commend to for the  speed moment of arm positions.

      and saving it in genframe(gcf)

      converting the frame into movie(m)by saving it as avi file by using videowritwe command.

      then the avi file will be in saved location

 https://www.youtube.com/watch?v=qRxml-UOV8I

 
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.