Skip to content

Commit c4735df

Browse files
committed
diffik teleop proposal
1 parent 57eaea4 commit c4735df

File tree

3 files changed

+72
-32
lines changed

3 files changed

+72
-32
lines changed

book/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ <h1>Table of Contents</h1>
147147
<li>Adding velocity constraints</li>
148148
<li>Adding position and acceleration constraints</li>
149149
<li>Joint centering</li>
150+
<li>Tracking a desired pose</li>
150151
<li>Alternative formulations</li>
151152
</ul>
152153
<li><a href=pick.html#section11>Exercises</a></li>

book/pick.html

Lines changed: 68 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -522,43 +522,40 @@ <h1><a href="index.html" style="text-decoration:none;">Robotic Manipulation</a><
522522
frame $A$ expressed in frame $C$, ${}^A\omega^B_C \in \Re^3$ is the
523523
<i>angular velocity</i> (of frame $B$ measured in $A$ expressed in frame
524524
$C$), and ${}^A\text{v}^B_C \in \Re^3$ is the <i>translational velocity</i>
525-
(along with the same shorthands as for positions). The angular velocity is
526-
a 3D vector (with $w_x$, $w_y$, $w_z$ components); the magnitude of this
527-
vector represents the angular speed and the direction represents the
528-
(instantaneous) axis of rotation. It's tempting to think of it as the time
529-
derivatives of roll, pitch, and yaw, but that's not true; it can easily be
530-
converted into that representation through a <a
531-
href="https://drake.mit.edu/doxygen_cxx/classdrake_1_1multibody_1_1_multibody_plant.html#a7bb24fed19f16a76450eece1857b92dc">nonlinear
532-
change of coordinates</a>. Spatial velocities fit nicely into our spatial
533-
algebra:<ul>
525+
(along with the same shorthands as for positions). The angular velocity is a 3D
526+
vector (with $w_x$, $w_y$, $w_z$ components); the magnitude of this vector
527+
represents the angular speed and the direction represents the (instantaneous) axis
528+
of rotation. It's tempting to think of it as the time derivatives of roll, pitch,
529+
and yaw, but that's not true; it can easily be converted to (or from) that
530+
representation through a <a
531+
href="https://github.com/RobotLocomotion/drake/blob/d1a1d14b323c8a4a481a8d11fc8e9c527d63bf20/multibody/tree/rpy_ball_mobilizer.cc#L223">linear map</a>. Spatial velocities fit nicely into our spatial algebra:<ul>
534532
<li>Velocities add when they are expressed in the same frame: \begin{gather}
535-
{}^Av^B_F + {}^Bv^C_F = {}^Av^C_F, \qquad {}^A\omega^B_F + {}^B\omega^C_F =
536-
{}^A\omega^C_F,\end{gather} (especially for angular velocities, this <a
537-
href="#angular_velocity_addition">deserves to be verified</a>) and have the
538-
additive inverse, ${}^AV^C_F = - {}^CV^A_F,$.</li>
533+
{}^A\text{v}^B_F + {}^B\text{v}^C_F = {}^A\text{v}^C_F, \qquad {}^A\omega^B_F +
534+
{}^B\omega^C_F = {}^A\omega^C_F,\end{gather} (especially for angular velocities,
535+
this <a href="#angular_velocity_addition">deserves to be verified</a>) and have
536+
the additive inverse, ${}^AV^C_F = - {}^CV^A_F,$.</li>
539537
<li>Rotations can be used to change between the "expressed-in"
540538
frames: \begin{equation} {}^A\text{v}^B_G = {}^GR^F {}^A\text{v}^B_F,
541539
\qquad {}^A\omega^B_G = {}^GR^F {}^A\omega^B_F.\end{equation}
542540
</li>
543541
<li>Translational velocities compose across frames with:
544542
\begin{equation}{}^A\text{v}^C_F = {}^A\text{v}^B_F + {}^B\text{v}^C_F
545543
+ {}^A\omega^B_F \times {}^Bp^C_F.\end{equation}
546-
<details><summary>This can be derived in a few steps (click the triangle
547-
to expand)</summary><p>Differentiating $${}^Ap^C = {}^AX^B {}^Bp^C =
548-
{}^Ap^B + {}^AR^B {}^Bp^C,$$ yields \begin{align} {}^A\text{v}^C =&
549-
{}^A\text{v}^B + {}^A\dot{R}^B {}^Bp^C + {}^AR^B {}^B\text{v}^C \nonumber
550-
\\ =& {}^A\text{v}^B_A + {}^A\dot{R}^B {}^BR^A {}^Bp^C_A +
551-
{}^B\text{v}^C_A.\end{align} Allow me to write $\dot{R}R^{-1}$ for
552-
${}^A\dot{R}^B {}^BR^A$ (dropping the frames for a moment). It turns out
553-
that $\dot{R}R^{-1}$, is always a skew-symmetric matrix. To see this,
544+
<details><summary>This can be derived in a few steps (click the triangle to
545+
expand)</summary><p>Differentiating $${}^Ap^C = {}^AX^B {}^Bp^C = {}^Ap^B +
546+
{}^AR^B {}^Bp^C,$$ yields \begin{align} {}^A\text{v}^C =& {}^A\text{v}^B +
547+
{}^A\dot{R}^B {}^Bp^C + {}^AR^B {}^B\text{v}^C \nonumber \\ =& {}^A\text{v}^B_A +
548+
{}^A\dot{R}^B {}^BR^A {}^Bp^C_A + {}^B\text{v}^C_A.\end{align} Allow me to write
549+
$\dot{R}R^{-1}$ for ${}^A\dot{R}^B {}^BR^A$ (dropping the frames for a moment). It
550+
turns out that $\dot{R}R^{-1}$, is always a skew-symmetric matrix. To see this,
554551
differentiate $RR^T = I$ to get $$\dot{R}R^T + R\dot{R}^T = 0 \Rightarrow
555-
\dot{R}R^T = - R\dot{R}^T \Rightarrow \dot{R} R^T = - (\dot{R} R^T)^T,$$
556-
which is the definition of a skew-symmetric matrix. Any 3$\times$3
557-
skew-symmetric matrix can be parameterized by three numbers (we'll use
558-
the three-element vector $\omega$), and can be written as a cross
559-
product, so $\dot{R}R^Tp = \omega \times p.$</p> <p>Multiply the right
560-
and left sides by ${}^FR^A$ to change the expressed-in frame, and we have
561-
our result.</p></details></li>
552+
\dot{R}R^T = - R\dot{R}^T \Rightarrow \dot{R} R^T = - (\dot{R} R^T)^T,$$ which is
553+
the definition of a skew-symmetric matrix. Any 3$\times$3 skew-symmetric matrix
554+
can be parameterized by three numbers (for $\dot{R}R^T$ in particular, this is
555+
exactly our angular velocity vector, $\omega$), and can be written as a cross
556+
product, so $\dot{R}R^Tp = \omega \times p.$</p> <p>Multiply the right and left
557+
sides by ${}^FR^A$ to change the expressed-in frame, and we have our
558+
result.</p></details></li>
562559
<li>This reveals that additive inverse for translational velocities is
563560
not obtained by switching the reference and measured-in frames; it is
564561
slightly more complicated: \begin{equation}-{}^A\text{v}^B_F =
@@ -1259,6 +1256,20 @@ <h1><a href="index.html" style="text-decoration:none;">Robotic Manipulation</a><
12591256

