Week 2- 2R Robotic Arm Challenge
Aim:-
- To simulate the forward kinematic of 2R robotic arm using MATLAB.
Objective:-
- Write a program to solve the forward kinematic of the 2R robotic arm.
Introduction:- A robotic arm is a robot manipulator, 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 the manipulator can be considered to form a kinematic chain. The use of industrial robots is increasing in areas such as food, consumer goods, wood, plastic, and electronics but is still mostly concentrated in the automotive industry.

There are 4 components.
- The base is clamped on the surface and all other links are joined through the hinge joint.
- Link (L1) making an angle THETA1 with horizontal.
- Link (L2) making an angle THETA2 with horizontal.
- The device attached to the manipulator which interacts with its environment to perform tasks is called the end effector.
Inputs:-
Link 1=1m
link 2=0.5m
theta 1=(0,90,4)
theta 2=(0,90,4)
The co-ordinate of the base, i.e is assumed to be at origin(0,0)
The coordinate of endpoints of link 1 is-
x1=l1*cosd(THETA1)
y1=l1*sind(THETA1)
Similarly, The co-ordinate of end points of link 2 is-
x2=x1+l2*cosd(THETA2)
y2=y1+l2*sind(THETA2)
Matlab code:-
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
figure(ct)
line([x0 x1],[y0 y1],'linewidth',3,'color','b')
line([x1 x2],[y1 y2],'linewidth',3,'color','r')
axis([-0.2 1.7 -0.2 1.7])
file=sprintf('output%d.png',ct)
saveas(gca,file)
ct=ct+1
end
endfor
Video link:-
https://drive.google.com/file/d/1wr1-exdxDi0uIui0AMj-_9YnDpR8j-6-/view?usp=sharing