Project

Forward Kinematics of robotic arm using MATLAB

This is a program written using MATLAB to represent the various positions assumed by a robotic arm using forward kinematics. In this , we assume the robotic arm to have two links. The end of the second link is connected or attached to a manipulator which could be used for any purpose such as welding , cutting etc.

Here in this program the chief objective is to create an animation out of the various positions of the robotic arm which can be achieved as follows:

close all
clear all
clc

% FORWARD KINEMATICS OF ROBOTIC ARM
% angleA = angle made by link-1 with x-axis (which is assumed to vary between 0-90 degrees)
% angleB = angle made by link-2 with x-axis (which is assumed to vary between 0-90 degrees)

angleA = linspace(0,90,25);
angleB = linspace(0,90,25);

% here we write a 'for' loop which functions in such a way that for every
% angleA , angleB varies ; so as to represent various positions of the manipulator.

% we also introduce Angle1 and Angle2 , which represents the angle assumed
% by the links in that iteration.
ct=1;
for i = 1:length(angleA)
Angle1 = angleA(i);
for j = 1:length(angleB)
Angle2 = angleB(j);

%inputs given
length_of_link1 = 1;
length_of_link2 = 0.5;

%coordinates of origin or starting point of link-1
x0 = 0;
y0 = 0;

%coordinates of end point of link-1 or starting point of link-2
x1 = length_of_link1*cosd(Angle1);
y1 = length_of_link1*sind(Angle1);

%coordinates of end point of link-2 or the position of the
%manipulator
x2 = x1+length_of_link2*cosd(Angle2);
y2 = y1+length_of_link2*sind(Angle2);

%plotting the positions of the robotic arm
plot([x0 x1],[y0 y1],[x1 x2],[y1 y2],'linewidth',2)
axis([-0.25 1.8 0 1.8])
pause(0.02)
M(ct) = getframe(gcf);
ct=ct+1;
end
end

movie(M)
videofile = VideoWriter('forwardkinematics_roboticarm.avi', 'uncompressed AVI');

open(videofile)
writeVideo(videofile,M)
close(videofile)

______________________________________________________________________________

Below attached is the video created from the above code.

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.