Week 2- 2R Robotic Arm Challenge
https://drive.google.com/file/d/1_2D1rA2yUWhRYkm0FLNtl8HqGwsAr6U2/view?usp=sharing
clear all
close all
clc
%Input
L1=1;%length of primary arm
L2=0.5%length of sendory arm
%used to 10 value of theta from 0 degree to 90 degree
theta1=linspace(0,90,10);%for primary arm angle
theta2=linspace(0,90,10);%for sendory arm angle
ct=1;%counter actully represent each and every fram
for i=1:length(theta1)
THETA1=theta1(i);
for j=1:length(theta2)
THETA2=theta2(j);
%inyial x and y cordinates
x0=0;
y0=0;
%finel x and y cordinates
x1=L1*cosd(THETA1);
y1=L1*sind(THETA1);
x2=x1+L2*cosd(THETA2);
y2=y1+L2*sind(THETA2);
%plotting
plot([x0 x1],[y0 y1],[x1 x2],[y1 y2],'linewidth',3)
%used to determine the axis point upto which it is visible
axis([0 2 0 2])
legend('primary arm','secondry arm')
title('forward kinematics of 2R Roboticsarm')
%pause is used to control the speed of animation
pause(0.03)
M(ct)=getframe(gcf);
ct=ct+1;
end
end
%to make it into a video
movie(M)
%videofile=videoWriter('forward_kinematic.avi','uncompressed AVI');
videofile=VideoWriter('forward_kinematics.avi','uncompressed AVI');
open(videofile)
writeVideo(videofile,M)
close(videofile)