Project

Simulation of 2R Robotic Arm

The following code is used to simulate the forward kinematics of a 2R Robotic arm. I used Gif online maker to animate.

Youtube Link: https://youtu.be/NHFgr_p3Ims

% forward kinematics 
clc
close all
clear all

l1 = 2;
l2 = 1;
x0 = 0;
y0 = 0;
theta1 = linspace(0,90,10);
theta2 = linspace(0,90,10);
count =1;

for i= 1:length(theta1)
 the1 = theta1(i);
 for j = 1:length(theta2)
  the2 = theta2(j);
  
  x1 = l1*cosd(the1);
  y1 = l1*sind(the1);

  
  x2 = x1+l2*cosd(the2);
  y2 = y1+l2*sind(the2);
  
  figure(1)
  directory = \"C:/Users/Venki_LFC/Documents/Study/Octave/forward_kinematics_movie/\";
  name = num2str(count);
  endformat = \".jpg\";
  filename = strcat(directory,name,endformat);
  plot([x0 x1],[y0 y1],\'linewidth\',3,\'color\',\'r\');
  hold on
  plot([x1 x2],[y1 y2],\'linewidth\',3,\'color\',\'g\');
  hold off
  axis([0 6 0 6])
  saveas(gcf,filename);
  count = count+1;
 end
end
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.