Challenge

Week 2- 2R Robotic Arm Challenge

AIM:

simulating forward kinematics of a 2R robotic arm using MATLAB programe.

OBJECTIVES:

  • Write a program in Matlab to simulate the forward kinematics of a 2R Robotic Arm
  • create an animation file of the plot

PROGRAM TO MATLAB:

% forward kinematics 2R robotics arm
close all
clear all
clc
% inputs
l1 = 3; % length of link 1
l2 = 2; % length of link 2
theta1 = linspace(0,80,15)
theta2 = linspace(0,80,15)
ct=1; %counter
for i= 1:length(theta1)
THETA1 =theta1(i)
for j=1:length(theta2)
THETA2=theta2(j)
% cordinates
x=0;
y=0;
% end point of link 1
x1=x+l1*cosd(THETA1)
y1=y+l1*sind(THETA1)
% end point of link 2
x2=x1+l2*cosd(THETA2)
y2=y1+l2*sind(THETA2)
% plotting
plot([x x1],[y y1],[x1 x2],[y1 y2],'linewidth',3)
grid on
axis([-0.1 6 -0.1 6])
pause(0.8)
m(ct)=getframe(gcf)
ct=ct+1;
end
end
movie(m)
videofile=VideoWriter('forward_kinematics_robotic_arm.avi','Uncompressed AVI')
open(videofile)
writeVideo(videofile,m)
close(videofile)
OUTPUT:
The output is obtained in form of an animated vidoclip.This animation can be viewed by using the link mentioned below.
https://youtu.be/DyyZCxhP9Vw

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.