Week 2- 2R Robotic Arm Challenge
% Forward Kinematics of a 2R Robotic arma
clear all
close all
clc
% Inputs Required
% l1 and l2 are lengths of robotic arm in base and above respectively provided in Meter
l1=1.5;
l2=1;
% theta1 and theta2 are array containg the Values of angles made by the 2 arms
theta1=linspace(0,90,10);
theta2=linspace(0,90,10);
% Running a For loop so as to create an animation by capturing movement of arms throught the angles theta1 and theta2
ct=1;
for i=1:length(theta1)
ang1= theta1(i);
% ang1 is a vraible used to hold the value of theta1 for each iteration of loop
for j=1:length(theta2)
ang2=theta2(j);
%ang2 is a vraible used to hold the value of theta2 for each iteration of loop
x0=0;
y0=0;
% x0 and y0 are base point of arm1, arm at base
x1=l1*cosd(ang1);
y1=l1*sind(ang1);
% x1 and y1 are end points of arm one at the angle ang1
x2= x1+l2*cosd(ang2);
y2= y1+l2*sind(ang2);
% x2 and y2 are end points of arm two at the angle ang2
% Plotting
plot([x0 x1],[y0 y1],[x1 x2],[y1 y2])
axis([-0.1 2 -0.1 2])
pause(0.03)
% creating an array M to store each frame of the plot to generate an avi file
M(ct)= getframe(gcf);
ct=ct+1;
end
end
% Creating a Video File
movie(M)
videofile = VideoWriter('forward_kinematics_of_2R_roboarm.avi','Uncompressed AVI');
open(videofile)
writeVideo(videofile,M)
close(videofile)
AIM : To Determine the filed of motion / Forward Kinematics of a robotic arm
STEPS :
1. Determine the Equations required for determining the movement of robotic arms using basic trignometry.
2. Providing the predetermined values to like len gth of arms and the rangle of angles for motion of robotics arms.
3. Developing an array of angles formed by the robotic arms using Linspace command.
4. Using nested for loops for applying the eqautions used for position determination for each angle formed by the arm.
5. Using plot command withing the nested for loop so as to plot the position of robotics arm for each angle formed by it.
6. The Ploted frames/figures are captured to an array and is converted to a video file.
RESULT: The the movement of robotic arm with respect to each angle formed by the arms were captured .
Video Link :https://drive.google.com/file/d/1SFQYsSCcES-Kpt5N5yRqVN_v4FktsKML/view?usp=sharing
Errors:
1. Typo errors
2. Unable to generate video file output using MatLab Web and Ocatave Software.
Error Resolutions:
1. Corrected the Syntax Errors on the code.
2. Contacted Technical Support and arranged a one-on-one session and as my system dosent support matlab and as the system form Skill Lync hasn't been arrived yet also since the assignment deadline was nearby, I was recommended to use any 3rd party apps to genrate video from the the frames and continue doing it till the Skill Lync System arrives.
I have attached the Sreenshots for your reference.
# I have used Octave and Tried the code in MatLab Web but still the video file geeation seems to cause an error so i have done it as recommended by the technical support team.