02 Kinematics
02 Kinematics
Kinematics
Marc Toussaint
U Stuttgart
• Two “types of robotics”:
1) Mobile robotics – is all about localization & mapping
2) Manipulation – is all about interacting with the world
[0) Kinematic/Dynamic Motion Control: same as 2) without ever making it to
interaction..]
2/61
Basic motion generation problem
• Move all joints in a coordinated way so that the endeffector makes a
desired movement
3/61
Outline
• Kinematics: φ : q 7→ y
• Inverse Kinematics: y ∗ 7→ q ∗ = minq ||y ∗ − φ(q)|| + ||∆q||W
• Basic motion heuristics: Motion profiles
4/61
Basic 3D geometry & notation
5/61
Pose (position & orientation)
• Let (o, e1:3 ) be the world frame, (o0 , e01:3 ) be the body’s frame.
The new basis vectors are the columns in R, that is,
e01 = R11 e1 + R21 e2 + R31 e3 , etc,
• x = coordinates in world frame (o, e1:3 )
x0 = coordinates in body frame (o0 , e01:3 )
p = coordinates of o0 in world frame (o, e1:3 )
x = p + Rx0
7/61
Rotations
• Rotations can alternatively be represented as
– Euler angles – NEVER DO THIS!
– Rotation vector
– Quaternion – default in code
• See the “geometry notes” for formulas to convert, concatenate & apply
to vectors
8/61
Homogeneous transformations
• xA = coordinates of a point in frame A
xB = coordinates of a point in frame B
B B
R t x Rx + t
xA = TAB xB =
=
0 1 1 1
9/61
Is TAB forward or backward?
• TAB describes the translation and rotation of frame B relative to A
That is, it describes the forward FRAME transformation (from A to B)
10/61
Composition of transforms
TW C = TW A TAB TBC
xW = TW A TAB TBC xC 11/61
Kinematics
12/61
Kinematics
B eff
joint B'
transf.
A
relative
C'
A'
C eff.
offset
link
transf.
W
TW eff (q) = TW A TAA0 (q) TA0 B TBB 0 (q) TB 0 C TCC 0 (q) TC 0 eff
13/61
Joint types
• Joint transformations: TAA0 (q) depends on q ∈ Rn
TW eff (q) gives us the pose of the endeffector in the world frame
16/61
Kinematic Map
TW eff (q) gives us the pose of the endeffector in the world frame
φpos
eff,v (q) = TW eff (q) v ∈ R3
φvec
eff,v (q) = RW eff (q) v ∈ R3
φ : q 7→ y
17/61
Jacobian
• When we change the joint angles, δq, how does the effector position
change, δy?
∂
• Given the kinematic map y = φ(q) and its Jacobian J(q) = ∂q φ(q), we
have:
δy = J(q) δq
∂φ1 (q) ∂φ1 (q) ∂φ1 (q)
∂q1
∂q2 ... ∂qn
∂φ2 (q) ∂φ2 (q) ∂φ2 (q)
∂ ...
∂q1 ∂q2 ∂qn
∈ Rd×n
J(q) = φ(q) =
.. ..
∂q
. .
∂φd (q) ∂φd (q) ∂φd (q)
18/61
Jacobian for a rotational joint
eff
axis
point
i-th joint
19/61
Jacobian for a rotational joint
eff
Consider a variation δqi
axis → the whole sub-tree rotates
point
i-th joint
δpeff = [ai × (peff − pi )] δqi
δaeff = [ai × aeff ] δqi
⇒ Position Jacobian:
⇒ Vector Jacobian:
[a1 × (peff − p1 )]
[a2 × (peff − p2 )]
[an × (peff − pn )]
[a1 × aeff ]
[a2 × aeff ]
[an × aeff ]
..
.
pos
3×n vec
Jeff,v (q) = ∈R Jeff,v (q) = ∈ R3×n
..
.
20/61
Jacobian
• To compute the Jacobian of some endeffector position or vector, we
only need to know the position and rotation axis of each joint.
• The two kinematic maps φpos and φvec are the most important two
examples – more complex geometric features can be computed from
these, as we will see later.
21/61
Inverse Kinematics
22/61
Inverse Kinematics problem
• Generally, the aim is to find a robot configuration q such that φ(q) = y ∗
• Iff φ is invertible
q ∗ = φ-1 (y ∗ )
23/61
Inverse Kinematics as optimization problem
• We formalize the inverse kinematics problem as an optimization
problem
q ∗ = argmin ||φ(q) − y ∗ ||2C + ||q − q0 ||2W
q
24/61
Inverse Kinematics as optimization problem
25/61
Solving Inverse Kinematics
• The obvious choice of optimization method for this problem is
Gauss-Newton, using the Jacobian of φ
• We first describe just one step of this, which leads to the classical
equations for inverse kinematics using the local Jacobian...
26/61
Solution using the local linearization
• When using the local linearization of φ at q0 ,
φ(q) ≈ y0 + J (q − q0 ) , y0 = φ(q0 )
q ∗ = q0 + J ] (y ∗ − y0 )
∗
qt+1 = qt + J ] (yt+1 − φ(qt ))
∗
where the target yt+1 moves smoothly with t
28/61
Example: Iterating IK to follow a trajectory
• Assume initial posture q0 . We want to reach a desired endeff position
y ∗ in T steps:
29/61
Example: Iterating IK to follow a trajectory
• Assume initial posture q0 . We want to reach a desired endeff position
y ∗ in T steps:
• Why does this not follow the interpolated trajectory ŷ0:T exactly?
– What happens if T = 1 and y ∗ is far?
29/61
Two additional notes
• What if we linearize at some arbitrary q 0 instead of q0 ?
φ(q) ≈ y 0 + J (q − q 0 ) , y 0 = φ(q 0 )
q ∗ = argmin ||φ(q) − y ∗ ||2C + ||q − q 0 + (q 0 − q0 )||2W
q
= q 0 + J ] (y ∗ − y 0 ) + (I − J ] J) h , h = q0 − q 0 (1)
• What if we want to find the exact (local) optimum? E.g. what if we want
to compute a big step (where q ∗ will be remote from q) and we cannot
not rely only on the local linearization approximation?
– Iterate equation (1) (optionally with a step size < 1 to ensure
convergence) by setting the point y 0 of linearization to the current q ∗
– This is equivalent to the Gauss-Newton algorithm
30/61
Where are we?
• We’ve derived a basic motion generation principle in robotics from
– an understanding of robot geometry & kinematics
– a basic notion of optimality
31/61
Where are we?
• We’ve derived a basic motion generation principle in robotics from
– an understanding of robot geometry & kinematics
– a basic notion of optimality
• In the remainder:
A. Heuristic motion profiles for simple trajectory generation
B. Extension to multiple task variables
C. Discussion of classical concepts
– Singularity and singularity-robustness
– Nullspace, task/operational space, joint space
– “inverse kinematics” ↔ “motion rate control”
31/61
Heuristic motion profiles
32/61
Heuristic motion profiles
• Assume initially x = 0, ẋ = 0. After 1 second you want x = 1, ẋ = 0.
How do you move from x = 0 to x = 1 in one second?
MP : [0, 1] 7→ [0, 1]
xt = x0 + MP(t/T ) (xT − x0 )
• For example
MPramp (s) = s
1
MPsin (s) = [1 − cos(πs)]
2
34/61
Joint space interpolation
qt = q0 + MP(t/T ) (qT − q0 )
35/61
Task space interpolation
yt = y0 + MP(t/T ) (yT − y0 )
(As steps are small, we should be ok with just using this local linearization.)
36/61
peg-in-a-hole demo
37/61
Multiple tasks
38/61
Multiple tasks
39/61
Multiple tasks
RightHand
position
LeftHand
position
40/61
Multiple tasks
• Assume we have m simultaneous tasks; for each task i we have:
– a kinematic mapping yi = φi (q) ∈ Rdi
– a current value yi,t = φi (qt )
– a desired value yi∗
– a precision %i (implying a task cost metric Ci = %i I)
41/61
Multiple tasks
• Assume we have m simultaneous tasks; for each task i we have:
– a kinematic mapping yi = φi (q) ∈ Rdi
– a current value yi,t = φi (qt )
– a desired value yi∗
– a precision %i (implying a task cost metric Ci = %i I)
q ∗ = argmin ||q − q0 ||2W + %1 ||φ1 (q) − y1∗ ||2 + %2 ||φ2 (q) − y2∗ ||2 + · · ·
q
41/61
Multiple tasks
• Assume we have m simultaneous tasks; for each task i we have:
– a kinematic mapping yi = φi (q) ∈ Rdi
– a current value yi,t = φi (qt )
– a desired value yi∗
– a precision %i (implying a task cost metric Ci = %i I)
q ∗ = argmin ||q − q0 ||2W + %1 ||φ1 (q) − y1∗ ||2 + %2 ||φ2 (q) − y2∗ ||2 + · · ·
q
√ 1 1
41/61
Multiple tasks
• We can “pack” together all tasks in one “big task” Φ.
Example: We want to control the 3D position of the left hand and of the right
hand. Both are “packed” to one 6-dimensional task vector which becomes zero
if both tasks are fulfilled.
∂Φ(q0 )
• Using the local linearization of Φ at q0 , J = ∂q , the optimum is
42/61
Multiple tasks
43/61
Hierarchical IK & nullspace motion
• In the classical view, tasks should be executed exactly, which means taking the
limit %i → ∞ in some prespecified hierarchical order.
• We can rewrite the solution in a way that allows for such a hierarchical limit:
• One task plus “nullspace motion”:
c = W + %1 J>
W 1 J1 ,
c -1 (W a + %1 J>
â = W # #
1 y1 ) = J1 y1 + (I − J1 J1 )a
• etc... 44/61
Hierarchical IK & nullspace motion
• The previous slide did nothing but rewrite the nice solution
q ∗ = −J # Φ(q0 ) (for the “big” Φ) in a strange hierarchical way that
allows to “see” nullspace projection
• The benefit of this hierarchical way to write the solution is that one can
take the hierarchical limit %i → ∞ and retrieve classical hierarchical IK
45/61
What are interesting task variables?
46/61
Position
Position of some point attached to link i
dimension d=3
parameters link index i, point offset v
kin. map φpos
iv (q) = TW i v
pos
Jacobian Jiv (q)·k = [k ≺ i] ak × (φpos
iv (q) − pk )
Notation:
– ak , pk are axis and position of joint k
– [k ≺ i] indicates whether joint k is between root and link i
– J·k is the kth column of J
47/61
Vector
Vector attached to link i
dimension d=3
parameters link index i, attached vector v
kin. map φvec
iv (q) = RW i v
vec
Jacobian Jiv (q) = Ai × φvec
iv (q)
Notation:
– Ai is a matrix with columns (Ai )·k = [k ≺ i] ak containing the joint axes or
zeros
– the short notation “A × p” means that each column in A takes the
cross-product with p.
48/61
Relative position
Position of a point on link i relative to point on link j
dimension d=3
parameters link indices i, j, point offset v in i and w in j
kin. map φpos -1 pos pos
iv|jw (q) = Rj (φiv − φjw )
pos pos pos
Jacobian Jiv|jw (q) = Rj-1 [Jiv − Jjw − Aj × (φpos pos
iv − φjw )]
Derivation:
For y = Rp the derivative w.r.t. a rotation around axis a is
y 0 = Rp0 + R0 p = Rp0 + a × Rp. For y = R-1 p the derivative is
y 0 = R-1 p0 − R-1 (R0 )R-1 p = R-1 (p0 − a × p). (For details see
http://ipvs.informatik.uni-stuttgart.de/mlr/marc/notes/3d-geometry.pdf)
49/61
Relative vector
Vector attached to link i relative to link j
dimension d=3
parameters link indices i, j, attached vector v in i
kin. map φvec -1 vec
iv|j (q) = Rj φiv
vec
Jacobian Jiv|j (q) = Rj-1 [Jiv
vec
− Aj × φvec
iv ]
50/61
Alignment
Alignment of a vector attached to link i with a reference v ∗
dimension d=1
parameters link index i, attached vector v, world reference v ∗
align
kin. map φiv (q) = v ∗> φvec
iv
align
Jacobian Jiv (q) = v ∗> Jiv
vec
51/61
Relative Alignment
Alignment a vector attached to link i with vector attached to j
dimension d=1
parameters link indices i, j, attached vectors v, w
align > vec
kin. map φiv|jw (q) = (φvec
jw ) φiv
align > vec vec> vec
Jacobian Jiv|jw (q) = (φvec
jw ) Jiv + φiv Jjw
52/61
Joint limits
Penetration of joint limits
dimension d=1
parameters joint limits qlow , qhi , margin m
1
Pn + +
kin. map φlimits (q) = m i=1 [m − qi + qlow ] + [m + qi − qhi ]
1 1
Jacobian Jlimits (q)1,i = − m [m−qi +qlow > 0]+ m [m+qi −qhi > 0]
53/61
Collision limits
Penetration of collision limits
dimension d=1
parameters margin m
1
PK
kin. map φcol (q) = m k=1 [m − |pak − pbk |]+
1
PK
Jacobian Jcol (q) = m k=1 [m − |pak − pbk | > 0]
pa −pb
(−Jppos pos > k
a + J b )
p
k
|pa −pb |
k k k k
54/61
Center of gravity
Center of gravity of the whole kinematic structure
dimension d=3
parameters (none)
φcog (q) = massi φpos
P
kin. map i ici
pos
J cog (q) =
P
Jacobian i massi Jic i
55/61
Homing
The joint angles themselves
dimension d=n
parameters (none)
kin. map φqitself (q) = q
Jacobian Jqitself (q) = In
Example: Set the target y ∗ = 0 and the precision % very low → this task
describes posture comfortness in terms of deviation from the joints’ zero
position. In the classical view, it induces “nullspace motion”.
56/61
Task variables – conclusions
57/61
Discussion of classical concepts
58/61
Singularity
• In general: A matrix J singular ⇐⇒ rank(J) < d
– rows of J are linearly dependent
– dimension of image is < d
– δy = Jδq ⇒ dimensions of δy limited
– Intuition: arm fully stretched
59/61
Singularity
• In general: A matrix J singular ⇐⇒ rank(J) < d
– rows of J are linearly dependent
– dimension of image is < d
– δy = Jδq ⇒ dimensions of δy limited
– Intuition: arm fully stretched
• Implications:
det(JJ>) = 0
→ pseudo-inverse J>(JJ>)-1 is ill-defined!
→ inverse kinematics δq = J>(JJ>)-1 δy computes “infinite” steps!
60/61
Null/task/operational/joint/configuration spaces
• The space of all q ∈ Rn is called joint/configuration space
The space of all y ∈ Rd is called task/operational space
Usually d < n, which is called redundancy
nullspace(y ∗ ) = {q | φ(q) = y ∗ }
61/61