Challenge

Week 3.2 - 2R Robotic Arm Challenge

Error :

here have used cosd instead of cos because cos gives values in radians and cosd is in degree

steps:

1)we have given link L 1 and L 2 here whose length is particularly is 1 meter and 1.5 meter

2)then set an angle of theta 1 and theta 2 which is particularly 45 deg and 30 deg

3)then have set co-ordinates which are followes

a first link fixed to the base which has start (x0,y0) and end (x1,y1),which are (0,0) and (L1*cosd(theta1),L2*sind(theta1))

For second link which is connected to the first link is start co-ordinates are (x1,y1) and end co-ordinates are (x2,y2),which are (L1*cosd(theta1),L2*sind(theta1)) and (x1+L2*cosd(theta2),y1+L2*sind(theta2))

4)Now we are ploting it by line command

line ([x0,x1],[y0,y1],'linewidth',3,'color','b');

line([x1,x2],[y1,y2],'linewidth',3,'color','r');

plot :

If I am keeping angle theta-2 90deg then

with theta-2 0 deg it will show stright line

With variation in an angle its rotating along first arm while first arm is fixed to the base with constant angle .

so we can create animation for this robotic arm by changing its angle so for that will create new file or program .

clear all;

close all;

clc;

%input
l1=1;
l2=0.5;
theta1=linspace(0,90,10); %[0,10,20,30,40,50,60,70,80,90]
theta2=linspace(0,90,10);%[0,10,20,30,40,50,60,70,80,90]
%for loop
for i= 1:length(theta1)%for range of theta 1 from 0 to 90 at 10 equal intervales [0,10,20,30,40,50,60,70,80,90]
theta2(i) %theta2 is changing its position for first deg it will change from 0 to 10 then for second deg will 0 to 10
end

here for each theta 1 its ranging from 0 to 90 at 10 equal intervales and theta2 its from 0 to 90 at 10 equal intervales.

for loop indicates that for each value of theta 1 theta 2 is changing from 0 to 90

result : -

theta1=linspace(0,90,10)

theta1 =

0 10 20 30 40 50 60 70 80 90

change in theta2(i) is

theta2(i)

ans =

90

here in the for loop i = 1:length(theta1) which is changing from 0 to 90 at 10 equal intervales

theta2(i) is from 0 to 90 and THETA1 is variable which contain only one val

Angle
theta 1010203040506070
theta 20 - 900 - 900 - 900 - 900 - 900 - 900 - 900 - 90

here for each value of theta 1 theta 2 is changing from 0 to 90

Here we are writing total program for robotic arm in which we have introduced THETA1 and THETA 2 which are variables and contain only one value

to the nest we have intruduced ct and ct + 1 for counter in an increment

then have merged two plots as well fixed our axes and created a movie for it

Error occure during movie creations are

was used samall v insted of V at writeVideo(videofile,M)

link for animation :

https://drive.google.com/file/d/1YSlNFUIpKSIDOfWXMlt74Xe425cstr03/view?usp=drive_link

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.