Project

forward robotic arm

% robotic arm manipulator
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);
        
        % animation

        plot([x0 x1],[y0 y1],[x1 x2],[y1 y2],'linewidth',3)
        grid on
        axis([0 1.5  0 1.5])
        pause(0.03)
        m(ct) = getframe(gcf);
        ct = ct+1;
    end
end
 
%videofile
movie(m)
videofile = VideoWriter('forward_robotic_arm.avi','Uncompressed AVI')
open(videofile)
writeVideo(videofile,m)
close(videofile)

AIM: - To code a programme for making animation of 2R robotic arm

GOVERNING EQUATION: - The degree of freedom of the 2R robotic arm is 2. So we need two point to define the state of 2R robotic arm.

So, for calculating these two point we would simple geometrical equation.

OBJECTIVE: - To find the all the possible location of the robotic arm via animation.

BODY OF CONTENT: -

% robotic arm manipulator

clear all (to clear the command which is use in past)

close all (to close all the plot)

clc (to clear previous data)

% input

l1 = 1; (length of arm 1st arm)

l2 = 0.5;(length of 2nd arm)

theta1 = linspace(0,90,10);(to generate the array of of 10 elements)

theta2 = linspace(0,90,10);(to generate the array of of 10 elements)

ct = 1;(variable which is increase by one to collect the window)

for i = 1 : length(theta1) ( to generate array)

THETA1 = theta1(i);( to assign the value of variable)

for j = 1 : length(theta2)( to generate array)

THETA2 = theta2(j);( to assign the value of variable)

x0 = 0;(both are the fix point)

y0 = 0;

x1 = l1*cosd(THETA1);(to evaluate the value of x1)

y1 = l1*sind(THETA1);(to evluate the value of y1)

x2 = x1 + l2*cosd(THETA2);(to evaluate the value of x2)

y2 = y1 + l2*sind(THETA2);(to evaluate the value of x2)

% animation

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

grid on

axis([0 1.5 0 1.5])(to fix axis)

pause(0.03)

m(ct) = getframe(gcf);( collect window for each window)

ct = ct+1;( inreamental)

end

end

%videofile

movie(m) ( these below code is to save animation in video file)

videofile = VideoWriter('forward_robotic_arm.avi','Uncompressed AVI')

open(videofile)

writeVideo(videofile,m)

close(videofile)

CONCLUSION: - we have successfully code the programme which give us the animation of the 2R robotic arm and we also save this animation in video file.

To watch the video go through this link - https://youtu.be/QS9UeE3U-ZE

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.