Challenge

Week 2- 2R Robotic Arm Challenge

% forward kinematics of 2r robotics arm
clear all
close all
clc

%inputs
l1=1.5; length of 1st link
l2=0.5; length of 2nd link
theta1=linspace(0,90,12) here we generate 12 linear vectors for link 1st incline
theta2=linspace(0,90,12) same here for 2nd link here run this command get fine results shown in screen shot

ct=1;

for i=1:length(theta1) for loop start, here i is explain range of theta 1 form 1
THETA1=theta1(i); here display range of theta1 here i run but face error because of i did not close or end for loop shown in screen shot
for j=1:length(theta2) same for theta2
THETA2=theta2(j)
x0=0; these are coordinates of link 1st at base or origin
y0=0;

x1=l1*cosd(THETA1); these are coordinates at end of link 1st or starting of link 2
y1=l1*sind(THETA1);

x2=x1+l2*cosd(THETA2); these are coordinates of link 2
y2=y1+l2*sind(THETA2);

%plotting
plot([x0 x1],[y0 y1],[x1 x2],[y1 y2],'linewidth',3)
axis([-0.05 2 0 3]) axis where range of x axis and y axis
pause(0.1)
m(ct)=getframe(gcf); get all the figiure in one frame
ct=ct+1;
end
end end both for loops
movie(m) make movie in MATLAB
videofile=VideoWriter('forward_kinematics.avi','Uncompressed AVI')
open(videofile)
writeVideo(videofile,m)
close(videofile)

https://youtu.be/627Je9ABk3w

https://youtu.be/75MgB8qwNJk

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.