9robot Dynamics Merged
9robot Dynamics Merged
ROBOT DYNAMICS
Lynch Ch. 8 & Spong Ch. 6
1
12/20/2023
Euler-Lagrange Equations
2
12/20/2023
Inertia Tensor
Inertia Tensor
𝐼𝑥𝑥 , 𝐼𝑦𝑦 , 𝐼𝑧𝑧 are principal moments of inertia about body fixed
𝑥, 𝑦, 𝑧 axes, constant for a rigid body
Off diagonal terms, 𝐼𝑥𝑦 , 𝐼𝑦𝑧 , 𝐼𝑥𝑧 cross products of inertia and
can be made zero, if the body axes are selected by the
symmetric axes
There exists a diagonal inertia tensor about the axes of
symmetry
3
12/20/2023
Example
Given the rotaton matrix 𝑅 between the inertial and body frames, the
similarity transformation yields
I = 𝑅𝐼𝑅𝑇
Then,
1 1
K= 𝑚𝑣 𝑇 𝑣 + 𝜔𝑇 𝑅𝐼𝑅𝑇 𝜔
2 2
Velocities may be expressed in joint space by the Jacobians as
𝑣𝑖 = 𝐽𝑣𝑖 𝑞 𝑞ሶ 𝜔𝑖 = 𝐽𝜔𝑖 𝑞 𝑞ሶ
Thus, the n-link rigid robot kinetic energy
𝑛
1 1
K = 𝑞ሶ 𝑇 𝑚𝑖 𝐽𝑣𝑖 𝑇 𝐽𝑣𝑖 + 𝐽𝜔𝑖 𝑇 𝑅𝑖 𝐼𝑖 𝑅𝑖𝑇 𝐽𝜔𝑖 𝑞ሶ
2 2
𝑖=1
Or
1 𝑇
K= 𝑞ሶ 𝐷(𝑞)𝑞ሶ
2
4
12/20/2023
Lagrangian
10
5
12/20/2023
Partial Derivatives
𝑛
1
L = 𝑑𝑖𝑗 𝑞 𝑞ሶ 𝑖 𝑞ሶ 𝑗 − 𝑃(𝑞)
2
𝑖,𝑗
𝑑 𝜕L 𝜕L
− = 𝜏𝑘
𝑑𝑡 𝜕𝑞ሶ 𝑘 𝜕𝑞𝑘
𝑛
𝜕L 1
= 𝑑𝑗𝑘 𝑞 + 𝑑𝑘𝑗 𝑞 𝑞ሶ 𝑗
𝜕 𝑞ሶ 𝑘 2
𝑗
Thus
𝑑 𝜕L 𝑑 𝜕𝐾
= = 𝑑𝑘𝑗 𝑞ሷ 𝑗
𝑑𝑡 𝜕𝑞ሶ 𝑘 𝑑𝑡 𝜕𝑞ሶ 𝑘
𝑗
11
𝑛
1
L = 𝑑𝑖𝑗 𝑞 𝑞ሶ 𝑖 𝑞ሶ 𝑗 − 𝑃(𝑞)
2
𝑖,𝑗
𝑛
𝜕L 1 𝜕𝑑𝑘𝑗 𝜕𝑑𝑘𝑖 𝜕𝑑𝑖𝑗 𝜕𝑃
= + − 𝑞ሶ 𝑞ሶ −
𝜕𝑞𝑘 2 𝜕𝑞𝑖 𝜕𝑞𝑗 𝜕𝑞𝑘 𝑖 𝑗 𝜕𝑞𝑘
𝑖,𝑗
Christoffel symbols of the first kind
𝜕𝑃
𝜙𝑘 =
𝜕𝑞𝑘
12
6
12/20/2023
𝑛 𝑛
𝑑𝑘𝑗 𝑞ሷ 𝑗 + 𝑐𝑖𝑗𝑘 𝑞ሶ 𝑖 𝑞ሶ 𝑗 + 𝜙𝑘 = 𝜏𝑘 , 𝑘 = 1, … , 𝑛
𝑗=1 𝑖,𝑗
𝐷 𝑞 𝑞ሷ + 𝐶 𝑞, 𝑞ሶ 𝑞ሶ + 𝐺 𝑞 = 𝜏
𝑐𝑘𝑗 = 𝑐𝑖𝑗𝑘 𝑞ሶ 𝑖
𝑖=1
13
Example
Velocity kinematics
𝑣𝑐1 = 𝐽𝑣𝑐1 𝑞ሶ
𝑣𝑐2 = 𝐽𝑣𝑐2 𝑞ሶ
No angular velocities and prismatic joints Jacobians
0 0 0 0
𝐽𝑣𝑐1 = 𝑧0 0 = 0 0 𝐽𝑣𝑐2 = 𝑧0 𝑧1 = 0 1
1 0 1 0
14
7
12/20/2023
𝑛
1
K = 𝑞ሶ 𝑇 𝑚𝑖 𝐽𝑣𝑖 𝑇 𝐽𝑣𝑖 𝑞ሶ
2
𝑖=1
1 0 1 0
𝐽𝑣𝑇𝑐1 𝐽𝑣𝑐1 = 𝐽𝑣𝑇𝑐2 𝐽𝑣𝑐2 =
0 0 0 1
1 𝑇 1 0 1 0
K= 𝑞ሶ 𝑚1 + 𝑚2 𝑞ሶ
2 0 0 0 1
Then
1 𝑇 𝑚1 + 𝑚2 0
K= 𝑞ሶ 𝑞ሶ
2 0 𝑚2
𝐷(𝑞)
15
𝑃 = 𝑃1 + 𝑃2 = 𝑔𝑚1 𝑞1 + 𝑔𝑚2 𝑞1 + 𝑐
𝜕𝑃 𝜕𝑃
𝜙1 = = 𝑔 𝑚1 + 𝑚2 , 𝜙2 = =0
𝜕𝑞1 𝜕𝑞2
Therefore, the matrices
𝑚1 + 𝑚2 0 0 0 𝑔 𝑚1 + 𝑚2
𝐷= ,𝐶 = 𝐺=
0 𝑚2 0 0 0
The EoM
𝐷 𝑞 𝑞ሷ + 𝐶 𝑞, 𝑞ሶ 𝑞ሶ + 𝐺(𝑞) = 𝜏
𝑚1 + 𝑚2 0 𝑞ሷ 1 𝑔 𝑚1 + 𝑚2 𝑓1
+ =
0 𝑚2 𝑞ሷ 2 0 𝑓2
16
8
12/20/2023
17
Example 2: Jacobian at 𝑐1
0 −1 0 𝑙𝑐1 𝑐1
𝑧0 × 𝑜𝑐1 − 𝑜0 = 1 0 0 𝑙𝑐1 𝑠1
0 0 0 0
−𝑙𝑐1 𝑠1 0
𝐽𝑣𝑐1 = 𝑙𝑐1 𝑐1 0
0 0
18
9
12/20/2023
Example 2: Jacobian at 𝑐2
19
1 0 2 1 1
𝐷 = 𝑚1 𝐽𝑣𝑇𝑐1 𝐽𝑣𝑐1 + 𝑚2 𝐽𝑣𝑇2 𝐽𝑣2 + 𝐼𝑧𝑧
1
+ 𝐼𝑧𝑧
0 0 1 1
20
10
12/20/2023
1 𝜕𝑑11
𝑐111 = =0
2 𝜕𝑞1
21
22
11
12/20/2023
Potential energies
𝑃1 = 𝑚1 𝑔 𝑙𝑐1 sin 𝑞1
𝑃2 = 𝑚2 𝑔[ 𝑙𝑐1 sin 𝑞1 + 𝑙𝑐2 sin(𝑞1 + 𝑞2 )]
𝑃 = 𝑃1 + 𝑃2
𝜕𝑃
𝜙1 = 𝜕𝑞 = 𝑔 𝑚1 𝑙𝑐1 + 𝑚2 𝑙1 cos 𝑞1 + 𝑚2 𝑔𝑙𝑐2 cos(𝑞1 + 𝑞2 )
1
𝜕𝑃
𝜙2 = 𝜕𝑞 = 𝑚2 𝑔𝑙𝑐2 cos(𝑞1 + 𝑞2 )
2
23
EoM
24
12
12/20/2023
25
Passivity Property
𝑇
න 𝑞ሶ 𝑎 𝑇 𝜏(𝑎)𝑑𝑎 ≥ −𝑏 ∀𝑇 > 0
0
The term
𝑞ሶ 𝑡 𝑇 𝜏(𝑡)
from input 𝜏 to output 𝑞ሶ is in power form.
The energy is lower bounded for any 𝑇 > 0
Can’t generate energy on its own
26
13
12/20/2023
Linear-in-the-parameters Property
𝐷 𝑞 𝑞ሷ + 𝐶 𝑞, 𝑞ሶ 𝑞ሶ + 𝐺 𝑞 = 𝜏
May be expressed in linear parameters as
𝑌 𝑞, 𝑞,ሶ 𝑞ሷ Θ = 𝜏
where
𝑌 𝑞, 𝑞,ሶ 𝑞ሷ Regressor
Θ parameter vector
27
Example
𝑑11 𝑑12
𝐷 𝑞 =
𝑑12 𝑑22
ℎ𝑞ሶ 2 ℎ(𝑞1ሶ + 𝑞ሶ 2 )
𝐶 𝑞, 𝑞ሶ = ℎ = −𝑚2 𝑙1 𝑙𝑐2 sin 𝑞2
−ℎ𝑞ሶ 1 0
28
14
12/20/2023
29
Forward dynamics
𝑞
𝜏 Robot FD 𝑞ሶ
𝑞ሷ
𝑞ሷ = 𝐷 −1 𝑞 𝜏 − 𝐶 𝑞, 𝑞ሶ 𝑞ሶ + 𝐺 𝑞
Inverse dynamics
𝑞
𝑞ሶ Robot ID 𝜏
𝑞ሷ
𝜏 = 𝐷 𝑞 𝑞ሷ + 𝐶 𝑞, 𝑞ሶ 𝑞ሶ + 𝐺 𝑞
30
15
12/20/2023
Newtonian mechanics
31
Newton-Euler Formulation
𝑚𝑣ሶ = 𝑓
In inertial frame
32
16
12/20/2023
Newton-Euler Formulation
33
𝐼 𝜔ሶ + 𝜔 × 𝐼𝜔 = 𝜏
In body fixed frame
34
17
12/20/2023
35
𝑖 𝑖
𝜏𝑖 − 𝑅𝑖+1 𝜏𝑖+1 + 𝑓𝑖 × 𝑟𝑖,𝑐𝑖 − 𝑅𝑖+1 𝑓𝑖+1 × 𝑟𝑖+1,𝑐𝑖 = 𝐼𝑖 𝛼𝑖 + 𝜔𝑖 × (𝐼𝑖 𝜔𝑖 )
36
18
12/20/2023
𝑖
𝜔𝑖 = 𝑅𝑖−1 𝜔𝑖−1 + 𝑏𝑖 𝑞ሶ 𝑖
37
Angular acceleration
𝛼𝑖 = 𝑅0𝑖 𝜔ሶ 𝑖0
𝑑
Now 𝑑𝑡 (𝜔𝑖0 = 𝜔𝑖−1
0
+ 𝑧𝑖−1 𝑞ሶ 𝑖 ) yields
𝜔ሶ 𝑖0 = 𝜔ሶ 𝑖−1
0
+ 𝑧𝑖−1 𝑞ሷ 𝑖 + 𝑧𝑖−1
ሶ 𝑞ሶ 𝑖
𝜔ሶ 𝑖0 = 𝜔ሶ 𝑖−1
0
+ 𝑧𝑖−1 𝑞ሷ 𝑖 + 𝜔𝑖0 × 𝑧𝑖−1 𝑞ሶ 𝑖
38
19
12/20/2023
𝑖
𝛼𝑖 = 𝑅𝑖−1 𝛼𝑖−1 + 𝑏𝑖 𝑞ሷ 𝑖 + 𝜔𝑖 × 𝑏𝑖 𝑞ሶ 𝑖
39
Constrained Dynamics
Linear velocity
0 0
𝑣𝑐,𝑖 = 𝑣𝑒,𝑖−1 + 𝜔𝑖0 × 𝑟𝑖,𝑐
0
𝑖
𝑖
𝑎𝑐,𝑖 = 𝑅𝑖−1 𝑎𝑒,𝑖−1 + 𝜔ሶ 𝑖 × 𝑟𝑖,𝑐𝑖 + 𝜔𝑖 × (𝜔𝑖 × 𝑟𝑖,𝑐𝑖 )
40
20
12/20/2023
𝑖
𝑎𝑒,𝑖 = 𝑅𝑖−1 𝑎𝑒,𝑖−1 + 𝜔ሶ 𝑖 × 𝑟𝑖,𝑖+1 + 𝜔𝑖 × (𝜔𝑖 × 𝑟𝑖,𝑖+1 )
41
42
21
12/20/2023
43
44
22
12/20/2023
45
46
23
12/20/2023
47
24
7.11.2023
FORWARD KINEMATICS
Ch. 3
Kinematic Chains
1
7.11.2023
2
7.11.2023
DH Coordinate Assignment
𝑜𝑖′
DH params [Spong’s]
For link 𝑖
Parent 𝑜𝑖−1
Child Parent 𝑜𝑖
Joint angle about 𝑧𝑖−1 between axes 𝑥𝑖−1 and 𝑥𝑖
𝜽∗𝒊 = 𝑥ෟ
𝑖−1 𝑥𝑖 ቚ
𝑧𝑖
Link offset on 𝑧𝑖−1 between 𝑜𝑖−1 and 𝑜𝑖′ (the projection of 𝑜𝑖 on axis 𝑧𝑖−1 )
𝒅∗𝒊 = 𝑜𝑖−1 𝑜𝑖′
Link length on 𝑥𝑖 between 𝑜𝑖′ and 𝑜𝑖
𝒂𝒊 = 𝑜𝑖′ 𝑜𝑖
′
Twist angle about 𝑥𝑖 between 𝑧𝑖−1 and 𝑧𝑖
𝜶𝒊 = 𝑧
′
𝑖−1 𝑧𝑖 ቚ
𝑥𝑖
3
7.11.2023
Link 1 DH Parameters
𝑜𝑜′
Consecutive xforms of
DH Coordinate Assignment
Rule 1: 𝑧𝑖−1 axis is the 𝑖 𝑡ℎ joint axis of actuation, on the parent frame
Rule 2: 𝑥𝑖 axis is either
The shortest line segment between 𝑧𝑖−1 and 𝑧𝑖 , when exists
If 𝑧𝑖−1 and 𝑧𝑖 are parallel, 𝑥𝑖 can be anywhere, pick the most
convenient on 𝑖 𝑡ℎ joint,
If 𝑧𝑖−1 and 𝑧𝑖 orthogonal, 𝑥𝑖 is selected as the normal to the plane
𝑥𝑜 (hence 𝑜0 ) is free but for the convenience picked parallel to 𝑥1
If 𝑧𝑛 of the end effector is free to pick, we select it parallel to 𝑧𝑛−1
4
7.11.2023
RR Planar Robot
𝜃2
𝜃1
5
7.11.2023
𝑧2
𝜃2
𝜃1
𝑧1
𝑧0
𝜃2
𝑥1
𝑜1
𝜃1
𝑥0
𝑧1
𝑧0
So are 𝑥0 , when 𝜃1 = 0 and
the end effector 𝑥2 when 𝜃2 = 0
6
7.11.2023
For link 1
𝜃1 is 𝑥ෟ
0 𝑥1 ȁ𝑧0 that is shown as 𝜃1
𝑑1 = 𝑜0 𝑜0′ 𝑧𝑜 =0
𝑎1 = 𝑜𝑜′ 𝑜1 𝑥1 = 𝑙1
𝑧2
𝛼1 = 𝑧
′′
𝑜 𝑧1 ȁ𝑥1 = 0
𝜃2
𝑥1
𝑜1
𝜃1
𝑥0
𝑧1
𝑧0
For link 2
𝜃2 is 𝑥ෟ
1 𝑥2 ȁ𝑧1 that is shown as 𝜃2
𝑑2 = 𝑜1 𝑜1′ 𝑧1 =0
𝑜2
𝑎2 = 𝑜1′ 𝑜2 𝑥2 = 𝑙2
𝑧2
𝛼2 = 𝑧
′′
1 𝑧2 ȁ𝑥2 = 0
𝜃2
𝑥1
𝑜1
𝜃1
𝑥0
𝑧1
𝑧0
7
7.11.2023
𝑑𝑥 = 𝑙2 𝑐1 𝑐2 − 𝑙2 𝑠1 𝑠2 + 𝑙1 𝑐1 = 𝑙1 𝑐1 + 𝑙2 𝑐12 𝑑𝑦 = 𝑙2 𝑠1 𝑐2 + 𝑙2 𝑐1 𝑠2 + 𝑙1 𝑠1 = 𝑙1 𝑠1 + 𝑙2 𝑠12
3D Cylindrical Arm
𝑧1
𝑧𝑜
8
7.11.2023
𝑥2 𝑥3
𝑧1
𝑑2
𝑥1
𝜃1
𝑥0 𝑧𝑜
For link 1 𝑑3
𝑧2 𝑧3
𝜃1 is 𝑥ෟ
0 𝑥1 ȁ𝑧0 that is shown as 𝜃1
𝑥2 𝑥3
𝑑1 = 𝑜0 𝑜0′ 𝑧𝑜 = 𝑑1
𝑎1 = 𝑜𝑜′ 𝑜1 𝑥1 =0 𝑧1
𝛼1 = 𝑧
′′
𝑜 𝑧1 ȁ𝑥1 = 0
𝑑2
𝑥1
𝑧𝑜
𝜃1
𝑑1
𝑥0
9
7.11.2023
For link 2 𝑑3
𝑧2 𝑧3
𝜃2 is 𝑥ෟ
1 𝑥2 ȁ𝑧1 selected as 0
𝑑2 = 𝑜1 𝑜1′ 𝑧1 = 𝑑2∗ 𝑥2 𝑥3
𝑎2 = 𝑜1′ 𝑜2 𝑥2 =0 𝑧1
𝛼2 = 𝑧
′′
1 𝑧2 ȁ𝑥2 = −90
𝑑2
𝑥1
𝑧𝑜
𝜃1
𝑑1
𝑥0
For link 3 𝑑3
𝑧2 𝑧3
𝜃3 is 𝑥ෟ
2 𝑥3 ȁ𝑧2 selected as 0
𝑥2 𝑥3
𝑑3 = 𝑜2 𝑜2′ 𝑧2 = 𝑑3∗
𝑎3 = 𝑜2′ 𝑜3 𝑥3 =0 𝑧1
𝛼3 = 𝑧
′′
2 𝑧3 ȁ𝑥3 = 0
𝑑2
𝑥1
𝑧𝑜
𝜃1
𝑑1
𝑥0
10
7.11.2023
Spherical Wrist
𝑑6
Assume first three joints end point has a spherical RRR wrist
attached
Each joint is perpendicular to the next, and 𝑜4 = 𝑜5 = 𝑜6
DH Parameters
11
7.11.2023
Link Transforms
12
7.11.2023
13
7.11.2023
Show
14
10/13/2023
COORDINATE TRANSFORMATIONS
Robot Modeling and Control by Spong et al.
Conventions
1
10/13/2023
2
10/13/2023
To express 𝑅10
𝑅10 = 𝑖10 𝑗10
Or,
cos 𝜃 − sin 𝜃
𝑅10 =
sin 𝜃 cos 𝜃
Example
3
2.4 Let 𝜃 = 30𝑜 and 𝑝1 = ⇒ 𝑝𝑜 ?
1
cos 30 − sin 30 3
𝑝𝑜 =
𝜃 = 30𝑜
sin 30 cos 30 1
1 3 −1 3 = 2.1
2.1
𝑝𝑜 =
2 1 3 1 2.4
3
10/13/2023
𝑖1 ∙ 𝑖𝑜 = cos 𝜃
𝑖𝑜 𝑖1 ∙ 𝑗𝑜 = cos(90 − 𝜃)
𝑖𝑜 𝑗1 ∙ 𝑖𝑜 = cos(90 + 𝜃)
𝑖𝑜 𝑗1 ∙ 𝑗𝑜 = cos 𝜃
cos 𝜃 − sin 𝜃
𝑅1𝑜 =
sin 𝜃 cos 𝜃
4
10/13/2023
Rotations in 3D
• 𝑅𝑧,0 = 𝐼
• 𝑅𝑧,𝜃 𝑅𝑧,𝜙 =𝑅𝑧,𝜃+𝜙
−1 𝑇
• 𝑅𝑧,𝜃 = 𝑅𝑧,−𝜃 = 𝑅𝑧,𝜃
Example
cos 45 = 1/ 2
𝑖1 ∙ 𝑗𝑜 =
cos 90 = 0
𝑖1 ∙ 𝑘𝑜 =
cos 45 = 1/ 2
𝑗1 ∙ 𝑖𝑜 =
cos 45 = 1/ 2
𝑗1 ∙ 𝑗𝑜 =
cos 90 = 0
𝑗1 ∙ 𝑘𝑜 =
cos 135 = −1/ 2
𝑘1 ∙ 𝑖𝑜 =
1 1
cos 90 = 0 0
𝑘1 ∙ 𝑗𝑜 = 2 2
cos 0 = 1 𝑅01 = 1 1
0 −
𝑘1 ∙ 𝑘𝑜 = 2 2
cos 90 = 0 0 1 0
10
5
10/13/2023
𝑐𝜃 0 𝑠𝜃 1 0 𝜃
𝑅𝑦,𝜃 = 0 1 0 0 1 0
−𝑠𝜃 0 𝑐𝜃 −𝜃 0 1
1 −𝜓 0
𝑐𝜓 −𝑠𝜓 0 𝜓 1 0
𝑅𝑧,𝜓 = 𝑠𝜓 𝑐𝜓 0 0 0 1
0 0 1
11
Similarity Transformation
−𝟏
𝑩 = 𝑹𝟎𝟏 𝑨𝑹𝟎𝟏
12
6
10/13/2023
Similarity Transformation
𝐵 = 𝑅1𝑜 −1
𝐴𝑅1𝑜
𝑇
0 0 1 𝑐𝜃 0 𝑠𝜃 0 0 1
𝐵 = 0 −1 0 0 1 0 0 −1 0
1 0 0 −𝑠𝜃 0 𝑐𝜃 1 0 0
0 0 1 𝑠𝜃 0 𝑐𝜃 𝑐𝜃 0 −𝑠𝜃
𝐵 = 0 −1 0 0 −1 0 = 0 1 0 = 𝑅𝑦,−𝜃
1 0 0 𝑐𝜃 0 −𝑠𝜃 𝑠𝜃 0 𝑐𝜃
13
Consecutive Rotations
14
7
10/13/2023
Fixed-Frame Rotations
15
16
8
10/13/2023
So
𝑅20 = 𝐴 Σ0 𝑅10
𝑛𝑑 𝑠𝑡
𝑅20 = 𝑅2 Σ0 ⋅ 𝑅1 (Σ0 )
17
18
9
10/13/2023
Orientation Parameterization
19
20
10
10/13/2023
Note that for ZYX Euler angles for small angles Directional Cosine Matrix
𝑐𝜙 𝑐𝜃 −𝑠𝜙 𝑐𝜓 + 𝑐𝜙 𝑠𝜃 𝑠𝜓 𝑠𝜙 𝑠𝜓 + 𝑐𝜙 𝑠𝜃 𝑐𝜓 1 −𝜙 𝜃
𝑠𝜙 𝑐𝜃 𝑐𝜙 𝑐𝜓 + 𝑠𝜙 𝑠𝜃 𝑠𝜓 −𝑐𝜙 𝑠𝜓 + 𝑠𝜙 𝑠𝜃 𝑐𝜓 = 𝜙 1 −𝜓
−𝑠𝜃 𝑐𝜃 𝑠𝜓 𝑐𝜃 𝑐𝜓 −𝜃 𝜓 1
21
Skew-Matrix Operator ∙
Remarks:
1) Vector multiplication of 𝑣1 , 𝑣2 ∈ ℝ3
𝑣1 × 𝑣2 = 𝑉1 𝑣2
Becomes a matrix multiplication with
𝑉1 = 𝑣1
2) 𝑣1 × 𝑣2 = −𝑣2 × 𝑣1
22
11
10/13/2023
Define
𝜓
𝚽= 𝜃
𝜙
1 −𝜙 𝜃
𝜙 1 −𝜓 = 𝐼 + 𝚽
−𝜃 𝜓 1
23
24
12
10/13/2023
𝑟32 − 𝑟23
1
𝑘= 𝑟13 − 𝑟31
2 sin 𝜃
𝑟21 − 𝑟12
25
Rodriguez Formula
26
13
10/13/2023
Example
1
The same rotation is obtained by 1 3
𝑟32 − 𝑟23
A single rotation about a unit vector 𝑘 1
𝑟13 − 𝑟31 =
1 −
𝑘= 2 2
2 sin 𝜃 𝑟 − 𝑟 3
21 12 1 3
+
2 2
27
Example
28
14
10/13/2023
Example in Python
29
Quaternions
30
15
10/13/2023
Quaternions
31
Quaternion Multiplication
𝑞𝑞 ′ = 𝑠, 𝑣 𝑠 ′ , 𝑣 ′
𝑠𝑠′ − 𝑣 ⋅ 𝑣 ′ , 𝑠𝑣 ′ + 𝑠 ′ 𝑣 + 𝑣 × 𝑣 ′
32
16
10/13/2023
Quaternions as Rotations
33
Quaternion to R Matrix
𝑝𝑜 = 𝑅1𝑜 𝑝1 = 𝑞𝑝1 𝑞 −1
34
17
10/13/2023
R matrix to Quaternion
1
𝑞1 = 2𝑟11 + 1 − 𝑇𝑟
2
35
Similarly using, 𝑟22 and 𝑟33 we get the rest of the terms
1
𝑞2 = 2𝑟22 + 1 − 𝑇𝑟
2
1
𝑞3 = 2𝑟33 + 1 − 𝑇𝑟
2
36
18
10/13/2023
class scipy.spatial.transform.Rotation
provides an interface to initialize from and represent rotations
with:
Quaternions
Rotation Matrices
Rotation Vectors
Modified Rodrigues Parameters
Euler Angles
37
import numpy as np
from scipy.spatial.transform import Rotation as R
r = R.from_quat([0, 0, np.sin(np.pi/4), np.cos(np.pi/4)])
r.as_matrix()
r.as_euler('zyx', degrees=True)
38
19
10/13/2023
39
40
20
10/13/2023
2 = 𝑧 𝑇 𝑧 − 𝑧 𝑇 𝐻𝑥ො − 𝑥ො 𝑇 𝐻 𝑇 𝑧 + 𝑥ො 𝑇 𝐻 𝑇 𝐻𝑥ො
We have 𝑧 − 𝐻 𝑥ො
41
[𝑅10 𝑡𝑜 ]
42
21
10/13/2023
43
Inverse Motion
For
𝑅1𝑜 𝑡𝑜
𝑇1𝑜 =
0′ 1
Inverse is
𝑅1𝑜 𝑇
− 𝑅1𝑜 𝑇 𝑡 𝑜
𝑇1𝑜 −1
= 𝑇01 =
0′ 1
Proof
Simply show 𝑇1𝑜 −1 0
𝑇1 = 𝐼4×4
𝑅1𝑜 𝑇
− 𝑅1𝑜 𝑇 𝑡 𝑜 𝑅1𝑜 𝑡𝑜 𝐼3×3 0
= = 𝐼4×4
0′ 1 0′ 1 0′ 1
44
22
10/13/2023
Example
45
𝑇𝑐𝑒 =?
𝑇𝑎𝑏 𝑇𝑏𝑐 𝑇𝑐𝑒 = 𝑇𝑎𝑑 𝑇𝑑𝑒
Base not measurable w.r.t. {a} but 𝑇𝑎𝑏 = 𝑇𝑎𝑑 𝑇𝑑𝑏
𝑇𝑎𝑑 𝑇𝑑𝑏 𝑇𝑏𝑐 𝑇𝑐𝑒 = 𝑇𝑎𝑑 𝑇𝑑𝑒
−1
𝑇𝑐𝑒 = 𝑇𝑎𝑑 𝑇𝑑𝑏 𝑇𝑏𝑐 𝑇𝑎𝑑 𝑇𝑑𝑒
46
23
10/13/2023
47
48
24
10/13/2023
Angular Velocity
49
Substitute Ω𝑚
𝑚𝑘 in (a)
50
25
10/13/2023
Using (b)
Arranging it
(c)
Coriolis equation
51
52
26
10/13/2023
where
𝑖
𝑟ሷ 𝑖 = 𝑣ሶ 𝑖 + 𝜔𝑖𝑏 × 𝑣𝑖
53
Using (b)
Arranging it
(c)
Coriolis equation
54
27
10/13/2023
55
where
𝑣ሶ 𝑏 = Ω𝑏𝑖𝑏 𝑟ሶ 𝑏 + Ωሶ 𝑏𝑖𝑏 𝑟 𝑏
𝑟ሷ 𝑖 = 𝑅𝑏𝑖 𝑟ሷ b + Ω𝑏𝑖𝑏 𝑟ሶ 𝑏 + Ωሶ 𝑏𝑖𝑏 𝑟 𝑏 + (𝑅𝑏𝑖 Ω𝑏𝑖𝑏 𝑅𝑖𝑏 )rሶ 𝑖
𝑟ሷ 𝑖 = 𝑅𝑏𝑖 𝑟ሷ b + Ω𝑏𝑖𝑏 𝑟ሶ 𝑏 + Ωሶ 𝑏𝑖𝑏 𝑟 𝑏 + Ω𝑖𝑖𝑏 𝑣 𝑖
𝑟ሷ 𝑖 = 𝑅𝑏𝑖 𝑣ሶ 𝑏 + Ω𝑖𝑖𝑏 𝑣 𝑖
𝑖
𝑟ሷ 𝑖 = 𝑣ሶ 𝑖 + 𝜔𝑖𝑏 × 𝑣𝑖
56
28
INTELLIGENT CONTROL OF
ROBOT MANIPULATORS
MKT 4846 Dr. Aydin Yesildirek
Intelligence
Requires to have
1. Objectives and goals– to stay alive or achieve a task
2. Sensing mechanism
3. Metric to measure the level of success
4. Autonomous actions
1
Form of Intelligence
Multidimensional
Social intelligence
Fine arts intelligence
Etc.
Individual intelligence
Cooperative intelligence
Swarm intelligence
Network intelligence
Structural intelligence
Evolution
Genetics
Human Intelligence
2
Nervous System
3
Learning Process
System ID
4
Learning Process – Min Search
𝑥∗ 𝑥𝑘+1 𝑥𝑘
Define a candidate signal (LFC) using an error space vector, 𝑒, including all
parametric and dynamic errors, such that
𝑉 𝑡, 𝑒 > 0, ∀𝑡 ≥ 0, ∀ 𝑒 ≠ 0
𝑉 𝑡, 𝑒 = 0, ∀𝑡 ≥ 0, 𝑒 = 0
e.g., energy functions in error space
Study the time derivative
ሶ 𝑒)
𝑉(𝑡,
If you can find an input signal and learning algorithms such that
𝑉ሶ < 0, ∀𝑡 ≥ 0, ∀ 𝑒 ≠ 0
The positive signal with negative derivative will always decrease till zero
lim 𝑉 𝑡, 𝑒 = 0 ⇒ lim 𝑒 𝑡 = 0
𝑡→∞ 𝑡→∞
5
Intelligent Structure
𝑦ො = 𝑥ො
𝑎𝑚 − 𝑎𝑚 𝑥 = 0 or 𝑎𝑚 − 𝑎𝑚 𝑥ො = 0
Linear-in-the-Paramater Representation
1
𝑢
𝑏 𝑠 + 𝑎𝑚
𝜃= 𝜙 𝑢, 𝑦 =
𝑎𝑚 − 𝑎 1
𝑦
𝑠 + 𝑎𝑚
Similarly the estimation model output
𝑦ො = 𝜃መ 𝑇 𝜙 𝑢, 𝑦
With the parameter estimates
1
𝑢
𝑏 𝑠 + 𝑎𝑚
𝜃መ = 𝜙 𝑢, 𝑦ො =
𝑎𝑚 − 𝑎ො 1
𝑦ො
𝑠 + 𝑎𝑚
6
Error Systems Dynamics
7
The learning rules 𝑎ොሶ = −𝛾𝑥𝜖1 and 𝑏ሶ = 𝛾𝑢𝜖1 are still in the
form of multiplication of
Excitation input signal to the parameter
An error signal of interest
𝑎ොሶ = 𝑓1 = −𝛾𝑥𝜖1
𝑏ሶ = 𝑓2 = 𝛾𝑢𝜖1
8
Parametric convergence possible with a good selection of
input
9
Remarks on Lypaunov Based Techniques
10
Multilayer Perceptron Structure
Inputs: xi’s
Outputs: yj’s
Neurons have the same
activation functions of
Squashing functions:
Sigmoidal
Radial Basis function
Hyper tangent fnc
Wavelets
Weights indicate interneuron
strength and modified during
learning
11
Non-squashing activations
Linear 𝜎 𝑥 = 𝑥
Rectified Linear Unit (ReLU) 𝜎 𝑥 = max{0, 𝑥}
−𝑥
Softplus 𝜎 𝑥 = ln(1 + 𝑒 )
Maxout Linear 𝜎 𝑥 = max 𝑎𝑖 𝑥 + 𝑏𝑖
𝑖∈{1,…,𝑘}
Feedforward NN
12
RNN Details
𝑁𝑙−1
𝑧𝑖𝑙 = 𝜎(𝛾𝑖𝑙 )
13
Biasing
Since common activation functions squashes the input to a finite band, e.g. −1, 1 , a
DC bias (constant) needed to extend the output range
To keep the neuron model the same we only augment the input by adding a one
Augmentation for bias in matrix form
𝑙−1
𝒛𝑙−1 = 𝝈(𝜸 )
𝟏
𝑁𝑙−1 +𝟏
𝑗=1
Input-Output Mapping
28
𝑙−1
𝑙
𝑙
𝑖1
𝑙
𝑖
𝑎2𝑙−1 𝑤𝑖2
𝑙=1 𝑙=2 𝑙=3 𝑎𝑖𝑙
𝑧𝑖𝑙
𝜎(𝑧𝑖𝑙 )
𝑙
𝑤𝑖𝑗
𝑙
𝑤𝑖𝑁𝑙−1
𝑙
𝑤𝑖0
𝑎𝑎𝑗𝑙−1
𝑙−1
𝑜
𝑙−1
𝑎𝑁 𝑙−1
1
𝑧32 𝜎(𝑧 2 ) 𝜎 𝑧11
3
𝜎(z1 ) = 𝜎 𝑧21
⋮
𝜎 𝑧𝑁1 1
2
𝑤31 𝜃32
2
𝑁1 𝑁1 𝑤31
2
𝑧32 = 𝑤3𝑖 2
𝜎(𝑧𝑖1 ) + 𝜃32 = 𝑤3𝑖 𝜎(𝑧𝑖1 ) = 𝐰32𝑇 𝜎(z1 ) 𝐰32 = 𝑤322
𝑖=1 𝑖=0 ⋮
2
𝑤3𝑁 1
14
Three Layer MLP
𝑦 = 𝑊 𝑇 𝜎(𝑉 𝑇 𝐱)
𝐲 = 𝑊 𝑇 𝛔(𝑉 𝑇 𝐱)
Let 𝑁1 be # of inputs, 𝑁2 # of hidden layer neurons, 𝑁3 # outputs, than the augmented vectors
𝑥1 𝜎1
𝑦1
⋮ ⋮
𝑥𝑖 𝜎𝑗 ⋮
𝐱= ⋮ , 𝛔= ⋮ , 𝑦
𝐲= 𝑘
⋮
𝑥𝑁1 𝜎𝑁2 𝑦𝑁3
1 1
𝑁1 +1
𝜎𝑗 = 𝜎 𝑣𝑗𝑖 𝑥𝑖 𝑗 = 1,2, … , 𝑁2
𝑖=1
𝑁2 +1
𝑦𝑘 = 𝑤𝑘𝑗 𝜎𝑗 𝑘 = 1,2, … , 𝑁3
𝑗=1
15
Universal Approximation Theorem
The approximation error depends on neuron number 𝑁2 that is not known in advanced
For practical implementations pick sufficiently large 𝑁2 if 𝜖 doesn’t satisfy 𝑁2 is increased.
For a given 𝑁2 , let the ideal MLP be
𝑦 ∗ = 𝑊 ∗ 𝑇 𝜎(𝑉 ∗ 𝑇 𝑥)
with acceptable MLP construction error
𝑦 − 𝑦 ∗ < 𝜖(𝑁2 )
𝑊
We now focus on learning the weight estimates 𝑉, minimizing the reconstruction error
𝑦 ∗ − 𝑦ො
16
Backpropagation Algorithm
1 1
𝐸𝑘 = 𝑒𝑘2 = 𝑓𝑘 − 𝑦𝑘 2
2 2
recursively in time (least squared error)
Gradient descent algorithm
𝜕𝐸𝑘
𝑊𝑘 = 𝑊𝑘−1 − 𝜂 ቤ
𝜕𝑊 𝑊=𝑊
𝑘−1
𝜂 learning rate
Will get stuck in local minima
Backpropagation Algorithm
The gradient descent algorithm applied to MLP may be written in generic form as
𝜕𝜎 e−𝛾 1 1
= = 1−
𝜕𝛾 1 + e−𝛾 2 1 + 𝑒 −𝛾 1 + 𝑒 −𝛾
𝜕𝜎
= 𝜎(1 − 𝜎)
𝜕𝛾
17
𝑁𝑙−1
𝑧𝑖𝑙 =𝜎 𝑙 𝑙−1
𝑤𝑖𝑗 𝑧𝑗
𝑗=0
𝜕𝑧𝑖𝑙
𝑙 = 𝑧𝑖𝑙 1 − 𝑧𝑖𝑙 𝑧𝑗𝑙−1
𝜕𝑤𝑖𝑗
Define error vectors of
𝛿 𝐿 = 𝑒𝑘
𝑁𝑙+1
𝜕𝐸𝑘
𝑙 = 𝛿𝑖𝑙 𝑧𝑗𝑙−1 𝑙 = 𝐿, 𝐿 − 1, … , 2
𝜕𝑤𝑖𝑗
18
Lyapunov Theorem
19
Rigid Robot Dynamics
Tracking Problem
20
Observe that the filtered tracking error
𝑟 = 𝑒ሶ + Λ𝑒
With
Where
21
NN Controller
22
NN Controller for Robot Manipulators
Stability Analysis
23
Autonomous Robots MKT 6110
24
Autonomous Robots MKT 6110
Summary
25
Autonomous Robots MKT 6110
Example
26
Adaptive controller with unmodelled dynamics
27
12/20/2022
ROBOT CONTROL
Feedback Control
Robot control
1
12/20/2022
2
12/20/2022
Motor model
𝜏𝑚 = 𝐾𝑚 𝑖𝑎
𝑉𝑏 = 𝐾𝑏 𝜔𝑚
3
12/20/2022
How about 𝜏𝑚 ?
𝜏𝑑 (𝑡)
𝑑 𝑒(𝑡) Compans 𝑢(𝑡) 𝜃(𝑡)
𝑟 𝑡 =𝜃
1 1
ator
𝐽𝑠 + 𝐵 𝑠
4
12/20/2022
Transient Control
Find negative feedback controller so that the output tracks the reference
with a given combinations of desired
%Overshoot (%OS)
Settling time (Ts)
Peak time (Tp)
Rise time (Tr)
These time domain requirements may be transformed to frequency domain
%𝑂𝑆 = 100 × 𝑒 −𝜁𝜋/ 1−𝜁 2
4
𝑇𝑠 ≈
𝜁𝜔𝑛
The desired closed loop system’s damping ratio and natural frequency may
be achieved by placing the dominant poles at
𝑝1,2 = −𝜁𝜔𝑛 ± 𝜔𝑛 1 − 𝜁 2 ≝ 𝜎𝑑 ± 𝑗𝜔𝑑
Example
10
5
12/20/2022
Example
>> J=1;B=2;
>> G=tf(1,[J B 0]);
>> step(G)
11
12
6
12/20/2022
𝐶 𝑠 = 𝑘𝑝 + 𝑘𝐷 𝑠
>> kp=31.24;kd=6;
>> C=tf([kp kd],1);
>> Tcl=G*C/(1+G*C);
>> step(Tcl)
13
Disturbance effect
𝜏𝑑 (𝑡)
𝑟 𝑡 =0 𝑒(𝑡) 𝑢(𝑡) 𝜃(𝑡)
𝑘𝑝 + 𝑘𝐷 𝑠 1 1
𝑠+2 𝑠
𝜃 𝑠 𝐺 1
= = 2
𝜏𝑑 (𝑠) 1 + 𝐶𝐺 𝑠 + 2 + 𝑘𝐷 𝑠 + 𝑘𝑃
14
7
12/20/2022
>>sisotool(G) or
>> controlSystemDesigner(G)
15
16
8
12/20/2022
17
Step response
Design requirements
18
9
12/20/2022
19
20
10
12/20/2022
21
PD Controller
Compensator
𝐶 𝑠 = 7 𝑠 + 3 = 21 + 7𝑠
Is the ideal PD controller with gains
𝑘𝑃 = 21, 𝑘𝐷 = 7
22
11
12/20/2022
23
𝑘𝐼
𝐶 = 𝑘 𝑝 + 𝑘𝐷 𝑠 +
𝑠
2
𝐶𝐺 𝑘𝐷 𝑠 + 𝑘𝑃 𝑠 + 𝑘𝐼
𝑇𝑐𝑙 = = 3
1 + 𝐶𝐺 𝐽𝑠 + 𝐵 + 𝑘𝐷 𝑠 2 + 𝑘𝑝 𝑠 + 𝑘𝐼
Using the previous PD controller base and adding a PI as
𝑠 + 0.01 0.03𝐾
𝐶 =𝐾 𝑠+3 = 3.01𝐾 + + 𝐾𝑠
𝑠 𝑠
The transient is preserved and static errors to be improved
24
12
12/20/2022
𝐾 𝑠 + 3 𝑠 + 0.01 0.03𝐾
𝐶 𝑠 = = 3.01𝐾 + + 𝐾𝑠
𝑠 𝑠
25
26
13
12/20/2022
27
With saturation
The suppressed tracking during the transition worsen when the step
reference is changed, reaction slows till excess control signal is trimmed
28
14
12/20/2022
https://www.engineeringclicks.com/harmonic-drive/
29
https://commons.wikimedia.org/wiki/File:Harmonic_drive_animation.gif
30
15
12/20/2022
𝜃𝑙 𝑘/𝐽𝑚 𝐽𝑙
=
𝑇𝑚 𝑠 4 + 𝐵1 + 𝐵2 𝑠 3 + 𝑘 1 + 1 + 𝐵1 𝐵2 𝑠 2 + 𝑘 𝐵 + 𝐵 𝑠
𝐽𝑚 𝐽𝑙 𝐽𝑚 𝐽𝑙 𝐽𝑚 𝐽𝑙 𝐽𝑚 𝐽𝑙 1 2
31
PD Control
𝐾𝑝
𝐶 𝑠 = 𝐾𝑑 𝑠 +
𝐾𝑑
Feedback may come either shafts 𝜃𝑚 or 𝜃𝑙
When 𝐵1 ~𝐵2 ~0
𝐽𝑚 𝐽𝑙 𝑠 4 + 𝑘 𝐽𝑚 + 𝐽𝑙 𝑠 2
We have open-loop system poles
1 1
0,0, ±𝑗 𝑘 +
𝐽𝑚 𝐽𝑙
For typical 𝑘 ≫ 𝐵𝑖
Two complex conjugate poles; Imaginary part large, real part small
One pole at the origin and
Remaining one is a real pole
32
16
12/20/2022
Compensator
𝐾𝑝
𝐶 𝑠 = 𝐾𝑑 𝑠 +
𝐾𝑑
Flexible joint
33
34
17
12/20/2022
35
36
18
12/20/2022
𝐷 𝑞 𝑞ሷ + 𝐶 𝑞, 𝑞ሶ 𝑞ሶ + 𝐺 𝑞 = 𝜏
𝜏 = 𝐷 𝑞 𝑎 + 𝐶 𝑞, 𝑞ሶ 𝑞ሶ + 𝐺 𝑞
𝐷 𝑞 𝑞ሷ = 𝐷(𝑞)𝑎
Or
𝑞ሷ = 𝑎
37
38
19
12/20/2022
System
𝐷 𝑞 𝑞ሷ + 𝐶 𝑞, 𝑞ሶ 𝑞ሶ + 𝐺 𝑞 = 𝜏
Controller
𝜏 = 𝐷 𝑞 [𝑞ሷ 𝑑 + 𝐾𝑑 𝑒ሶ + 𝐾𝑝 𝑒] + 𝐶 𝑞, 𝑞ሶ 𝑞ሶ + 𝐺 𝑞
For a transient response with maximum rise time without an
overshoot
𝜁 = 1, 𝜔𝑛
Desired poles
𝑠 2 + 2𝜁𝜔𝑛 𝑠 + 𝜔𝑛2 = 𝑠 2 + 2𝜔𝑛 𝑠 + 𝜔𝑛2 = 0
Implies
𝐾𝑝 = 𝜔𝑛2 , 𝐾𝑑 = 2𝜔𝑛
39
40
20
12/20/2022
Friction
In general
ሶ
For static analysis (b) 𝜏𝑓 = 𝐵𝑠 𝑠𝑖𝑔𝑛(𝜃)
For dynamic analysis (a) 𝜏𝑓 = 𝐵𝑑 𝜃ሶ
For detailed analysis Stribeck model (f) may be appropriate
41
ሶ =𝜏
𝐷 𝑞 𝑞ሷ + 𝐶 𝑞, 𝑞ሶ 𝑞ሶ + 𝐺 𝑞 + 𝐹(𝜃)
42
21
12/20/2022
Force Control
When the robot arm has contact with its environment the control problem
will shift from tracking motion trajectories to the force/torque control of the
end effector
Tasks like
Grinding
Deburring
Assembly
Window cleaning
43
Force Sensor
44
22
12/20/2022
45
23
19.11.2023
EXAMPLES
Ch. 2-3
1
19.11.2023
න 𝐴 𝑞 𝑞ሶ 𝑑𝑡 = 𝑔(𝑞)
Or
𝑑𝑞
න𝐴 𝑞 𝑑𝑡 = න 𝐴 𝑞 𝑑𝑞 = 𝑔(𝑞)
𝑑𝑡
Or
𝜕𝑔 𝑞
𝐴 𝑞 =
𝜕𝑞
2
19.11.2023
3
19.11.2023
Rotations in 3D
4
19.11.2023
A=np.array([[1,2,3],
[-1,0,1],
[0,1,-2]])
B=np.array([[3,0.707,-2.121],
[1,0.707,0.707],
[-2,0.707,-0.707]])
[email protected](A.T)
print(R)
[[ 0. 0. 1. ]
[-0.707 0.707 0. ]
[-0.707 -0.707 0. ]]
5
19.11.2023
import numpy as np
Tdb=np.array([[0,0,-1,250],[0,-1,0,-150],[-1,0,0,200],[0,0,0,1]])
Tde=np.array([[0,0,-1,300],[0,-1,0,100],[-1,0,0,120],[0,0,0,1]])
Tad=np.array([[0,0,-1,400],[0,-1,0,50],[-1,0,0,300],[0,0,0,1]])
a=1/np.sqrt(2)
Tbc=np.array([[0,-a,-a,30],[0,a,-a,-40],[1,0,0,25],[0,0,0,1]])
[[ 1 0 0 200]
Tab=Tad@Tdb [ 0 1 0 200]
print(Tab) [ 0 0 1 50]
[ 0 0 0 1]]
Tce=np.linalg.inv(Tab@Tbc)@Tad@Tde
printFmttd(Tce)
6
19.11.2023
Parameterization of Orientation
0 −1 0
𝑅 = 0 0 −1
1 0 0
R may also be parameterized by a single rotation of 𝜃 about
a vector 𝑘
𝑟11 +𝑟22 +𝑟33 −1 1
𝜃 = cos −1 2
= cos−1 − 2 = 120
𝑟32 − 𝑟23 1
1 1
𝑘= 𝑟13 − 𝑟31 = −1
2 sin 𝜃 3
𝑟21 − 𝑟12 1
Example in Python
7
17.11.2023
1
17.11.2023
VELOCITY KINEMATICS
Spong’d Text Ch. 4
2
17.11.2023
Some Properties
1. Linearity
𝑆 𝑐1 𝒙 + 𝑐2 𝒚 = 𝑐1 𝑆 𝒙 + 𝑐2 𝑆(𝒚)
2. Cross product
𝑆 𝒙 𝒚=𝒙×𝒚
3. If 𝑅 ∈ 𝑆𝑂(3)
𝑅 𝒙 × 𝒚 = 𝑅𝒙 × 𝑅𝒚
4. Similarity transformation
𝑅𝑆 𝒙 𝑅𝑇 = 𝑆(𝑅𝒙)
𝑆(𝜔 𝑠 ) = 𝑅𝑆 𝜔𝑏 𝑅𝑇 = 𝑆 𝑅𝜔𝑏 = 𝜔 𝑠
3
17.11.2023
Let 𝑅 𝜃 ∈ 𝑆𝑂 3 differantiation of
𝑇
𝑅 𝜃 𝑅𝜃 =𝐼
𝑑𝑅 𝑇
𝑑𝑅 𝑇
𝑅 𝜃 +𝑅 𝜃 =0 (∗)
𝑑𝜃 𝑑𝜃
Let
𝑑𝑅 𝑑𝑅
𝑆≝ 𝑅 𝜃 𝑇 = 𝑆𝑅(𝜃)
𝑑𝜃 𝑑𝜃
(*) becomes
𝑆 + 𝑆𝑇 = 0
Examples
1 0 0
𝑅 = 𝑅𝑥,𝜙 = 0 𝑐𝜙 −𝑠𝜙
0 𝑠𝜙 𝑐𝜙
Then
𝑑𝑅 0 0 0 1 0 0
𝑇
𝑆= 𝑅 𝜙 = 0 −𝑠𝜙 −𝑐𝜙 0 𝑐𝜙 𝑠𝜙
𝑑𝜙 0 𝑐𝜙 −𝑠𝜙 0 −𝑠𝜙 𝑐𝜙
0 0 0 1
𝑆 = 0 0 −1 = 𝑆 0 = 𝑆(𝒊)
0 1 0 0
𝑆(𝒊) that is the axis of rotation’s SSM multiplying 𝑅 in the derivative of 𝑅
𝑑𝑅𝑥,𝜙
= 𝑆 𝑖 𝑅𝑥,𝜙
𝑑𝜙
4
17.11.2023
𝑑𝑅𝑥,𝜙
= 𝑆 𝒊 𝑅𝑥,𝜙
𝑑𝜙
𝑑𝑅𝑦,𝜃
= 𝑆 𝒋 𝑅𝑦,𝜃
𝑑𝜃
𝑑𝑅𝑧,𝜓
= 𝑆 𝒌 𝑅𝑧,𝜓
𝑑𝜓
𝑑𝑅𝑛,𝜃
= 𝑆 𝒏 𝑅𝑛,𝜃
𝑑𝜃
Angular Velocity
𝑑𝑅
= 𝑆(𝑡)𝑅(𝑡)
𝑑𝑡
Recall, 𝑆(𝑡) was an SSM and was also defined as Ω = 𝜔 , implies that
there exists a vector say 𝜔(𝑡) such that
𝑆 𝑡 = 𝑆(𝜔 𝑡 )
5
17.11.2023
What is
0
𝜔1,2
Example
𝑑𝑅 𝑑𝜃
𝑅=
𝑑𝜃 𝑑𝑡
𝑑𝑅 𝑑𝜃
We had = 𝑆 𝒊 𝑅(𝑡) and scalar =𝜃
𝑑𝜃 𝑑𝑡
𝑅 = 𝑆 𝒊 𝑅 𝑡 𝜃 = 𝑆 𝜃𝒊 𝑅 𝑡 = 𝑆 𝜔𝑥 𝑅 𝑡
6
17.11.2023
7
17.11.2023
𝑅20 = 𝑆 𝜔0,1
0
+ 𝑆 𝑅10 𝜔1,2
1
𝑅20
𝑅20 = 𝑆 𝜔0,1
0
+ 𝑅10 𝜔1,2
1
𝑅20
Since,
𝑅20 = 𝑆 𝜔0,2
0
𝑅20
Assume that we have n moving frames and a reference {0} frame and
With
0 0
𝜔0,𝑛 = 𝜔0,1 + 𝑅10 𝜔1,2
1 0
+ ⋯ + 𝑅𝑛−1 𝑛−1
𝜔𝑛−1,𝑛 (2)
0 0 0 0 (3)
𝜔0,𝑛 = 𝜔0,1 + 𝜔1,2 + ⋯ + 𝜔𝑛−1,𝑛
8
17.11.2023
0
Assume 𝑜0,1 is constant
9
17.11.2023
Time derivative
𝑝0 = 𝑅10 𝑝1 + 𝑜0,1
0
n-Link Manipulator
When the robot moves, the end-effector position and orientation will
change in time with some velocities
We’ll try to find the relationship of those velocities with the joint space
velocities 𝑞(𝑡) using Jacobians
10
17.11.2023
Jacobians
𝑣 0 𝐽𝑣
= 𝑞
𝜔 𝑛 𝐽𝜔
As
𝐽𝑣
𝐽=
𝐽𝜔 6×𝑛
0
𝜔𝑖𝑖−1 = 𝑞𝑖 𝑧𝑖−1
𝑖−1
= 𝑞𝑖 0 = 𝑞𝑖 𝑘𝑖−1
1
If the link is prismatic then
𝜔𝑖𝑖−1 = 0
11
17.11.2023
𝑛
0 0
𝜔0,𝑛 = 𝜌𝑖 𝑞𝑖 𝑧𝑖−1 = 𝐽𝜔 𝒒
𝑖=1
𝐽𝐽𝜔 = [[𝜌
𝜔 = 𝜌11 𝑧𝑧00 ⋯ 𝜌
⋯ 𝜌𝑛 𝑧𝑧𝑛−1 ]
𝑛 𝑛−1 ]
𝑛
𝜕𝑜𝑛0
𝑜𝑛0 = 𝑞 = 𝐽𝑣 𝒒
𝜕𝑞𝑖 𝑖
𝑖=1
With
𝜕𝑜𝑛0 𝜕𝑜𝑛0
𝐽𝑣 = ⋯
𝜕𝑞1 𝜕𝑞𝑛
𝜕𝑜𝑛0
𝐽𝑣𝑖 =
𝜕𝑞𝑖
12
17.11.2023
𝑜0 𝑜𝑖−1,𝑖 𝑜𝑖 𝑜𝑖,𝑛
𝑜0,𝑖−1 𝑜𝑛
𝑜𝑖−1
Then, in {0}
0 0 𝑖−1
0
𝑜0,𝑛 = 𝑜0,𝑖−1 + 𝑅𝑖−1 𝑜𝑖−1,𝑖 + 𝑅𝑖0 𝑜𝑖,𝑛
𝑖
𝑖−1
𝑜𝑖−1,𝑖
13
17.11.2023
So
𝑎𝑖 𝑐𝜃𝑖
𝑖−1
𝑜𝑖−1,𝑖 = 𝑎𝑖 𝑐𝜃𝑖
𝑑𝑖
0 0
𝜕𝑜0,𝑛 𝑑𝑞𝑖 𝜕𝑜0,𝑛 𝜕
𝑣𝑖 = = 𝑑 = 𝑑𝑖 𝑜0 0
+ 𝑅𝑖−1 𝑖−1
𝑜𝑖−1,𝑖 + 𝑅𝑖0 𝑜𝑖,𝑛
𝑖
𝜕𝑞𝑖 𝑑𝑡 𝜕𝑑𝑖 𝑖 𝜕𝑑𝑖 0,𝑖−1
𝜕 𝜕
= 𝑑𝑖 𝑅0 𝑜 𝑖−1 = 𝑑𝑖 𝑅𝑖−1
0
𝑜 𝑖−1
𝜕𝑑𝑖 𝑖−1 𝑖−1,𝑖 𝜕𝑑𝑖 𝑖−1,𝑖
0
0
𝑣𝑖 = 𝑑𝑖 𝑅𝑖−1 0 = 𝑑𝑖 𝒛0𝑖−1
1
𝑑𝑖
In Jacobian form
14
17.11.2023
Here
𝑞𝑖 = 𝜃𝑖
Doesn’t effect frames {0}-{i-1} and only will move the frames {i}-{n}
𝑜𝑖−1,𝑛
{𝑛}
{𝑖 − 1}
𝑜0,𝑖−1 𝑧 , 𝜃
𝑖−1 𝑖
𝑜0,𝑛
{0}
Distance of the end effector to the origin of {𝑖 − 1}
0 0 0
𝑜𝑖−1,𝑛 = 𝑜0,𝑛 − 𝑜0,𝑖−1
The jacobian
𝜃𝑖
15
17.11.2023
𝐽𝑣 = 𝐽𝑣1 , … , 𝐽𝑣𝑛
3×𝑛
𝒛𝒛0𝑖−1
0 × (𝑜 0 0 − 𝑜 0 0 )
𝑖−1 × (𝑜 𝑜0,𝑖−1 ) revolute
0,𝑛 − 0,𝑖−1
0,𝑛 if joint 𝑖joint 𝑖
revolute
𝐽𝐽𝑣𝑣𝑖 =
=
𝑖 𝒛𝒛0𝑖−1
0 prismatic joint 𝑖
if prismatic
𝑖−1
𝐽𝜔 = 𝐽𝜔1 , … , 𝐽𝜔𝑛
3×𝑛
𝒛0𝑖−1
𝑖−1 if joint i revolute
revolute joint 𝑖
𝐽𝐽𝜔𝜔𝑖𝑖 =
0 prismatic joint 𝑖
if prismatic
𝐽 = 𝐽1 , … , 𝐽𝑛 6×𝑛
𝒛0𝑖−1 × 𝑜0,𝑛
0 0
− 𝑜0,𝑖−1
𝐽𝑖 =
𝒛0𝑖−1
6×1
Or prismatic joint i
0
𝐽𝑖 = 𝒛𝑖−1
0 6×1
16
17.11.2023
Example
For RR Robot find the linear and angular velocities of the end effector using
Jacobians
𝒛0𝑖−1 × 𝑜0,2
0 0
− 𝑜0,𝑖−1
𝐽𝑖 = 𝑖 = 1,2
𝒛0𝑖−1 6×1
With
𝒛00 = 𝒛10 = 0, 0, 1 𝑇
0 𝑇
𝑜0,0 = 0,0,0
0 𝑇
𝑜0,1 = 𝑥1 , 𝑦1 , 0
0 𝑇
𝑜0,2 = 𝑥2 , 𝑦2 , 0
with
𝑥1 = 𝑎1 𝑐𝜃1 , 𝑦1 = 𝑎1 𝑠𝜃1
𝑥2 = 𝑎1 𝑐𝜃1 + 𝑎2 𝑐 𝜃1 + 𝜃2
𝑦2 = 𝑎1 𝑠𝜃1 + 𝑎2 𝑠 𝜃1 + 𝜃2
17
17.11.2023
𝒛00 × 𝑜0,2
0 0
− 𝑜0,0 𝒛10 × 𝑜0,2
0 0
− 𝑜0,1
𝐽1 = 𝐽2 =
𝒛00 6×1
𝒛10 6×1
With
0 −1 0 𝑥2 − 𝑥1 −𝑎2 𝑠12
𝒛10 × 𝑜0,2
0 0
− 𝑜0,1 = 1 0 0 𝑦2 − 𝑦1 = 𝑎2 𝑐12
0 0 0 0 0
The jacobian
Example
18
17.11.2023
Analytical Jacobian
Let’s represent the orientation of the end effector with minimum variables,
e.g. three Euler angles.
𝑑 𝑞
𝑋=
𝛼 𝑞 6×1
𝑋 = 𝑑 = 𝐽𝑎 (𝑞)𝑞
𝛼
is called the analytical jacobian
𝑐𝜙 𝑠𝜙 0 𝑐𝜃 0 −𝑠𝜃 𝑐𝜓 𝑠𝜓 0
𝑅𝑇 = −𝑠𝜙 𝑐𝜙 0 0 1 0 −𝑠𝜓 𝑐𝜓 0
0 0 1 𝑠𝜃 0 𝑐𝜃 0 0 1
The angular velocities can be expressed by
𝑅=𝑆 𝜔 𝑅
As
Proof?
19
17.11.2023
𝜔 =.
𝐼 0
𝐽 𝑞 𝑞= 𝐽𝑎 (𝑞)𝑞
0 𝐵 𝛼
Inverse
𝐼 0
𝐽𝑎 𝑞 = −1 𝐽 𝑞
0 𝐵 𝛼
In this structure the invertibility of 𝐵(𝛼) defines the singularities of the
velocity kinematics
20
17.11.2023
Singularity
Singularities usually (but not always) correspond to points on the boundary of the
manipulator workspace, that is, to points of maximum reach of the manipulator.
Near singularities there will not exist a unique solution to the inverse kinematics
problem
Inverse Velocity
Then
𝐽𝐽𝑇 𝐽𝐽𝑇 −1 =𝐼
𝐽 𝐽𝑇 𝐽𝐽𝑇 −1 =𝐼
𝐽𝐽+ = 𝐼
21
17.11.2023
For arbitrary 𝑏 ∈ ℝ𝑛
22
1/5/2024
1
1/5/2024
Mechanisms
Grübler’s Formula
DoF
2
1/5/2024
Constraints
=0
ሶ = න 𝐴 𝜃 𝑑𝜃 = 𝑔(𝜃)
න 𝐴 𝜃 𝜃𝑑𝑡
𝜕𝑔
= 1 + cos 𝑞1 → 𝑔 𝑞 = 𝑞1 + sin 𝑞1 + ℎ(𝑞2 , 𝑞3 )
𝜕𝑞1
𝜕𝑔
= cos 𝑞2 → 𝑔 𝑞 = 𝑞1 + sin 𝑞1 + sin 𝑞2 + ℎ(𝑞3 )
𝜕𝑞2
. 𝜕𝑔
= 1 + cos 𝑞1 cos 𝑞2 → ℎ 𝑞3 = 1 + cos 𝑞1 cos 𝑞2 𝑞3 ? ? ?
𝜕𝑞3
3
1/5/2024
Coordinate Frames
𝑖1 ∙ 𝑖𝑜 𝑗1 ∙ 𝑖𝑜 𝑘1 ∙ 𝑖𝑜
𝑅10 = 𝑖10 𝑗10 𝑘10 3×3 = 𝑖1 ∙ 𝑗𝑜 𝑗1 ∙ 𝑗𝑜 𝑘1 ∙ 𝑗𝑜 ∈ 𝑆𝑂(3)
𝑖1 ∙ 𝑘𝑜 𝑗1 ∙ 𝑘𝑜 𝑘1 ∙ 𝑘𝑜
Example
cos 𝜃
𝑖10 =
sin 𝜃
− sin 𝜃
𝑗10 =
cos 𝜃
cos 𝜃 − sin 𝜃
𝑅10 =
sin 𝜃 cos 𝜃
cos 𝜃 −sin 𝜃 0
𝑅10 = sin 𝜃 cos 𝜃 0 = 𝑅𝑜𝑡 𝑧, 𝜃 = 𝑅𝑧,𝜃
0 0 1
4
1/5/2024
Similarity Transformation
𝐴1 = 𝑅01 𝐴0 𝑅10
Or
𝐴1 = 𝑅10 −1 0 0
𝐴 𝑅1
Angular velocity in {b} frame, 𝜔𝑏 , may be expressed in {i}, 𝜔𝑖
𝑆 𝑏 = 𝜔𝑏
−1 𝑏
𝑆 𝑖 = 𝑅𝑖𝑏 𝑆 𝑅𝑖𝑏
With 𝑆 𝑖 = 𝜔𝑖
10
5
1/5/2024
Consecutive Rotations
𝑅1 𝑅2 … 𝑅𝑛−1 𝑅𝑛
𝑅𝑛 𝑅𝑛−1 … 𝑅2 𝑅1
11
12
6
1/5/2024
13
14
7
1/5/2024
Derivative of R
15
Observed that
𝑑𝑅𝑥,𝜙
= 𝑆 𝑖 𝑅𝑥,𝜙
𝑑𝜙
𝑑𝑅𝑦,𝜃
= 𝑆 𝑗 𝑅𝑦,𝜃
𝑑𝜃
𝑑𝑅𝑧,𝜓
= 𝑆 𝑘 𝑅𝑧,𝜓
𝑑𝜓
And
𝑑𝑅(𝑡)
= 𝑆 𝜔 𝑅(𝑡)
𝑑𝑡
16
8
1/5/2024
Homogenous Transformation
17
18
9
1/5/2024
Rule 1: 𝑧𝑖−1 axis is the 𝑖 𝑡ℎ joint axis of actuation, on the parent frame
Rule 2: 𝑥𝑖 axis on the shortest line segment between 𝑧𝑖−1 and 𝑧𝑖 , on the
child frame
Note: Selection 𝑥𝑖 must be orthogonal to both 𝑧𝑖−1 and 𝑧𝑖
Steps to assign the coordinate frames for link 𝑖 with respect to {𝑖 − 1}
If 𝑧𝑖−1 and 𝑧𝑖 are parallel, 𝑥𝑖 can be anywhere, pick the most
convenient on 𝑖 𝑡ℎ joint
If 𝑧𝑖−1 and 𝑧𝑖 orthogonal, 𝑥𝑖 normal (either ways) to the surface of the
plane of 𝑧𝑖−1 and 𝑧𝑖 , and 𝑜𝑖 is at the intersection
𝑥𝑜 is free but for the convenience picked parallel to 𝑥1
If 𝑧𝑛 of the end effector is free, pick it parallel to 𝑧𝑛−1
19
𝜃 revolute
𝑞𝑖 = ቊ 𝑖
𝑑𝑖 prismatic
20
10
1/5/2024
21
22
11
1/5/2024
Angular velocity
0 0
𝜔0,2 = 𝜔0,1 + 𝑅10 𝜔1,2
1 0
= 𝜔0,1 0
+ 𝜔1,2
Example: Let
0 𝑇
𝜔0,1 = 110
1 𝑇
𝜔1,2 = 011
If
0.7 −.7 0
𝑅10 = 0.7 0.7 0
0 0 1
0
What is 𝜔0,2 ?
23
Velocity Jacobians
All in the base frame. For the prismatic joint the ith column
𝒛
𝐽𝑖 = 𝑖−1
0 6×1
24
12
1/5/2024
With
𝒛00 = 𝒛10 = 0, 0, 1 𝑇
0 𝑇
𝑜0,0 = 0,0,0
0 𝑇
𝑜0,1 = 𝑥1 , 𝑦1 , 0
0 𝑇
𝑜0,2 = 𝑥2 , 𝑦2 , 0
And
𝑥1 = 𝑎1 𝑐𝜃1 , 𝑦1 = 𝑎1 𝑠𝜃1
𝑥2 = 𝑎1 𝑐𝜃1 + 𝑎2 𝑐 𝜃1 + 𝜃2
𝑦2 = 𝑎1 𝑠𝜃1 + 𝑎2 𝑠 𝜃1 + 𝜃2
25
𝒛00 × 𝑜0,2
0 0
− 𝑜0,0 𝒛10 × 𝑜0,2
0 0
− 𝑜0,1
𝐽1 = 𝐽2 =
𝒛00 6×1
𝒛10 6×1
With
0 −1 0 𝑥2 −𝑎1 𝑠1 − 𝑎2 𝑠12
𝒛00 × 𝑜0,2
0 0
− 𝑜0,0 = 1 0 0 𝑦2 = 𝑎1 𝑐1 + 𝑎2 𝑐12
0 0 0 0 0
0 −1 0 𝑥2 −𝑎2 𝑠12
𝒛10 × 𝑜0,2
0 0
− 𝑜0,1 = 1 0 0 𝑦2 = 𝑎2 𝑐12
0 0 0 0 0
The jacobian
−𝑎1 𝑠1 − 𝑎2 𝑠12 −𝑎2 𝑠12
𝑎1 𝑐1 + 𝑎2 𝑐12 𝑎2 𝑐12
0 0
𝐽= 0 0
0 0
1 1
26
13
1/5/2024
Complete Methods
Exact topology of 𝐶𝑓𝑟𝑒𝑒 is available and used, costly though
27
Grid methods
Discretize C-space into grids/voxels.
Works well with low dimensional problems, search and memory footprint
grows exponentially with the complexity of map
Sampling methods
Random or deterministic sampling of C-space, fast but optimal
Potential fields
Attract to the goal and repel from the obstacles via defined fields
Local minima is a concern
Nonlinear optimization
In nonconvex space local minima is a concern, high computation need
Smoothing is desired for jerky planners
28
14
1/5/2024
stop
start
29
Grid Methods
30
15
1/5/2024
A* Algorithm
31
1 2 3 4 5 6
past_cost 0 ∞ ∞ ∞ ∞ ∞
heuristic_cost 20 10 10 10 5 0
Total_cost 20 ∞ ∞ ∞ ∞ ∞
Parent - - - - - -
32
16
1/5/2024
RRT
33
𝑥𝑛𝑒𝑤
𝑥𝑛𝑒𝑎𝑟𝑒𝑠𝑡
34
17
1/5/2024
35
Path
Showing a way from a point A to point B in C-space
No notion of time and velocity
Trajectory
Following a path with time and velocity constraints
Motion defined by the trajectory must be able to satisfy
dynamic equations modeling the system with a feasible input
A trajectory 𝑥 ∗ (𝑡) driven by a feasible 𝑢∗ (𝑡) satisfy
𝑥ሶ ∗ = 𝑓(𝑥 ∗ , 𝑢∗ )
Limits of the actuators must be taken into account for
trajectory planning
36
18
1/5/2024
Smooth Trajectories
For general
𝑇
2
𝑥 ∗ 𝑡 = argmin න 𝑥 𝑛 𝑑𝑡
𝑥(𝑡) 0
37
Example
Time(sec) 0 2 10 50 100
For segment 2: 𝑥2 𝑡 = 𝑐1 𝑡 + 𝑐𝑜
1 2 𝑐𝑜 4
1 10 𝑐1 = 30
𝑐𝑜 1 10 −2 4 1 −20
𝑐1 = 8 −1 1 30
=
8 26
13 5
𝑥2 𝑡 = 𝑡 − , 𝑡 ∈ [2,10]
4 2
38
19
1/5/2024
39
Velocity Profile
40
20
1/5/2024
41
Motor model
𝜏𝑚 = 𝐾𝑚 𝑖𝑎
𝑉𝑏 = 𝐾𝑏 𝜔𝑚
42
21
1/5/2024
43
Transient Control
Find negative feedback controller so that the output tracks the reference
with a given combinations of desired
%Overshoot (%OS)
Settling time (Ts)
Peak time (Tp)
Rise time (Tr)
These time domain requirements may be transformed to frequency domain
%𝑂𝑆 = 100 × 𝑒 −𝜁𝜋/ 1−𝜁 2
4
𝑇𝑠 ≈
𝜁𝜔𝑛
The desired closed loop system’s damping ratio and natural frequency may
be achieved by placing the dominant poles at
𝑝1,2 = −𝜁𝜔𝑛 ± 𝜔𝑛 1 − 𝜁 2 ≝ 𝜎𝑑 ± 𝑗𝜔𝑑
44
22
1/5/2024
Example
45
𝜃𝑙 𝑘/𝐽𝑚 𝐽𝑙
=
𝑇𝑚 𝑠 4 + 𝐵1 + 𝐵2 𝑠 3 + 𝑘 1 + 1 + 𝐵1 𝐵2 𝑠 2 + 𝑘 𝐵 + 𝐵 𝑠
𝐽𝑚 𝐽𝑙 𝐽𝑚 𝐽𝑙 𝐽𝑚 𝐽𝑙 𝐽𝑚 𝐽𝑙 1 2
46
23
1/5/2024
47
𝐷 𝑞 𝑞ሷ + 𝐶 𝑞, 𝑞ሶ 𝑞ሶ + 𝐺 𝑞 = 𝜏
𝜏 = 𝐷 𝑞 𝑎 + 𝐶 𝑞, 𝑞ሶ 𝑞ሶ + 𝐺 𝑞
𝐷 𝑞 𝑞ሷ = 𝐷(𝑞)𝑎
Or
𝑞ሷ = 𝑎
48
24
1/5/2024
49
System
𝐷 𝑞 𝑞ሷ + 𝐶 𝑞, 𝑞ሶ 𝑞ሶ + 𝐺 𝑞 = 𝜏
Controller
𝜏 = 𝐷 𝑞 [𝑞ሷ 𝑑 + 𝐾𝑑 𝑒ሶ + 𝐾𝑝 𝑒] + 𝐶 𝑞, 𝑞ሶ 𝑞ሶ + 𝐺 𝑞
For a transient response with maximum rise time without an
overshoot
𝜁 = 1, 𝜔𝑛
Desired poles
𝑠 2 + 2𝜁𝜔𝑛 𝑠 + 𝜔𝑛2 = 𝑠 2 + 2𝜔𝑛 𝑠 + 𝜔𝑛2 = 0
Implies
𝐾𝑝 = 𝜔𝑛2 , 𝐾𝑑 = 2𝜔𝑛
50
25
INTRO TO ROS
What is ROS?
A software framework for programming
robots
Robotics Foundation
and ecosystem
Dr. Y. 1
Advantages and Disadvantages of ROS
ROS Distros
Dr. Y. 2
Installation
Nodes can
pass messages to one another through topics,
Dr. Y. 3
Decentralized architecture
The main process called the ROS Master, must be started first, that
registers nodes,
sets up peer-to-peer node-to-node communication for topics,
controls parameter server updates
Messages and service calls do not pass through the master
Master
top
Node1 Node2
ics
Basic Terminology
Topic 1 Topic 2
/odom /cmd_vel
Node 1 Node 2 Node 3
x: 0.1 Forward: 0.2
Wheel y: -1 Path Turn: 0 Motor
odometer z: 0 planner controller
Dr. Y. 4
Services and Actions
Parameter server
accessed infrequently
For instance
distance between two fixed points in the environment,
Map of environment
10
Dr. Y. 5
Some ROS Key Terminologies
Master: Name service for ROS (i.e. helps nodes find each other)
roscore: Master + rosout + parameter server (parameter server will be introduced later)
11
Some Tools
rviz
a three-dimensional visualization tool for robots, the environments, and
sensor data
rosbag
a command line tool used to record and playback ROS message data
catkin
the ROS build system based on CMake, and is similarly cross-platform,
open-source, and language-independent.
roslaunch
a tool used to launch multiple ROS nodes from multiple packages, as
well as setting parameters.
rosbridge
provides a JSON API to ROS functionalities for non-ROS programs
12
Dr. Y. 6
rosrun is another command to launch single node from a single package if
roscore is running
Whereas roslaunch can launch multiple nodes from multiple packages
Additionally, roslaunch will automatically start roscore (if not running
already)
roslaunch uses launch files, which can automatically start other programs
by including other launch files, set some parameters etc.
13
14
Dr. Y. 7
Packages in a catkin Workspace
15
Packages:
The lowest level of ROS software
organization that can contain any of
libraries, tools, executables, etc.
Pack. Manifest:
A manifest is a description of a package. Its
most important role is to define
dependencies between packages, author,
license, dependencies, compilation flags,
and so on.
Metapacks/Stacks:
Stacks are collections of packages that form
a higher-level library. E.g., ROS Navigation
Stack
Services:
request/reply interaction between
processes
16
Dr. Y. 8
Now you can create a package in the empty src directory using catkin_create_pkg
$ cd ~/catkin_ws/src
aydin@ayG:~/catkin_ws/src$ tree
└── my_pkg
├── CMakeLists.txt
├── include
│ └── my_pkg
├── package.xml
└── src
17
Config the
Package.xml file package.xml
18
Dr. Y. 9
Building the execs
19
roscore
20
Dr. Y. 10
ROS Command-line
21
22
Dr. Y. 11
rosmsg/rossrv displays Message/Service (msg/srv) data
structure definitions.
Commands:
rosmsg show Display the fields in the msg.
rosmsg users Search for code using the msg.
rosmsg md5 Display the msg md5 sum.
rosmsg package List all the messages in a package.
rosnode packages List all the packages with messages.
Examples:
Display the Pose msg:
$ rosmsg show Pose
List the messages in nav msgs:
$ rosmsg package nav msgs
List the files using sensor msgs/CameraInfo:
$ rosmsg users sensor msgs/CameraInfo
23
Wiki Tutorials
24
Dr. Y. 12
Example
float64 x
float64 y
float64 z
geometry_msgs/Vector3 angular
float64 x
float64 y
float64 z
25
Message Types
26
Dr. Y. 13
Publishing to a Topic thru cmd line
27
$ rostopic pub /turtle1/cmd_vel geometry_msgs/Twist -r 1 -- '[2.0, 0.0, 0.0]' '[0.0, 0.0, -1.8]'
28
Dr. Y. 14
Graph Visualization
29
PLOT Visualization
30
Dr. Y. 15
Publishing and subscribing
31
#include "ros/ros.h“
Name of node
@50Hz
32
Dr. Y. 16
Launch Files
33
34
Dr. Y. 17
The frames.pdf file
35
36
Dr. Y. 18
Find the transform between two frames
rosrun tf tf_echo [reference_frame] [target_frame]
For instance
$ rosrun tf tf_echo turtle1 turtle2
At time 1568050753.324
- Translation: [0.000, 0.000, 0.000]
- Rotation: in Quaternion [0.000, 0.000, 0.344, 0.939]
in RPY (radian) [0.000, -0.000, 0.703]
in RPY (degree) [0.000, -0.000, 40.275]
37
Moving /tf
38
Dr. Y. 19
In the URDF file each joint can be defined as fixed or movable
(e.g. continuous spinning, limited rotation, linear sliding).
robot_state_publisher needs /joint_states to publish moving
frames
39
ros-args -p robot_description:="$(xacro
path/to/my/file.urdf.xacro)“
40
Dr. Y. 20
Rviz -- 3D Visualization
$ rviz
41
Robot Description
Geometry of links
42
Dr. Y. 21
Unified Robot Description Format (URDF)
43
Model
44
Dr. Y. 22
Simple URDF 1 DoF
XML syntax is used to define
fields
Minimal info for the
Transformations (coordinate
frames) shown
Kinematically consistent open-
chain robots are supported
45
Links
46
Dr. Y. 23
Joints
47
Joint Types
48
Dr. Y. 24
Industrial robots URDF (XACRO) files may be generated using
49
Dr. Y. 25
12/13/2023
PATH&TRAJECTORY PLANNING
Some Definitions
Configuration: 𝑞 ∈ 𝐶
C-space: 𝐶 = 𝐶𝑓𝑟𝑒𝑒 ∪ 𝐶𝑜𝑏𝑠
State: 𝑥 = 𝑞 (if the input is velocity)
𝑇
𝑥= 𝑞 𝑣 ∈ 𝑋 if the input is force
Equations of motion of a robot
𝑥ሶ = 𝑓 𝑥, 𝑢 𝑢∈𝑈
with a solution
𝑡
𝑥 𝑡 = 𝑥𝑜 + න 𝑓 𝑥, 𝑢 𝑑𝜏 , ∀𝑡 ∈ [𝑡𝑜 , 𝑇]
𝑡𝑜
1
12/13/2023
Motion Planning
Problem Statement:
Given
an initial state 𝑥𝑜 = 𝑥𝑠𝑡𝑎𝑟𝑡 and
a desired state 𝑥𝑇 = 𝑥𝑔𝑜𝑎𝑙
Find 𝑇 and 𝑢: 𝑡𝑜 , 𝑇 → 𝑈 such that
𝑥 𝑡 ȁ𝑡=𝑇 = 𝑥𝑔𝑜𝑎𝑙 and
𝑞 𝑡 ∈ 𝐶𝑓𝑟𝑒𝑒 for all 𝑡 ∈ [0, 𝑇].
Motion Planner
2
12/13/2023
Complete Methods
Exact topology of 𝐶𝑓𝑟𝑒𝑒 is available and used, costly though
Complete Methods
Exact topology of 𝐶𝑓𝑟𝑒𝑒 is available and used, costly though
3
12/13/2023
Grid methods
Discretize C-space into grids/voxels.
Works well with low dimensional problems, search and memory footprint
grows exponentially with the complexity of map
Sampling methods
Random or deterministic sampling of C-space, fast but optimal
Potential fields
Attract to the goal and repel from the obstacles via defined fields
Local minima is a concern
Nonlinear optimization
In nonconvex space local minima is a concern, high computation need
Smoothing is desired for jerky planners
Obstacle Space
4
12/13/2023
Collision Detection
leafs
10
5
12/13/2023
11
stop
start
12
6
12/13/2023
A* Algorithm
13
A* Algorithm – Development
14
7
12/13/2023
1 2 3 4 5 6
past_cost 0 ∞ ∞ ∞ ∞ ∞
heuristic_cost 20 10 10 10 5 0
Total_cost 20 ∞ ∞ ∞ ∞ ∞
Parent - - - - - -
15
Node 1 Search
5
2
15 5
6
7
1 12 3
15
6
20
4 OPEN: 1(20), 2(25)
12
1 2 3 4 5 6
past_cost 0 15
∞ ∞ ∞ ∞ ∞
heuristic_cost 20 10 10 10 5 0
Total_cost 20 25
∞ ∞ ∞ ∞ ∞
Parent - 1- - - - -
16
8
12/13/2023
5
2
15 5
6
7
1 12 3
15
6 Open list sorted by the cost
20
4 OPEN: 1(20), 3(22), 2(25)
12
1 2 3 4 5 6
past_cost 0 15 12 ∞ ∞ ∞
heuristic_cost 20 10 10 10 5 0
Total_cost 20 25 22 ∞ ∞ ∞
Parent - 1 1 - - -
17
5
2
15 5
6
7
1 12 3
15
6
20
4 OPEN: 1(20), 3(22), 2(25), 4(30)
12
Now node 1 closed
1 2 3 4 5 6
past_cost 0 15 12 20 ∞ ∞
heuristic_cost 20 10 10 10 5 0
Total_cost 20 25 22 30 ∞ ∞
Parent - 1 1 1 - -
18
9
12/13/2023
5
2
15 5
6
7
1 12 3
15 The next search for shortest node
6
20
4 OPEN: 3(22), 2(25), 4(30)
12
CLOSED: 1(20)
1 2 3 4 5 6
past_cost 0 15 12 20 ∞ ∞
heuristic_cost 20 10 10 10 5 0
Total_cost 20 25 22 30 ∞ ∞
Parent - 1 1 1 - -
19
5
2
15 5
6
7
1 12 3
15
6
20
4 OPEN: 3(22), 5(23), 2(25), 4(30)
12
CLOSED: 1(20)
1 2 3 4 5 6
past_cost 0 15 12 20 18
∞ ∞
heuristic_cost 20 10 10 10 5 0
Total_cost 20 25 22 30 23
∞ ∞
Parent - 1 1 1 3- -
20
10
12/13/2023
5
2
15 5
6
7
1 12 3
15
6
20
4 OPEN: 3(22), 5(23), 2(25), 6(27),4(30)
12
CLOSED: 1(20)
1 2 3 4 5 6
past_cost 0 15 12 20 18 27
heuristic_cost 20 10 10 10 5 0
Total_cost 20 25 22 30 23 27
Parent - 1 1 1 3 3
21
5
2
15 5
6
7
1 12 3
15
6
20
4 OPEN: 5(23), 2(25), 6(27),4(30)
12
CLOSED: 1(20), 3(22)
1 2 3 4 5 6
past_cost 0 15 12 20 18 27
heuristic_cost 20 10 10 10 5 0
Total_cost 20 25 22 30 23 27
Parent - 1 1 1 3 3
22
11
12/13/2023
5
2
15 5
6
7
1 12 3
15
6
20
4 OPEN: 5(23), 2(25), 6(27),4(30)
12
CLOSED: 1(20), 3(22)
1 2 3 4 5 6
past_cost 0 15 12 20 18 27
heuristic_cost 20 10 10 10 5 0
Total_cost 20 25 22 30 23 27
Parent - 1 1 1 3 3
23
5
2
15 5
6
7
1 12 3
15
6
20
4 OPEN: 5(23), 6(25), 2(25), 4(30)
12
CLOSED: 1(20), 3(22)
1 2 3 4 5 6
past_cost 0 15 12 20 18 27 25
heuristic_cost 20 10 10 10 5 0
Total_cost 20 25 22 30 23 27 25
Parent - 1 1 1 3 35
24
12
12/13/2023
5
2
15 5
6
7
1 12 3
15
6
20
4 OPEN: 6(25), 2(25), 4(30)
12
CLOSED: 1(20), 3(22), 5(23)
1 2 3 4 5 6
past_cost 0 15 12 20 18 25
heuristic_cost 20 10 10 10 5 0
Total_cost 20 25 22 30 23 25
Parent - 1 1 1 3 5
25
Parent(6)=5
Parent(5)=3
5
2 Parent(3)=1
15 5
6
7 Path:1 → 3 → 5 → 6
1 12 3 Cost: 25
15
6
20
4 OPEN: 6(25), 2(25), 4(30)
12
CLOSED: 1(20), 3(22), 5(23)
1 2 3 4 5 6
past_cost 0 15 12 20 18 25
heuristic_cost 20 10 10 10 5 0
Total_cost 20 25 22 30 23 25
Parent - 1 1 1 3 5
26
13
12/13/2023
Notes
If heuristic estimate is larger than the actual cost you may not
get an optimal path
May pick Euclidean distance for those heuristic estimates
Widely used in autonomous mobile robot applications
27
A* Graph Search
28
14
12/13/2023
Grid Methods
29
Multi-Resolution Grid
Uniform sampling of C space bring excessive search time and map memory
footprint that are not desired complex maps
Multi resolution grid technique can reduce the complexity
Each dimension is split in half to turn a cell into 22𝑛 cells
If there is an obstacle in a cell, keep splitting till the maximum resolution
else don’t spit
2D grids divided 2𝑛 = 4 cells at each run is called quadtree
3D grid cells (voxels) divided 2𝑛 = 8 cells called an octree
30
15
12/13/2023
Multi-Resolution Grid
31
Dijkstra’s algorithm:
If the heuristic cost-to-go is always estimated as zero then
A∗ always explores from the OPEN node that has been
reached with minimum past cost. Naturally slower than A*
Breadth-first search:
If each edge has the same cost, Dijkstra’s algorithm reduces
to breadth-first search.
All nodes one edge away from the start node are
considered first, then all nodes two edges away, etc. The
first solution found is, therefore, a minimum-cost path.
32
16
12/13/2023
33
Illustration
(a) (b)
(a) Each action has the same cost
(b) Reverse motion is penalized in the cost
34
17
12/13/2023
Sampling Methods
35
36
18
12/13/2023
RRT
37
𝑥𝑠𝑎𝑚𝑝𝑙𝑒
𝑥𝑛𝑒𝑤
𝑥𝑛𝑒𝑎𝑟𝑒𝑠𝑡
38
19
12/13/2023
Illustration
39
40
20
12/13/2023
41
42
21
12/13/2023
43
44
22
12/13/2023
45
Nonlinear Optimization
46
23
12/13/2023
Path
Showing a way from a point A to point B in C-space
No notion of time and velocity
Trajectory
Following a path with time and velocity constraints
Motion defined by the trajectory must be able to satisfy
dynamic equations modeling the system with a feasible input
A trajectory 𝑥 ∗ (𝑡) driven by a feasible 𝑢∗ (𝑡) satisfy
𝑥ሶ ∗ = 𝑓(𝑥 ∗ , 𝑢∗ )
Limits of the actuators must be taken into account for
trajectory planning
47
48
24
12/13/2023
Path
49
𝑇
∗
𝑥 𝑡 = argmin න 𝐿 𝑥,ሶ 𝑥, 𝑡 𝑑𝑡
𝑥(𝑡) 0
Functionals
𝑇
Shortest distance path is 𝑥 ∗ 𝑡 = argmin 0 𝑥ሶ 2 𝑑𝑡
𝑥(𝑡)
𝑇
Least energy: argmin 0 [𝐾 𝑥,ሶ 𝑥, 𝑡 − 𝑃(𝑥, 𝑡)]𝑑𝑡
𝑥(𝑡)
50
25
12/13/2023
𝑇
∗
𝑥 𝑡 = argmin න 𝐿 𝑥,ሶ 𝑥, 𝑡 𝑑𝑡
𝑥(𝑡) 0
Lagrange Equations
Necessary conditions satisfied by the ‘optimal’ function
𝑑 𝜕𝐿 𝜕𝐿
− =0
𝑑𝑡 𝜕 𝑥ሶ 𝜕𝑥
51
Smooth Trajectories
For general
𝑇
2
𝑥 ∗ 𝑡 = argmin න 𝑥 𝑛
𝑑𝑡
𝑥(𝑡) 0
The order 𝑛
𝑛 = 1, Minimum velocity, (the shortest path)
𝑛 = 2, Minimum acceleration
𝑛 = 3, Minimum jerk
𝑛 = 4, Minimum snap
𝑛
𝑥 is referred as the input
52
26
12/13/2023
Smooth Trajectories
𝑇
∗ 𝑛 2
𝑥 𝑡 = argmin න 𝑥 𝑑𝑡
𝑥(𝑡) 0
2𝑥ሷ = 0 → 𝑥 𝑡 = 𝑐1 𝑡 + 𝑐𝑜
The unknown coefficients found thru the boundary conditions
53
54
27
12/13/2023
Minimum Path
𝑑𝑠 = 𝑑𝑥 2 + 𝑑𝑡 2
𝑑𝑥 2
= +1
𝑑𝑡
= 𝑥ሶ 2 + 1
Length of curve
𝑇
= 𝑠𝑑 0 𝑥ሶ 2 + 1
𝐿 = 𝑥ሶ 2 + 1
55
56
28
12/13/2023
Integrate it to get
𝑥ሶ
=𝛼
𝑥ሶ 2 + 1
Or
𝛼2
𝑥ሶ = ≝ 𝑐1
1 − 𝛼2
Integrate this
𝑥 = 𝑐1 𝑡 + 𝑐𝑜
The same solution as the minimum velocity functional
57
58
29
12/13/2023
𝑇
𝑥 𝑡 = argmin න 𝑥ሷ 2 𝑑𝑡
∗
𝑥(𝑡) 0
The functional, 𝐿 = 𝑥ሷ 2
Euler-Lagrange equations
𝜕𝐿 𝑑 𝜕𝐿 𝑑2 𝜕𝐿
− + 2 =0
𝜕𝑥 𝑑𝑡 𝜕 𝑥ሶ 𝑑𝑡 𝜕𝑥ሷ
𝑑2
2𝑥ሷ = 2𝑥 (4) = 0
𝑑𝑡 2
Cubic splines obtained after four integrations
𝑥 = 𝑐3 𝑡 3 + 𝑐2 𝑡 2 + 𝑐1 𝑡 + 𝑐0
59
Cubic splines
𝑥 = 𝑐3 𝑡 3 + 𝑐2 𝑡 2 + 𝑐1 𝑡 + 𝑐0
Requires four independent equations to solve four unknowns
Desired positions: 𝑥𝑜 = 𝑥 0 , 𝑥𝑇 = 𝑥(𝑇) yield 2 eqns.
𝑡 = 0 → 𝑥𝑜 = 𝑐0
𝑡 = 𝑇 → 𝑥𝑇 = 𝑐3 𝑇 3 + 𝑐2 𝑇 2 + 𝑐1 𝑇 + 𝑐0
So the desired velocities 𝑣𝑜 = 𝑣 0 , 𝑣𝑇 = 𝑣(𝑇) needed to be
specified as well for a unique solution
𝑡 = 0 → 𝑣𝑜 = 𝑐1
𝑡 = 𝑇 → 𝑣𝑇 = 3𝑐3 𝑇 2 + 2𝑐2 𝑇 + 𝑐1
60
30
12/13/2023
𝑇
∗ 3 2
𝑥 𝑡 = argmin න 𝑥 𝑑𝑡
𝑥(𝑡) 0
3
𝐿=𝑥
Euler-Lagrange equations
𝜕𝐿 𝑑 𝜕𝐿 𝑑2 𝜕𝐿 𝑑3 𝜕𝐿
− + 2 − 3 =0
𝜕𝑥 𝑑𝑡 𝜕 𝑥ሶ 𝑑𝑡 𝜕 𝑥ሷ 𝑑𝑡 𝜕𝑥 (3)
𝑑3
2𝑥 (3) = 2𝑥 (6) = 0
𝑑𝑡 3
𝑥 = 𝑐5 𝑡 5 + 𝑐4 𝑡 4 + 𝑐3 𝑡 3 + 𝑐2 𝑡 2 + 𝑐1 𝑡 + 𝑐0
62
63
31
12/13/2023
𝑥 = 𝑐5 𝑡 5 + 𝑐4 𝑡 4 + 𝑐3 𝑡 3 + 𝑐2 𝑡 2 + 𝑐1 𝑡 + 𝑐0
Boundary conditions
Equations:
64
𝐴𝑞 = 𝑏
10 0 0 0 0 𝑐0 𝑥𝑜
01 0 0 0 0 𝑐1 𝑥ሶ 𝑜
00 2 0 0 0 𝑐2 𝑥ሷ 𝑜
𝑐3 = 𝑥𝑇
1 𝑇 𝑇2 𝑇3 𝑇4 𝑇5
01 2𝑇 3𝑇 2 4𝑇 3 5𝑇 4 𝑐4 𝑥ሶ 𝑇
00 2 6𝑇 12𝑇 2 20𝑇 3 𝑐5 𝑥ሷ 𝑇
Solved for polynomial coefficients
𝑞 = 𝐴−1 𝑏
65
32
12/13/2023
66
67
33
12/13/2023
Performance Comparison
68
69
34
12/13/2023
𝑥𝑖 − 𝑥𝑖−1 𝑡𝑖 𝑥𝑖−1
𝑥𝑖 𝑡 = 𝑡+ , 𝑖 = 1, … , 𝑚
𝑡𝑖 − 𝑡𝑖−1 𝑡𝑖 − 𝑡𝑖−1
70
71
35
12/13/2023
𝑡1 𝑡𝑚
𝑥 ∗ 𝑡 = argmin න 𝑥ሷ 2 𝑑𝑡 + ⋯ + න 𝑥ሷ 2 𝑑𝑡
𝑥(𝑡) 𝑡𝑜 𝑡𝑚−1
For the second order (n=2) system with m via points we have
4𝑚 unknown parameters in our desired trajectory
72
73
36
12/13/2023
4𝑚 − 2 equations are at
74
2𝑚 + 2 𝑚 − 1 + 2
75
37
12/13/2023
77
38
10/5/2023
Robot Engineering
Fall 2023
Assoc. Prof. Aydin Yesildirek
What is a Robot?
• An electromechanical device with multiple degrees-of-
freedom (DOF) that is programmable to accomplish a
variety of (motion) tasks.
✓ Industrial robots: multi-functional manipulator
designed to move materials, parts, tools, or
special devices in an industrial environment with
a fixed reference
✓ Mobile robots: an electromechanical system in
motion without a fixed reference
✓ Humanoid (biped) robots
1
10/5/2023
Robots in Industry
350 B.C
200 B.C.
2
10/5/2023
12th Century
Al-Jazari’s
Mechanisms
3
10/5/2023
Hezârfen
Ahmed
Çelebi 17th
Century
4
10/5/2023
1738
1770
1898
10
5
10/5/2023
1921
Czech writer Karel Capek introduced the word "Robot" in his play
"R.U.R" (Rossuum's Universal Robots). "Robot" in Czech comes
from the word "robota", meaning "compulsory labor“.
1940
Issac Asimov produces a series of short stories about robots
starting with "A Strange Playfellow" (later renamed "Robbie")
for Super Science Stories magazine. The story is about a robot
and its affection for a child that it is bound to protect. Over the
next 10 years he produces more stories about robots that are
eventually recompiled into the volume "I, Robot" in 1950. Issac
Asimov's most important contribution to the history of the
robot is the creation of his “Three Laws of Robotics”.
11
12
6
10/5/2023
1961
Heinrich Ernst develops the MH-1, a
computer operated mechanical hand at
MIT.
1961
Unimate, the company of Joseph
Engleberger and George Devoe, built the
first industrial robot, the PUMA
(Programmable Universal Manipulator
Arm).
13
1966
The Stanford Research
Institute creates Shakey the
first mobile robot to know
and react to its own actions.
14
7
10/5/2023
1969
Victor Scheinman creates the
Stanford Arm. The arm's
design becomes a standard
and is still influencing the
design of robot arms today.
15
1981
Takeo Kanade builds the direct drive arm. It
is the first to have motors installed
directly into the joints of the arm. This
change makes it faster and much more
accurate than previous robotic arms.
1989
A walking robot named Genghis is unveiled
by the Mobile Robots Group at MIT.
16
8
10/5/2023
1993
Dante an 8-legged walking robot
developed at CMU descends
into Antarctica. Its mission is to
collect data from a harsh
environment similar to what we
might find on another planet.
17
1996 2000
Honda debuts the P3. Honda, then, improves P3 to ASIMO
18
9
10/5/2023
1997
NASA’s Pathfinder Mission
lands on Mars
19
1999
SONY releases the AIBO
robotic pet.
20
10
10/5/2023
2016
21
Tesla Robotics
• Robotics + AI
• Robots building robots
• Robots everywhere
22
11
10/5/2023
Drive System
23
24
12
10/5/2023
25
26
13
10/5/2023
27
Some definitions
• The configuration of a robot is a complete specification of the position of every point of the
robot.
• The n-dimensional space containing all possible configurations of the robot is called the
configuration space (C-space).
• The configuration of a robot is represented by a point in its C-space.
• The task space is the space in which a task is most naturally represented.
• Robot’s end-effector reachable space within C-space is named as workspace.
• The minimum number of real-valued coordinates needed to represent the configuration is the
number of degrees of freedom (dof) of the robot.
28
14
10/5/2023
29
30
15
10/5/2023
31
32
16
10/5/2023
33
Coin Example in 3D
• Additional points X come with 3 freedom of points minus 3 constraints, constants 𝑑𝐴𝑋 , 𝑑𝐵𝑋 , 𝑑𝐶𝑋
34
17
10/5/2023
35
DoF
• degrees of freedom =
✓ (sum of freedoms of the points) − (number of independent constraints)
✓ (number of variables) − (number of independent equations).
• DoFs: 𝑎 1 𝑏 2 𝑐 3
• C-spaces: 𝑎 𝜃 𝑏 𝑥, 𝑦 𝑐 (𝑥, 𝑦, 𝜃)
36
18
10/5/2023
Robots
Constraints
DoF Constraints
Type C On 3D
f C On 2D
R 1 3-1=2 6-1=5
P 1 3-1=2 6-1=5
H 1 N/A 6-1=5
C 2 N/A 6-2=4
U 2 N/A 6-2=4
S 3 N/A 6-3=3
37
Grübler’s • Then
• = 𝑚 𝑁 − 1 − σ𝑖=1(𝑚 − 𝑓𝑖 )
𝐽
• = 𝑚 𝑁 − 1 − 𝐽 + σ𝑖=1 𝑓𝑖
38
19
10/5/2023
Examples
✓𝑁 = 3 + 1 = 4
✓𝐽 = 4
✓ 𝑓𝑖 = 1
✓𝑚 = 3
𝐽 4
𝐷𝑜𝐹 = 𝑚 𝑁 − 1 − 𝐽 − 𝑓𝑖 = 3 4 − 1 − 4 + 1 = 1
𝑖=1 𝑖=1
39
✓ 𝑁 = 5 + 1 =6
✓𝐽 = 7
✓ 𝑓𝑖 = 1
✓𝑚 = 3
𝐽 7
𝐷𝑜𝐹 = 𝑚 𝑁 − 1 − 𝐽 − 𝑓𝑖 = 3 6 − 1 − 7 + 1 = 1
𝑖=1 𝑖=1
40
20
10/5/2023
✓𝑁 = 5 + 1 = 6
✓𝐽 = 7
✓ 𝑓𝑖 = 1
✓𝑚 = 3
𝐽 7
𝐷𝑜𝐹 = 𝑚 𝑁 − 1 − 𝐽 − 𝑓𝑖 = 3 6 − 1 − 7 + 1 = 1
𝑖=1 𝑖=1
41
✓ 𝑁 = 5 + 2 + 1 =8
✓𝐽 = 8 R + 1 P = 9
✓ 𝑓𝑖 = 1
✓𝑚 = 3
𝐽 9
𝐷𝑜𝐹 = 𝑚 𝑁 − 1 − 𝐽 − 𝑓𝑖 = 3 8 − 1 − 9 + 1 = 3
𝑖=1 𝑖=1
42
21
10/5/2023
✓𝑁 = 4 + 1 = 5
✓𝐽 = 6
✓ 𝑓𝑖 = 1
✓𝑚 = 3
𝐽 6
𝐷𝑜𝐹 = 𝑚 𝑁 − 1 − 𝐽 − 𝑓𝑖 = 3 5 − 1 − 6 + 1 = 0
𝑖=1 𝑖=1
Is it rigid?
43
• =0
44
22
10/5/2023
• If velocity constraints
𝐴 𝑞 𝑞ሶ = 0
can be integrated to equivalent configuration constraints, they are holonomic.
• If not, they are nonholonomic: they reduce the dimension of the feasible
velocities, but not the dimension of the C-space.
45
Integrable Constraints?
• If 𝐴 𝑞 𝑞ሶ = 0 is integrable then there exists a 𝐺 𝑞 such that
𝜕𝐺
= 𝐴(𝑞)
𝜕𝑞
Example: Check if
1 + cos 𝑞2 𝑞ሶ 1 + 𝑞ሶ 2 cos 𝑞1 + 2 + cos 𝑞1 cos 𝑞2 𝑞ሶ 3 = 0
Is a holonomic constraint or not.
Let’s rewrite the constraint in Pfaffian’s form as
𝑞ሶ 1
𝐴 𝑞 𝑞ሶ = 1 + cos 𝑞2 cos 𝑞1 2 + cos 𝑞1 cos 𝑞2 𝑞ሶ 2 = 0
𝑞ሶ 3
𝜕𝑔
there is a 𝑔(𝑞) such that = 𝐴(𝑞) therefore A would be integrable.
𝜕𝑞
46
23
10/5/2023
• Pfaffian Form
𝑞ሶ 1
• 1 + cos 𝑞2 cos 𝑞1 2 + cos 𝑞1 cos 𝑞2 𝑞ሶ 2 = 𝐴 𝑞 𝑞ሶ = 0
𝑞ሶ 3
• The first condition
𝜕𝑔
= 𝑎1 = 1 + cos 𝑞2
𝜕𝑞1
• Implies
𝑔 𝑞 = 1 + cos 𝑞2 𝑞1 + ℎ1 (𝑞2 , 𝑞3 )
47
𝜕𝑔 𝜕ℎ1 𝑞2 , 𝑞3
= − sin 𝑞2 𝑞1 +
𝜕𝑞2 𝜕𝑞2
• Can’t be equal to 𝑎2 = cos 𝑞1 as suggested in the constraint for any ℎ1 𝑞2 , 𝑞3 .
• Therefore, not integrable hence Nonholonomic
48
24
10/5/2023
𝜕𝑔
= 1 → 𝑔 = 𝑞1 + ℎ1 (𝑞2 , 𝑞3 , 𝑞4 ) (1)
𝜕𝑞1
𝜕𝑔
= 0 → 𝑔 = 𝑞1 + ℎ1 (𝑞3 , 𝑞4 ) (2)
𝜕𝑞2
𝜕𝑔
= 0 → 𝑔 = 𝑞1 + ℎ1 (𝑞4 ) (3)
𝜕𝑞3
𝜕𝑔
= −𝑟 cos 𝑞3 → 𝑔 = 𝑞1 − 𝑟𝑞4 cos 𝑞3 (4)
𝜕𝑞4
49
3R planar robot has its endpoint pinned by a revolute joint, making a four-
bar linkage.
50
25
17.11.2023
INVERSE KINEMATICS
Ch. 3
Inverse Kinematic
1
17.11.2023
Inverse Kinematics
2
17.11.2023
Multiple Solutions
Kinematic Decoupling
3
17.11.2023
4
17.11.2023
Translation Step
𝜙 = atan2(𝑥𝑐 , 𝑦𝑐 )
𝛼 = atan2( 𝑟 2 − 𝑑2 , 𝑑)
𝑟 2 = 𝑥𝑐2 + 𝑦𝑐2
𝜃1 = 𝜙 − 𝛼
5
17.11.2023
Projection
6
17.11.2023
Joint 3
Law of cosines
Joint 2
7
17.11.2023
For
8
17.11.2023
We use
𝑟11 𝑟12 𝑟13
𝑅63 = 𝑅30 𝑇 𝑅 = 𝑟21 𝑟22 𝑟33
𝑟31 𝑟32 𝑟33
For the desired orientation and find out Euler angles
𝜃>𝟎 𝜃<𝟎
2 2
𝜃 = atan2 𝑟33 , 1 − 𝑟33 𝜃 = atan2 𝑟33 , − 1 − 𝑟33
𝜙 = atan2 𝑟13 , 𝑟23 𝜙 = atan2 −𝑟13 , −𝑟23
𝜓 = atan2( − 𝑟31 , 𝑟32 ) 𝜓 = atan2( 𝑟31 , −𝑟32 )
Example
9
MKT4831 Robotics Engineering
Homework #2
(a)
(b)
Fig. 1
𝐿1
3) Arm shown in Fig. Let the offsets of the frames origins be L1=1, L2=1, and L3=1.
a) Find the wrist position 𝑜𝐶 with respect to the base
b) Find the inverse kinematic equations and give four sets of angles 𝜃1 , 𝜃2 , 𝜃3 (left up, left
down, right up, right down configs) to place the 𝑜𝐶 = (1.8, 2.6, 1.2)
Let’s assume a wrist with frames XYZ axes color coded as RGB
𝜃5
𝑜𝐶 𝑜𝐶
𝑜𝐶 𝜃6
𝜃4
print(np.arctan2(R[2,2],np.sqrt(1-R[2,2]**2))*180/np.pi)# ->30
print(np.arctan2(R[0,2],R[1,2])*180/np.pi) # -> 60
print(np.arctan2(-R[2,0],R[2,1])*180/np.pi) # -> 45