Week 2- 2R Robotic Arm Challenge
AIM: Simulating Forward Kinematics of a 2RRobotic arm using MATLAB program.
OBJECTIVES:
Write a program in matlab to simulate the forward kinematics of a 2R robotic arm
THEORY:
A Robotic arm is a type of mechanical arm, usually programmable, with similar functions to a human arm. the links of such a manipulator are connected by joints allowing either rotational motion or translational displacement. The links of manipulator is the manipulator can be considered to form a kinematic chain. The terminus of kinematic chain of the manipulator is called the end effector.
Robotic arms used in various industrial applications such as drilling, welding, metal cutting etc.
Here we have a2R Robotic arm as showen in figure:

PROGRAM
Program language used in Matlab
% A program to simulate the forward kinematics of a 2R robotic arms
clear all
close all
clc
% Inputs
% Length of lin-1 (L1) and link-2 (L2) in meter
L1=1;
L2=.5;
% Angle traced by link-1 in degrees (theta_1)
theta_1= 45;
% Angle trced by link-2 in degrees (theta_2)
theta_2= 45;
%Base coorinates of link-1
X_0=0;
Y_0=0;
ct=1;
for i=1: length(theta_1)
end
THETA_1= theta_1(i);% taking particular values of the angle traced by the link_1 in order.
for j=1:length (theta_2) % Iterating all values of theta_2 for particular values of theta_1.
end
THETA_2= theta_2(j); % taking particular values of angle traced by the link_2 in order.
% Calculating the coordinates of the end point of link_1
X_1=X_0+L1*cosd(theta_1);
Y_1= Y_0+L1*sind(theta_1);
% Calculating the coordinates of the end 0f link_2
% End coordinates for link_1 are the start coordinates for link_2
X_2=X_1+L2*cosd(theta_2);
y_2=Y_1+L2*sind(theta_2);
% Plotting the robotic arm for simulation
Plot([X_0 X_1],[Y_0,Y_1],[X_1,X_2],[Y_1,Y_2], "linewidth" ,0.5);
axis([-.1 1.5 0 1.5]);
%pausing the current plot for a while before moving to the next
%plot
pause(0.03);
% Capturing the current plot t ocombine
% Capturing the current plot t ocombine later
M(ct) = getframe(gcf);
% Incrementing ct so that each frame is captured in M
ct=ct+1;
Not working in programing
here is the error given below

After resolving the error we get the image of 2R Robotic artms
