Challenge

Week 2- 2R Robotic Arm Challenge


%Program for forward kinematics of a 2R Robotic Arm

%to clear window

close all

clear all

clc

%Inputs

%Length of first arm

L1=1.2

%length of second arm

L2=.6

%counter

ct=1;

%to find theta of first arm and its having 10 values ranges from (0-90),that we represented by linspace command

theta1=linspace(0,90,10);

%to find theta of second arm and its having 10 values ranges from (0-60),that we represented by linspace command

theta2=linspace(0,60,10);

%we cannot enter every angles(theta)manually,for that we using for loop command here

for 1=1:length(theta1);

THETA1=theta1(1);

%for second arm

for j=1:length(theta2);

THETA2=theta2(j);

%enter the co ordinates of two arms

%co ordinates robotic of arm

x0=0;

y0=0;

x1=L1*cosd(THETA1);

y1=L1*sind(THETA1);

x2=x1+L2*cosd(THETA2);

y2=y1+L2*sind(THETA2);

%to visualise the commands,we need to plot for that we use plot command

%ploting all the cordinates of two arms

plot([x0 x1],[y0 y1],x1 x2],[y1 y2],'linewidth',3);

to get a smoother animation we use pause command

pause(0.03);

M(ct)=getframe(gcf);

ct=ct+1;

end

end

%To create movie from the plot

Movie(M)

videofile=videowriter('forward_kinematics','uncompressed AVI'):

open(videofile)

writevideo(videofile)

close(videofile)

%Video google drive link

https://drive.google.com/file/d/1DW_JvtY874wNVkXdiyj7MRAHNEuvb_Ym/view?usp=sharing

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.