Challenge

Week 3.2 - 2R Robotic Arm Challenge

https://youtu.be/4RFEUCitk30

(Youtube link of Robotic arm video)

%% Challange on Robotic Arm Movement one time.

clear all

close all

clc

l1 = 1;

l2 = 0.5;

thetha1 = linspace(10,90,10);

thetha2 = linspace(10,90,10);

ct = 1

for i = 1:length(thetha1);

THETHA1 = thetha1(i);

for j = 1:length(thetha2);

THETHA2 = thetha2(j);

x0 = 0;

y0 = 0;

x1 = l1*cosd(thetha1);

y1 = l1*sind(thetha1);

we have used cosd here instead of cos. Because I have taken the thetha in degree.

Because matlab understand that, if cosd is written, then it will take the value of any trigonometry function in degree. Rather than it will take the value in radian.

x2 = x1 + l2*cosd(thetha2);

y2 = y1 + l2*sind(thetha2);

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

axis([-0.1 1.5 0 1.5])

Determine the axis for movie creation. And to look plot much systematic.

pause(0.2)

To manage to speed of the movie.

M(ct) = getframe(gcf);

It is a helping function of movie creation.

ct = ct+1;

end

end

movie(M)

This is a inbuilt function for creating movie of any array for one single time.

videofile = VideoWriter('Robotic_arm.avi','Uncompressed AVI');

Videofile is a variable. And VideoWriter is a function. Which creates a VideoWriter object to write video data to an AVI file with motion. We also applied some additional properties, such as Uncompressed AVI.

open(videofile)

Open command to open the movie in variable videofile.

writeVideo(videofile,M)

Write video from an array to a video file.

close(videofile)

Close command to open the video file.

NOTE :-

Error report is also attached.

It contains error screenshots which came in the command window. And the corrective action taken.

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.