https://youtu.be/ATyBR95lI7A
% Program of forward kinematics of 2R robotic arm
clear all
close all
clc
% Inputs
%Length of First Arm
l1=1;
%Length of First Arm
l2=0.5;
% Angle of First Arm with the horizontal Reference
theta1 =linspace(0,90,15);
%Angle of Second Arm with the horizontal Reference
theta2 =linspace(0,90,15);
ct=1;
for i = 1:length(theta1)
THETA1=theta1(i);
for k=1:length(theta2)
THETA2=theta2(k);
x0 = 0
y0 = 0
x1 = l1*cosd( THETA1)
y1 = l1*sind( THETA1)
x2 = x1+l2*cosd(THETA2)
y2 = y1+l2*sind(THETA2)
% Plotting the graph
plot([x0 x1],[y0 y1],[x1 x2],[y1 y2],'linewidth',2)
axis([-0.1 1.5 0 1.5])
xlabel('X-Axis','color','b')
ylabel('Y-Axis','color','r')
title('Forward Kinematics of 2R Robotic Arm','color','r')
pause(0.3)
M(ct) = getframe(gcf);
ct = ct+1;
grid on;
end
end
movie(M)
videofile = VideoWriter('forward_kinematics.avi','Uncompressed AVI')
open(videofile)
writeVideo(videofile,M)
close(videofile)
Results:-
1) I have created a video file for this program for differents angles.
Difficulties during writing a program as follows
1) In below syntax I faced a problems.I Solved the problems by taking help of mathworks and seeing a video again and again.
videofile = VideoWriter('forward_kinematics.avi','Uncompressed AVI')
# I have uploaded this videofile on the YOUTUBE.Here I have provided the link for the same.
https://youtu.be/ATyBR95lI7A
# Also I have uploaded this videofile on my google drive.
Please see the link
https://drive.google.com/file/d/1WRhJrCQO1_euv8ovAc_6HjsQWwZZkR6h/view?usp=sharing