Beruflich Dokumente
Kultur Dokumente
Kinematics
Marc Toussaint
University of Stuttgart
Winter 2014/15
• 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/62
Basic motion generation problem
• Move all joints in a coordinated way so that the endeffector makes a
desired movement
3/62
Outline
• Kinematics: φ : q 7→ y
• Inverse Kinematics: y ∗ 7→ q ∗ = argminq ||φ(q) − y ∗ ||2C + ||q − q0 ||2W
• Basic motion heuristics: Motion profiles
4/62
Basic 3D geometry & notation
5/62
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/62
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/62
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 = TA→B xB =
=
0 1 1 1
9/62
Is TA→B forward or backward?
• TA→B describes the translation and rotation of frame B relative to A
That is, it describes the forward FRAME transformation (from A to B)
10/62
Composition of transforms
TW →C = TW →A TA→B TB→C
xW = TW →A TA→B TB→C xC 11/62
Kinematics
12/62
Kinematics
B eff
joint B'
transf.
A
relative
C'
A'
C eff.
offset
link
transf.
W
TW →eff (q) = TW →A TA→A0 (q) TA0 →B TB→B 0 (q) TB 0 →C TC→C 0 (q) TC 0 →eff
13/62
Joint types
• Joint transformations: TA→A0 (q) depends on q ∈ Rn
TW →eff (q) gives us the pose of the endeffector in the world frame
16/62
Kinematic Map
TW →eff (q) gives us the pose of the endeffector in the world frame
φ : q 7→ y
16/62
Kinematic Map
• The three most important examples for a kinematic map φ are
– A position v on the endeffector transformed to world coordinates:
φpos
eff,v (q) = TW →eff (q) v ∈ R3
φvec
eff,v (q) = RW →eff (q) v ∈ R3
φquat
eff (q) = RW →eff (q) ∈ R4
• See the technical reference later for more kinematic maps, especially
relative position, direction and quaternion maps.
17/62
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/62
Jacobian for a rotational degree of freedom
eff
axis
point
i-th joint
19/62
Jacobian for a rotational degree of freedom
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:
[an × (peff − pn )]
[a1 × (peff − p1 )]
[a2 × (peff − p2 )]
⇒ Vector Jacobian:
[an × aeff ]
[a1 × aeff ]
[a2 × aeff ]
pos
3×n vec
Jeff,v (q) = ∈R Jeff,v (q) = ∈ R3×n
..
.
..
.
20/62
Jacobian for general degrees of freedom
• Every degree of freedom qi generates (infinitesimally, at a given q)
– a rotation around axis ai at point pi
– and/or a translation along the axis bi
For instance:
– the DOF of a hinge joint just creates a rotation around ai at pi
– the DOF of a prismatic joint creates a translation along bi
– the DOF of a rolling cylinder creates rotation and translation
– the first DOF of a cylindrical joint generates a translation, its second DOF
a translation
• We can compute all Jacobians from knowing ai , pi and bi for all DOFs
(in the current configuration q ∈ Rn )
21/62
Inverse Kinematics
22/62
Inverse Kinematics problem
• Generally, the aim is to find a robot configuration q such that φ(q) = y ∗
• Iff φ is invertible
q ∗ = φ-1 (y ∗ )
23/62
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/62
Inverse Kinematics as optimization problem
25/62
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/62
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 )
with J ] = (J>CJ + W )-1 J>C = W -1 J>(JW -1 J> + C -1 )-1 (Woodbury identity)
∗
qt+1 = qt + J ] (yt+1 − φ(qt ))
∗
where the target yt+1 moves smoothly with t
28/62
Example: Iterating IK to follow a trajectory
• Assume initial posture q0 . We want to reach a desired endeff position
y ∗ in T steps:
29/62
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/62
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/62
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/62
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. Discussion of classical concepts
B. Heuristic motion profiles for simple trajectory generation
C. Extension to multiple task variables
31/62
Discussion of classical concepts
32/62
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
33/62
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!
34/62
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 ∗ }
• We have
= J δy + (I − J # J)a ,
#
J # = W -1 J>(JW -1 J> + C -1 )-1
35/62
Heuristic motion profiles
36/62
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
38/62
Joint space interpolation
qt = q0 + MP(t/T ) (qT − q0 )
39/62
Task space interpolation
yt = y0 + MP(t/T ) (yT − y0 )
(As steps are small, we should be ok with just using this local linearization.)
40/62
peg-in-a-hole demo
41/62
Multiple tasks
42/62
Multiple tasks
43/62
Multiple tasks
RightHand
position
LeftHand
position
44/62
Multiple tasks
• Assume we have m simultaneous tasks; for each task i we have:
– a kinematic map φi : Rn → Rdi
– a current value φi (qt )
– a desired value yi∗
– a precision %i (equiv. to a task cost metric Ci = %i I)
45/62
Multiple tasks
• Assume we have m simultaneous tasks; for each task i we have:
– a kinematic map φi : Rn → Rdi
– a current value φi (qt )
– a desired value yi∗
– a precision %i (equiv. to a task cost metric Ci = %i I)
q ∗ = argmin ||q − q0 ||2W + %1 ||φ1 (q) − y1∗ ||2 + %2 ||φ2 (q) − y2∗ ||2 + · · ·
q
45/62
Multiple tasks
• Assume we have m simultaneous tasks; for each task i we have:
– a kinematic map φi : Rn → Rdi
– a current value φi (qt )
– a desired value yi∗
– a precision %i (equiv. to 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
45/62
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
46/62
Multiple tasks
47/62
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”:
= J1# y1 + (I − J1# J1 )a
J1# = (W/%1 + J> -1 > -1 > -1 >
1 J1 ) J1 = W J1 (J1 W J1 + I/%1 )
-1
• etc...
48/62
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
49/62
Reference: interesting task variables
50/62
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
51/62
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.
52/62
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)
53/62
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 ]
54/62
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
55/62
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
56/62
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]
57/62
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
58/62
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
59/62
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”.
60/62
Task variables – conclusions
61/62
• Technical Reference: The four rotation axes of a quaternion joint:
A quaternion joint has four DOFs. If it is currently in configuration q ∈ R4 , the ith DOFs
generates (infinitesimally) a rotation around the axis
−2
ai = p [ei ◦ q -1 ]1:3
q2
where ei ∈ R4 is the ith unit vector, ◦ is the concatenation of quaternions, q -1 the inverse
quaternion, q 2 the quaternion 2-norm (in case it is not normalized), and [·]1:3 pics the
vector elements of the quaternion (derivation: see geometry notes). As for the hinge
joint, these four axes are further transformed to world coordinates, ai ← RW →j ai , if the
quaternion joint is located in the coordinate frame j.
62/62