Challenge

Week 2- 2R Robotic Arm Challenge

https://youtu.be/Opn7ArI-_Ak

 Presantation:-

This program shows the animated arms-changing video of 'forward kinematic  of a 2R robotic arm manipulator'.

we take inputs are , ..

lenght of 1st link=l1=1

 lenght of 2nd link=l2=0.5

angle between 1st link with respect to x-axis=theta1=0 to 90(ten variable).

angle between 2nd link with respect to x-axis=theta2=0 to 90(ten variable).

we have three co-ordinate, 1st for starting ie, (0,0), 2nd is (x1,y1) that means endpoint of 1st link and also starting point of 2nd link and 3rd is (x2,y2) that are end point of 2nd link.

x0=0

y0=0

x1=l1*cosd(theta1)

y1=l1*sind(theta1)

x2=x1+l2*cosd(theta2)

y2=y1+l2sind(theta2)

in this program, we use two for loop, one is for 'i' and the second for 'j'.here, THETA1 & THETA2 are variables that c 10 numbers each.In plotting, we take the x-axis as -1 to 1.5 and the x-axis as 0 to 1.5. pause time of the video is 3 sec.

%Forward kinematics of a 2R robotic arm manipulator

close all
clear 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);
       
       %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
grid on
movie(M)
videofile=VideoWriter('Forward_Kinematics.avi','uncompressed AVI');
open(videofile)
writeVideo(videofile,M)
close(videofile)
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.