Week 3.2 - 2R Robotic Arm Challenge
Write a program in Matlab to simulate the forward kinematics of a 2R Robotic Arm, as shown in the video.
- Create an animation file of the plot.
- Upload an animation on You tube and provide the You tube link for an animation in your report.
- You can also provide the google drive link.Note: Make sure that you provide the access to the video, while pasting the google drive link.
- The presentation of your code will be taken into consideration while grading.
- paste the code using the "INSERT SAMPLE CODE" option and attach screenshots of the output.
Content expected in the report:
- Step-wise explanation of your code.
- Mention the errors faced while programming.
- Steps taken to overcome those errors.
- Screenshots showing errors thrown in command window.
Just submitting your code without the report will result in a 0 grade.
Content expected in the report:
- Step-wise explanation of your code.
- Mention the errors faced while programming.
- Steps taken to overcome those errors.
- Screenshots showing errors thrown in command window.
In case if you are not able to finish the challenge upload until what you have done and explain the procedure and plot. Deserved marks shall be allotted.
Just submitting your code without the report will result in a 0 grade.
Your Answers
AIM
%inputs parameters like length of linls and different angle positions
L1 = 1; % length of link 1
L2 = 2; % length of link 2
theta1 = linspace(0,90,35);
theta2 = linspace(0,90,35);
ct = 1;
%for every angle of theta1 there will be 10 respective angles of theta2, this can be achived by for loop function
for i = 1:length(theta1)
THETA1 = theta1(i);
for j = 1:length(theta2)
THETA2 = theta2(j);
% coordinatespoints of links at starting and ending positions
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)
grid on
axis([-0.1, 1.5, 0, 1.5]);
pause(0.1)
m(ct) = getframe(gcf);
ct = ct+1;
end
end
%movie generation code
movie(m)
videofile = VideoWriter('forward_kinematic.avi','uncompressed AVI');
open("videofile")
writeVideo(videofile,m)
close(videofile)
: Finding possible location that a robot arm/end effector can move in workspace/work envelope of 2R robotic arm
THEORY :
FORWARD KINEMATICS = It is a process of obtaining position and velocity of end effector, given the known joints angles (theta1,theta2) and velocities .
Here we are find coordinates of end effector of 2R(rotating) robot arm.
It has two links link1, link2
Steps to be followed to find the coordinates of end effector
- Calculate position of link1,coordinate of link1 starting point is (0,0) = (x0, y0) and coordinate point of end of link 1 (x1,y1) = (L1cos(theta1), L2sine(theta2))
- similarly coordinate points of link two i.e starting point of link 2 (x1, y1) = (L1cos(theta1), L2sine(theta2)) and ending point (x1 + L2cos(theta2), y1 + L2sin(theta2))