12601257
</subsection>
12611258

1259+
<subsection><h1>Tracking a desired pose</h1>
1260+
1261+
<p>Sometimes it can be more natural to specify the goal for differential IK as
1262+
tracking a desired pose, ${}^AX^{G_d}$, rather than explicitly specifying the
1263+
desired spatial velocity. But we can naturally convert the pose command into a
1264+
spatial velocity command, ${}^AV^{G_d}_A.$ The translational component is simple
1265+
enough, we'll use $${}^Ap^{G_d}_A = {}^Ap^G_A + h {}^Av^{G}_A \quad \Rightarrow
1266+
\quad {}^A\text{v}^{G}_A = \frac{1}{h} \left({}^Ap^{G_d}_A - {}^Ap^G_A\right) =
1267+
\frac{1}{h}{}^Gp^{G_d}_A.$$ Similarly, for the angular velocity, we will choose
1268+
$${}^A\omega^{G}_A = \frac{1}{h} {}^GR^{G_d},$$ where ${}^GR^{G_d}$ is represented
1269+
in <a href="#axis-angle">axis-angle</a> form.</p>
1270+
1271+
</subsection>
1272+
12621273
<subsection><h1>Alternative formulations</h1>
12631274

12641275
<p>Once we have embraced the idea of solving a small optimization problem
@@ -1286,6 +1297,34 @@ <h1><a href="index.html" style="text-decoration:none;">Robotic Manipulation</a><
12861297
problem. So if it's not possible to move in the commanded direction,
12871298
then the robot will just stop.</p>
12881299

