Challenge

Week 2- 2R Robotic Arm Challenge

REPORT

A program in Matlab to simulate the forward kinematics of a 2R Robotic Arm

You tube link = https://youtu.be/9XFJFEflOu0

https://drive.google.com/file/d/1Dh-ru8kxHin1_ZlLegi6FRTW_MAp6w8x/view?usp=sharing

Steps for code:

1) Calculate the position of link 1 with length l1 and theta 0 as origin and theta 1 end angle link1.

2) Calculate the position of link 2 with length l2 and theta1 start angle and theta1 end angle link 2 .

3) Solution set of origin point as x0 y0 , end point link1 start point link2 as x1 y1, en point link 2 as x2 y2.

4) With multiple values of theta 1 and theta 2 plot is created by stiching and creating animation.

5) Provide inputs as link 1 length 1 and link 2 length 0.5, angles 0 to 90 degree use linespace command.

6) use ct=1 and for loop to 'i' and 'j' variables with varying lengths for specific theta angles.

7) Plot workspace with origin , middle and end coordinates. Provide axis to workspace an pause time.

8) Generate movie including 2R robotic arm animation save it and run it.

% Program to simulate the forward kinematics of a 2R Robotic Arm.

clear all 
close all 
clc
%inputs
l1=1;
l2=0.5;
theta1=linspace(0,90,10);
theta2=linspace(0,90,10);
ct=1;
for i=1:length(theta1)
    THETA1=theta1(i);
for j=1:length(theta2)
    THETA2=theta2(j);
 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',6)
 axis([-0.1 1.5 0 1.5])
 grid on
 xlabel ('X-Axis Work Space')
 ylabel ('Y-Axis Work Space')
 title ('2R-Robotic Arm Forward Kinematics')
 pause(0.1)
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)
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.