All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
1.OBJECTIVE : forward kinematic of a 2D robotic arm code : clear all close all clc %inputs L1=1; L2=0.5; theta1 = linspace(0,90,10); theta2 = linspace(0,90,10); ct=1; %for loop for i= 1:length(theta1) THETA1=theta1(i); for j=1:length(theta2) THETA2=theta2(j); %coordinates x0 = 0; y0 = 0; x1 = L1*cosd(THETA1);…
ARNALD ANTONY
updated on 24 Feb 2022
1.OBJECTIVE : forward kinematic of a 2D robotic arm
code :
clear all
close all
clc
%inputs
L1=1;
L2=0.5;
theta1 = linspace(0,90,10);
theta2 = linspace(0,90,10);
ct=1;
%for loop
for i= 1:length(theta1)
THETA1=theta1(i);
for j=1:length(theta2)
THETA2=theta2(j);
%coordinates
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.5 2 0 2])
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)
RESULT :https://drive.google.com/file/d/1-yC61uqzXhPPoU08cMWQdmr4Ce3otZ9K/view?usp=sharing
EXPLANATION :
code :
1.clear all - it is used to remove all the variables from the current workspace,clearing from them from system memory.
2.close all - deletes all the figures whose handles are not hidden.
3.clc - it is used to clear the command window.
4.inputs- it includes the variables such as L1, L2 , theta 1 & theta 2.
5.Then ct is set to 1.
6. A nested for loop is used in which 'i' is iterated from from 1 to the length of theta 1 & 'j' is iterated from 1 to the length of theta 2.
7.then the coordinates are assigned to xo, x1, x2, y0, y1 & y2 .
8.plot - plotting is used to plot the graph for x0,x1,x2,y0,y1 & y2 with the linewidth of 3.
9. getframe commant is used to saved the figures in the array 'M'.
10.movie(M) is used to create a videofile with the help of VideoWriter commant in AVI format.
11. openvideo command is used to open the file, closevideo command is used to close the file.
output :
This plot shows the animation of 2D robotic arm.
the arm with some length are given with theta 1 & theta 2. With the help of nested for loop, i and j will be iterated with the given length & with the given angle of theta 1 & theta 2.
so by using pause(0.03) the given animation is presented exactly as the robotic arm.
Leave a comment
Thanks for choosing to leave a comment. Please keep in mind that all the comments are moderated as per our comment policy, and your email will not be published for privacy reasons. Please leave a personal & meaningful conversation.
Other comments...
Advanced Sheet Metal Design Using NX Cad Challenge_5_Odd Shaped Enclosure
Advanced Sheet Metal Design Using NX Cad Challenge 5 Odd Shaped Enclosure Title of the Project: Advanced Sheet Metal Design Using NX Cad Challenge 5 Odd Shaped Enclosure Objective: To design a Odd shaped Enclosure with the help of NX advance sheet metal. Introduction: Sheet metal is metal formed by an industrial…
24 Jan 2023 05:34 PM IST
Advanced Sheet Metal Design Using NX Cad Challenge_2_Box Assembly
AIM : Advanced sheet metal design using NX cad challenge 2 Box Assembly . OBJECTIVE : To design a BOX Assembly using Siemens NX sheet metal application. INTRODUCTION : SHEET METAL is metal formed by an industrial process…
24 Jan 2023 07:10 AM IST
Advanced Sheet Metal Design Using NX Cad Challenge_1_Casing Design
Design of casing by using NX cad OBJECTIVE :- To design a sheet metal casting…
23 Jan 2023 11:03 AM IST
Fender Design - Wheel Arch Challenge
Aim : To calculate the wheel arch gap at required points and check whether the car passes the European standard. Objective : Study about the different wheel arch gap standards. Draw the lines at the required angle and points for the European standard. Measure the distance at each angles and mention…
16 Jan 2023 03:29 PM IST
Related Courses
0 Hours of Content
Skill-Lync offers industry relevant advanced engineering courses for engineering students by partnering with industry experts.
© 2025 Skill-Lync Inc. All Rights Reserved.