Robotics Project
Robotics Project
Submitted to
Submitted by
18 Jan 2022
1
Table of Contents
Introduction .................................................................................................................................................. 3
ROT3U.......................................................................................................................................................... 3
Link Lengths .................................................................................................................................................. 3
DH Table ........................................................................................................................................................ 3
Forward Kinematics ...................................................................................................................................... 4
Transformation Matrices .......................................................................................................................... 4
End effector coordinates .......................................................................................................................... 5
Inverse Kinematics ........................................................................................................................................ 5
MATLAB Method ....................................................................................................................................... 5
MATLAB code ........................................................................................................................................ 6
Results ................................................................................................................................................... 6
Inverse Kinematic Equations ..................................................................................................................... 7
Transformation Matrix .......................................................................................................................... 7
Inverse kinematic equations ................................................................................................................. 8
Developing Application for ROT3U ............................................................................................................... 8
Code .......................................................................................................................................................... 9
Comments and Results ............................................................................................................................... 15
References .................................................................................................................................................. 16
2
Introduction
The aim of the project is to find the forward and inverse kinematics of the robotics manipulator
ROT3U. The we develop an application by controlling the ROT3U using an Arduino and
perform a certain task.
ROT3U
ROT3U is a 6DOF robot with the following specifications
Figure 1 ROT3U
Link Lengths
Link lengths of the robot were measured to be:
𝐿1 = 46𝑚𝑚
𝐿2 = 104𝑐𝑚
𝐿3 = 100𝑚
𝐿4 = 20𝑚𝑚
DH Table
i ai−1 𝛼i−1 di 𝜃i
1 0 0 0 𝜃1
2 46 90° 35 𝜃2
3 104 0 0 𝜃3
4 100 0 0 𝜃4
[5 20 90° 40 𝜃5 ]
3
Forward Kinematics
Forward kinematics refers to the use of the kinematic equations of a robot to compute the
position of the end-effector from specified values for the joint parameters.
Transformation Matrices
We compute each of the link transformations:
𝑐𝑖 −𝑠𝑖 0 𝛼𝑖−1
𝑖−1 𝑠𝑖 𝑐𝛼 𝑖−1 𝑐𝑖 𝑐𝛼𝑖−1 −𝑠𝛼𝑖−1 −𝑠𝛼𝑖−1 𝑑𝑖
𝑖𝑇 = [ ]
𝑠𝑖 𝑠𝛼𝑖−1 𝑐𝑖 𝑠𝛼𝑖−1 𝑐𝛼𝑖−1 𝑐𝛼𝑖−1 𝑑𝑖
0 0 0 1
𝑐1 −𝑠1 0 0
0 𝑠1 𝑐1 0 0
1𝑇 = [ ]
0 0 1 0
0 0 0 1
𝑐2 −𝑠2 0 0.035
1 0 0 −1 𝑑2
2𝑇 = [ ]
𝑠2 𝑐2 0 0
0 0 0 1
−𝑐3 𝑠3 0 0.105
2 −𝑠 −𝑐3 0 0
3𝑇 =[ 3 ]
0 0 1 0
0 0 0 1
−𝑐3 𝑠3 0 0.1
3 −𝑠3 −𝑐3 0 0
4𝑇 = [ ]
0 0 1 0
0 0 0 1
𝑐5 −𝑠5 0 0.025
4 0 0 −1 𝑑5
5𝑇 = [ ]
𝑠5 𝑐5 0 0
0 0 0 1
0
5𝑇 = 01𝑇 ∗ 12𝑇 ∗ 23𝑇 ∗ 34𝑇 ∗ 45𝑇
4
Finding the transformation matrix is a very tedious process, which can be made simple by using
the following MATLAB code:
syms c1 s1 c2 s2 c3 s3 c4 s4 c5 s5
t1 = [c1 -s1 0 0;s1 c1 0 0;0 0 1 0;0 0 0 1]
t2 = [c2 -s2 0 46;0 0 -1 35;s2 c2 0 0;0 0 0 1]
t3 = [c3 -s3 0 104;s3 c3 0 0;0 0 1 0;0 0 0 1
t4 = [c4 -s4 0 100;s4 c4 0 0;0 0 1 0;0 0 0 1
t4 = [c4 -s4 0 100;s4 c4 0 0;0 0 1 0;0 0 0 1
t5 = [c5 -s5 0 20;0 0 -1 40;s5 c5 0 0;0 0 0 1
A = t1*t2*t3*t4*t5
Where A represents 05𝑇
Inverse Kinematics
Inverse kinematics is the mathematical process of calculating the variable joint parameters
needed to place the end of a kinematic chain in each position and orientation relative to the start
of the chain.
MATLAB Method
Finding the inverse kinematics of a 5 DOF robot is a very computational method. Instead, of
solving it manually, we can make use of MATLAB. We use the robotics toolbox for this purpose
5
[1]. The ‘fkine()’ command calculates the forwards kinematics of the robot and thus finds the
end effector coordinates. The ‘ikine()’ command calculates the inverse kinematics of the robot
and calculates the joint angles using the end effector coordinates [2].
MATLAB code
close all
L(1) = Link([0 0 0 0], 'standard');
L(2) = Link([0 35 46 pi/2], 'standard');
L(3) = Link([0 0 104 0], 'standard');
L(4) = Link([0 0 100 0], 'standard');
L(5) = Link([0 40 20 pi/2], 'standard');
KR = SerialLink(L)
qf= [pi/6 -pi/8 -pi/4 pi/8 0];
Tf = KR.fkine(qf);
q0= [0 0 0 0 0];
q=KR.ikine(Tf, q0, 'mask', [1 1 1 1 1 0]);
Results
6
Inverse Kinematic Equations
Even though the above MATLAB program solves the inverse kinematics for the robot, it does
not provide us with the inverse kinematic equations. To solve for the inverse kinematic
equations, we use the method represented in [3].
Transformation Matrix
Finding the transformation matrix is a very tedious process, which can be made simple by using
the following MATLAB code:
syms c1 s1 c2 s2 c3 s3 c4 s4 c5 s5
t1 = [c1 -s1 0 0;s1 c1 0 0;0 0 1 0;0 0 0 1]
t2 = [c2 -s2 0 46;0 0 -1 35;s2 c2 0 0;0 0 0 1]
t3 = [c3 -s3 0 104;s3 c3 0 0;0 0 1 0;0 0 0 1
t4 = [c4 -s4 0 100;s4 c4 0 0;0 0 1 0;0 0 0 1
t4 = [c4 -s4 0 100;s4 c4 0 0;0 0 1 0;0 0 0 1
t5 = [c5 -s5 0 20;0 0 -1 40;s5 c5 0 0;0 0 0 1
A = t1*t2*t3*t4*t5
Where A represents 05𝑇
7
𝑝𝑥 = 46 ∗ 𝑐1 − 35 ∗ 𝑠1 + 104 ∗ 𝑐1 ∗ 𝑐2 − 40 ∗ 𝑐4 ∗ (𝑐1 ∗ 𝑐2 ∗ 𝑠3 + 𝑐1 ∗ 𝑐3 ∗ 𝑠2) + 20 ∗ 𝑐4 ∗ (𝑐1
∗ 𝑐2 ∗ 𝑐3 − 𝑐1 ∗ 𝑠2 ∗ 𝑠3) − 20 ∗ 𝑠4 ∗ (𝑐1 ∗ 𝑐2 ∗ 𝑠3 + 𝑐1 ∗ 𝑐3 ∗ 𝑠2) − 40 ∗ 𝑠4 ∗ (𝑐1
∗ 𝑐2 ∗ 𝑐3 − 𝑐1 ∗ 𝑠2 ∗ 𝑠3) + 100 ∗ 𝑐1 ∗ 𝑐2 ∗ 𝑐3 − 100 ∗ 𝑐1 ∗ 𝑠2 ∗ 𝑠3
θ2 = tan-1 (py/px)
θ1 = θ12 - θ2
θ3 = tan-1 (s3/c3)
θ5 = θ345 - θ34,
where,
The proposed application is live sketching in the x, y plane. A drawing item will be placed at the
end of the manipulator. The manipulator only changes its position in the x, y plane since it is a
2D sketch. The way the input commands will work is that instead of typing the coordinates of the
end effector in code, a touch screen will be calibrated such that the transverse position of finger
on the screen will indicate x coordinate and lateral position of finger on the screen will indicate y
coordinate. These coordinates are to be within the workspace of the manipulator. With the x and
y coordinates of end effector provided via a live feed, the manipulator will follow the path drawn
8
on the screen. This way, live sketching can be done using the manipulator via providing inputs
through a touch screen.
Code
The code shown is used to control x, y, z position of the end effector of ROT3U [4]. The servo
speeds are also controlled in this code to control the speed of the robot. The code also includes
comments explaining each step of the process.
#include VarSpeedServo.h
#define GRIPPER 20 //gripper (incl.heavy duty wrist rotate mechanism) length "
#define BAS_SERVO 4
#define SHL_SERVO 5
#define ELB_SERVO 6
#define WRI_SERVO 7
#define WRO_SERVO 8
#define GRI_SERVO 9
/* pre-calculations */
9
int servoSPeed = 10;
VarSpeedServo servo1,servo2,servo3,servo4,servo5,servo6;
int loopCounter=0;
int microsecondsToDegrees;
void setup()
delay( 5500 );
servo_park();
delay(4000);
Serial.begin( 9600 );
Serial.println("Start");
void loop()
loopCounter +=1;
//delay(7000);
10
//zero_x();
//line();
//circle();
delay(4000);
if (loopCounter > 1) {
servo_park();
delay(5000);
//exit(0);
/* z is height, y is distance from base center out, x is side to side. y,z can only be positive */
float grip_angle_r = radians( grip_angle_d ); //grip angle in radians for use in calculations
y = rdist;
/* Wrist position */
11
float wrist_z = ( z - grip_off_z ) - BASE_HGT;
/* shoulder angle */
microsecondsToDegrees = map(ftl(bas_servopulse),544,2400,0,180);
servo1.write(microsecondsToDegrees,servoSpeed); // use this function so that you can set servo speed //
12
microsecondsToDegrees = map(ftl(shl_servopulse),544,2400,0,180);
servo2.write(microsecondsToDegrees,servoSpeed);
microsecondsToDegrees = map(ftl(elb_servopulse),544,2400,0,180);
servo3.write(microsecondsToDegrees,servoSpeed);
microsecondsToDegrees = map(ftl(wri_servopulse),544,2400,0,180);
servo4.write(microsecondsToDegrees,servoSpeed);
void servo_park()
servo1.write(90,10);
servo2.write(90,10);
servo3.write(90,10);
servo4.write(90,10);
servo5.write(90,10);
servo6.write(80,10);
return;
13
void zero_x()
delay( 10 );
delay( 10 );
void line()
delay( 10 );
delay( 10 );
void circle()
14
#define RADIUS 50.0
//float angle = 0;
float zaxis,yaxis;
delay( 10 );
A problem that might occur is that the Arduino does not solve the code fast enough before the
next input comes. Thus, there might be a delay in the manipulator results compared to the input
speed of the sketch.
Even though this is a very limited application and seemingly impractical, it still is useful in the
engineering world as it brings forth avenue for further development. The code might be altered to
draw an engineering drawing that is input through a vector file. It might be programmed to write
signatures on documents. Therefore, it is not important of how useful an application is, as long as
it provides developments in the engineering world, it is enough to pursue it. A simple example of
this can be seen in mathematics in Fermat’s Last theorem which on itself, does not hold much
value, but the Mathematical advancements that occurred due to it do [5].
15
References
[1] petercorke ROBOTICS TOOLBOX. Available at:
https://petercorke.com/toolboxes/robotics-toolbox/ (Accessed 2 Jan 2020)
[3] Deshpande, V, George, P (2014) ‘KINEMATIC MODELLING AND ANALYSIS OF 5 DOF ROBOTIC ARM’
International Journal of Robotics, Vol. 4, Issue 2, 17-24
[4] instructable circuits Using Arduino Uno for XYZ Positioning of 5 DOF Robotic arm
16