1300+
<p id="rpy_diffik">For teleop with human operators, coming to a complete stop when
1301+
one cannot move in exactly the commanded direction can be too restrictive -- the
1302+
operator feels like the robot gets "stuck" every time that the robot approaches a
1303+
constraint. For instance, imagine if we have a collision avoidance constraint
1304+
between the robot gripper and a table, and the operator wants to move the hand
1305+
along the table top. This would be effectively impossible given the strict
1306+
formulation. We have found that the following relaxation is more intuitive for the
1307+
operator:
1308+
<p>\begin{align} \max_{v_n, \alpha} \quad & \sum_i \alpha_i, \\ \subjto \quad &
1309+
J^G(q)v_n = E(q) \text{diag}(\alpha) E^{-1}(q) V^{G_d}, \nonumber \\ & 0 \le
1310+
\alpha_i \le 1, \nonumber \\ & \text{additional constraints}. \nonumber
1311+
\end{align} Here $E(q)$ is the <a
1312+
href="https://github.com/RobotLocomotion/drake/blob/d1a1d14b323c8a4a481a8d11fc8e9c527d63bf20/multibody/tree/rpy_ball_mobilizer.cc#L223">linear
1313+
map</a> from the derivative of the Euler angle representation (e.g.
1314+
$\frac{d}{dt}[roll, pitch, yaw, x, y, z]$) to the spatial velocity. Note that we
1315+
can avoid the $E^{-1}(q)$, which can become singular, by accepting the spatial
1316+
velocity command using the Euler angle derivatives. To someone familiar with
1317+
optimization, this looks a bit strange -- the diagonal matrix is a
1318+
<i>coordinate-dependent</i>
1319+
scaling of the velocity. But that is exactly the point -- for human operators is
1320+
it more intuitive to saturate the velocity commands component-wise in the
1321+
coordinates of x, y, z, roll, pitch, and yaw, typically specified in the robot's
1322+
base frame. When you're trying to slide the robot end-effector along the table
1323+
top, the velocity component going into the table will saturate, but the components
1324+
orthogonal the table need not saturate. For example, you won't ever see the
1325+
end-effector twist when you are commanding pure translation, and won't see the
1326+
end-effector translate when you are commanding a pure rotation.</p>
1327+
12891328
<todo>Updated block diagram</todo>
12901329

