Week 2- 2R Robotic Arm Challenge
AIM:
- A program in matlab to simulate the forward kinematics of a 2R robotic arm
CONCEPT:
- A robot arm is a known as, manipulator. in 2D arm structure it has two links and 2 joints , one is fixed on the base and the other one is moveable
- In basic , a robot arm consists of the parts: joints,links,and a end manupulator
- End part of the link is made for different purpose, like grabbing the parts, welding structure,machining tool and etc...
- This arm is exactly work like the human arm,it can work on the different angle with respect to its working range area.
OBJECTIVE :
- The main objectivev of the program is to create a program of define the work space of an 2D robotic arm using forward kinematic with the help matlab
BODY OF THE CONTENT:
- SOFTWARE USED - MATLAB
{MAIN CODING OF THE PROGRAM}
%kinematics of 2D robotic arm program
clear all
close all
clc
%inputs
l1 = 0.8;
l2 = 0.4;
theta1 = linspace(0,90,10);
theta2 = linspace(0,90,10);
ct = 1;
for i = 1:length(theta1)
THETA1 = theta1(i);
for j = 1:length(theta2)
THETA2 = theta2(j);
x0 = 0;
y0 = 0;
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);
axis([-0.1 1.5 0 1.5])
pause(0.03);
M(ct) = getframe(gcf);
ct=ct+1;
end
end
movie(M)
videofile = VideoWriter('forward_kinematics.avi','Uncompressed AVI');
open(videofile)
writeVideo(videofile,M)
close(videofile)
CODING EXPLANATION:
- First few line are the basic command of the coding
- clear all command is used to clear all the variables from the current workspace
- close all command is used tonclose all figures whose handles are visible
- defining the user- defined inputs
- l1 & l2 are length of link 1 and length of link2 respectively
- LINESPACE_the linespace function generates linearly spaced vectors
- using the plot commands to create a plotting, grape of 2D robotic arm
- IN this plotting we have two links so in this program 2 lopping functions are inside there
- LINEWIDTH command is used to given the width of the line which is going to be plotting on a grap
- TITLE is for giving title to the graph
- AXIS is for assigning axis to the plot
- movie command used to make a movie
- .avi is extension in which the vedio file gets saved
close command closses the video file in the end
OUTPUT RESULTS:
CONCLUSION:
- AS a conclusion of this program toughts me a lot of basic ideas about how the robotic arms are working and how they are made up of
- In the programing point i learnt a bit more clear about the for loop function and how it works with this animation part that was really awesome
- Eventhough i am new to programing the tutorial video was very clear and helped me a lot of understand this functioning.
RESULT VEDIO LINK:
https://drive.google.com/file/d/1D4t_dknMDFXSyML2VU_eF1xl9JkUhbhF/view?usp=sharing