Challenge

Week 2- 2R Robotic Arm Challenge

% forwared kinametic 2d arm manipulatede
clear all
close all
clc

%input
L1= 1;
L2= 0.5;
theta1 = 45;
theta2 = 90;

%cordinates 
x0 = 0;
y0 = 0;

x1 = L1*cosd(theta1)
y1 = L1*sind(theta2)

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')





send programm



clear all
close all
clc

%input
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
     
        line([x0 x1],[y0 y1],'linewigth',3,'color','r')
        line([x1 x2],[y1 y2],'linewidth',3,'color','b')
    end

end




video or AVI making:-


clear all
close all
clc

%input
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
 
movie(M)
videofile = VideoWriter('kinamatic2.AVI','uncompressed AVI')
open(videofile)
writevideo(videofile,M)
close('videofile')

Explanation

firstly given a function name forward kinametic 2d arm manipulated and than

taking length of link number one and link number two are respectively 1 meter and second one is 0.5 meter

than also tsking theta value for both arms first one taking 45 degree and second one take 90 degree

first arm are connecting with fixed surface than taking a cordinates x0 is 0 and y0 is 0
using a function for finding the value of {x1 y1} and {x2 y2}

using formula in the last ploting the all the value in graphicaly in graph so using a ploting function and putting commund line of x0 to x1 and y0 to y1 and given linewidth 3 mm and selecting the color of line are blue and same as it is line of x1 to x2 and y1 to y2


and finaly Run the programm and showing figer as a graphically represention and the save the programm save as give the name fowrwad kinametices 2d arm
and click on the 'new' tool bar creating a new programm file


clear all and close all background filles using clear all , close all and clc commund now input variables
putting the value of L1 and L2 link length by using old data and also putting the value of theta1 and theta2 value as a array form its mean theta1 and theta2 will be change to 0 degree to 90 degree within 10 or more value and same as using for theta2 value

now sarting loop fuction for running thetas value puting the value of (i) 1 to length of theta value its mean all ten value are using in the loop function. same work doing for value of (j) for theta2 value and then copy previous program and past on it

ploting the graph for robotic links change with difrentan angle 0 to 90

using plot commound for ploting (x0 x1 ) value and so on it

give a axis for ploting a ghraph by using axis commound

i have facing many errors in code

Avi video link :- https://youtu.be/WCxX9dTtV1E

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.