12911330
<example><h1>Drake's DifferentialInverseKinematics</h1>
@@ -1550,7 +1589,7 @@ <h1><a href="index.html" style="text-decoration:none;">Robotic Manipulation</a><
15501589
<ol type="a">
15511590
<li><i>Roll-Pitch-Yaw:</i> One way we can represent a rotation is with a set of "roll-pitch-yaw" angles $(r,p,y)$. Refer to Drake's <a href="https://drake.mit.edu/doxygen_cxx/classdrake_1_1math_1_1_roll_pitch_yaw.html">RollPitchYaw</a> class for conventions on the ordering of these individual angle rotations into a single rotation matrix. Given that $p=-\pi/2$, compute a rotation matrix in terms of $r$ and $y$. In the resulting matrix, how does a change in $r$ compare to a change in $y$? What does this tell us about "roll-pitch-yaw" as a representation for rotations?<br /><br />
15521591
Hint: Try simplifying your solution using the <a href="https://en.wikipedia.org/wiki/List_of_trigonometric_identities#Angle_sum_and_difference_identities">angle sum trigonometric identities</a> $$\sin(\alpha+\beta)=\sin\alpha\cos\beta+\cos\alpha\sin\beta$$ $$\cos(\alpha+\beta)=\cos\alpha\cos\beta-\sin\alpha\sin\beta$$.</li>
1553-
<li><i>Axis-Angle:</i> Consider an orientation obtained by rotating a right-handed coordinate frame about its z-axis by an angle of $\pi/2$ radians. This rotation would result in the positive x-axis pointing in the direction where the positive y-axis was pointing before rotation. One way to represent this rotation is with the axis-angles vector $(0,0,\pi/2)$. (Recall that the vector describes the axis about which the rotation occurs, and its magnitude is the angle of rotation). This representation is not unique. Find two other sets of axis-angles that would give the same rotation.</li>
1592+
<li id="axis-angle"><i>Axis-Angle:</i> Consider an orientation obtained by rotating a right-handed coordinate frame about its z-axis by an angle of $\pi/2$ radians. This rotation would result in the positive x-axis pointing in the direction where the positive y-axis was pointing before rotation. One way to represent this rotation is with the axis-angles vector $(0,0,\pi/2)$. (Recall that the vector describes the axis about which the rotation occurs, and its magnitude is the angle of rotation). This representation is not unique. Find two other sets of axis-angles that would give the same rotation.</li>
15541593
<li><i>Quaternion:</i> A unit quaternion is a set of four numbers $(w,x,y,z)$ such that $w^2+x^2+y^2+z^2=1$. Unit quaternions are an excellent way of representing orientations, since they don't suffer from singularities (unlike the roll-pitch-yaw and axis-angle representations). This makes them reliable for <a href="#pick_and_place_trajectory">interpolating orientations</a>, but unit quaternions still suffer from the "multiple representations" problem.<br /><br />
15551594
We can turn a unit quaternion $(w,x,y,z)$ into an axis-angle vector $(a_x,a_y,a_z)$ by computing $\theta=2\arccos(w)$, and then $$(a_x,a_y,a_z)=\left\{\begin{array}{ll} \displaystyle\frac{\theta}{\sin(\theta/2)}(x,y,z) & \theta\ne 0\\ (0,0,0) & \theta=0 \end{array}\right.$$ Show that for any unit quaternion $(w,x,y,z)$, $(-w,-x,-y,-z)$ represents the same orientation by converting to axis-angle form, and simplifying the resulting trigonometric expressions.<br /><br />
15561595
As it turns out, there are precisely two unit quaternions corresponding to each orientation!<br /><br />

book/spatial.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,9 @@ <h1><a href="index.html" style="text-decoration:none;">Robotic Manipulation</a><
126126
(along with the same shorthands as for positions). Spatial velocities fit nicely into our spatial
127127
algebra:<ul>
128128
<li>Velocities add when they are expressed in the same frame: \begin{gather}
129-
{}^Av^B_F + {}^Bv^C_F = {}^Av^C_F, \qquad {}^A\omega^B_F + {}^B\omega^C_F =
130-
{}^A\omega^C_F,\end{gather} and have the additive inverse, ${}^AV^C_F = -
131-
{}^CV^A_F,$.</li>
129+
{}^A\text{v}^B_F + {}^B\text{v}^C_F = {}^A\text{v}^C_F, \qquad {}^A\omega^B_F +
130+
{}^B\omega^C_F = {}^A\omega^C_F,\end{gather} and have the additive inverse,
131+
${}^AV^C_F = - {}^CV^A_F,$.</li>
132132
<li>Rotations can be used to change between the "expressed-in"
133133
frames: \begin{equation} {}^A\text{v}^B_G = {}^GR^F {}^A\text{v}^B_F,
134134
\qquad {}^A\omega^B_G = {}^GR^F {}^A\omega^B_F.\end{equation}

0 commit comments

Comments
 (0)