All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
Aim : Write a program in Matlab to simulate the forward kinematics of a 2R Robotic Arm Diagram of the 2R Robotic arm: L1 = length of Link1 in meters L2 = length of Link2 in meters theta1 = angle1 = angle made by link1 with x axis theta2 = angle2 = angle made by link2 with x axis (x0,y0) = coordinates of link1 attached…
chetankumar nadagoud
updated on 03 Jan 2022
Aim : Write a program in Matlab to simulate the forward kinematics of a 2R Robotic Arm
Diagram of the 2R Robotic arm:
L1 = length of Link1 in meters
L2 = length of Link2 in meters
theta1 = angle1 = angle made by link1 with x axis
theta2 = angle2 = angle made by link2 with x axis
(x0,y0) = coordinates of link1 attached to support
(x1,y1) = coordinates of link1 where it attaches to link2 also its the starting coordinate of link2
(x2,y2) coordinates of where link2 ends
Main program :
clear all
close all
clc
%coordinates of arm1 attached to support
x0 = 0;
y0 = 0;
%angle made by both arms with respect to x axis in degrees
theta1 = linspace(0,90,15);
theta2 = linspace(0,90,15);
%length of arms in Meters
L1 = 1;
L2 = 0.5;
ct = 1;
for i=1:length(theta1)
Theta1 = theta1(i)
for j =1:length(theta2)
Theta2 = theta2(j)
x1 = L1*cosd(Theta1)
y1 = L1*sind(Theta1)
x2 = x1 + L2*cosd(Theta2)
y2 = y1 + L2*sind(Theta2)
%plot
plot([x0 x1],[y0 y1],[x1 x2],[y1 y2],'linewidth',4)
axis([0 1.6 0 1.6])
pause(0.03)
M(ct) = getframe(gcf)
ct=ct+1;
end
end
%Creating a animation
movie(M)
videofile = VideoWriter('forward_kinematics.avi','uncompressed AVI') %create videofile
open(videofile) %opens videofile created titled forward_kinematics
writeVideo(videofile,M) %writes each frame captured in M into videofile
close(videofile) %closes videofile after writing of frames is completed
Explanation of Code :
Output :
Animation file link:
https://youtu.be/zsl7Xhaum_U
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...
Week 1 : Exploring the GUI of GT-POWER
Aim : Explore the GUI of GT-Suite and run the intercooler setup. GT SUITE: GT-SUITE is the industry-leading simulation tool with capabilities and libraries aimed at a wide variety of applications and industries. It offers engineers functionalities ranging from fast concept design to detailed system or sub-system/component…
05 Dec 2022 09:52 AM IST
Project 1 : CFD Meshing for Tesla Cyber Truck
CFD Meshing of Tesla Cyber Truck Aim : CFD meshing for Tesla Cyber Truck. Objectives: For…
04 Dec 2022 10:50 AM IST
Week 4 Challenge : CFD Meshing for BMW car
CFD Meshing for BMW car Aim: CFD meshing for BMW car using ANSA Objectives: For the given model, check and solve all geometrical errors on half portion and Assign appropriate PIDs. Perform meshing with the given Target length and element Quality criteria. After meshing the half model, Do symmetry to the other side. Target…
30 Nov 2022 06:45 AM 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.