Challenge

Week 2- 2R Robotic Arm Challenge

AIM:- To write a programe in matlab for 2R robotic arm

Objective:- To write a simulated forward kinematic of 2R robotic arm

To create a movie from the plots obtained by program

Theory:- In this program we consider a 2R robotic arm. A 2R robotic arm

represents a robotic arm with two rotations it has two links which rotate

or work over a two dimensional plane with each of links

haiving a single degree of freedom.

and also both the links are restricted to a 90' rotation with respective to the axes.

Matlab code:-
% Programe for 2R robotic arm challenge 

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=l1*sind(THETA1);

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

%ploting 
plot([x0,x1],[y0,y1],[x1,x2],[y1,y2],'LineWidth',2)
axis([-0.1 2 0 1.5])
pause(0.1)
M(ct)=getframe(gcf);
ct=ct+1;
end

end


movie(M)
videofile=VideoWriter('robotic_arm.avi','Uncompressed AVI');
open(videofile)
writeVideo(videofile,M)
close(videofile)


​
Explanation:
L1 is the length of the arm 1
L2 is the length of the arm 2
for theta 1 & theta 2 we have given a 0 to 90 degree agree with 10 frams per each angle
for loop code is used to run a program with 0 to 90 degree for each angle for theta 1 and theta 2
x=0,0
y=0,0
stating points of codinates
then plot command is given to plote the programme
Results:
https://drive.google.com/file/d/1KO0oewyQcgRI3muPK-BwVb1bqp3G01ze/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.