%
%  2004/Lecture notes/Lecture8/lecture8.tex
%
\documentclass[pdf,mmoll,slideColor%,colorBG
]{prosper}
\RequirePackage{color}

\usepackage[T1]{fontenc}
\usepackage{amsmath,amssymb,natbib}
%\usepackage[T1,noTS1]{mathtime}
\SetMathAlphabet{\mathbf}{normal}{\encodingdefault}{ptm}{b}{n}
\usepackage{subfigure}
\usepackage{rotating}
\usepackage{graphicx}
%\usepackage[dvips]{color}
\usepackage{epsfig}
\graphicspath{{../figs/}}

\newcommand{\ee}{\end{equation}} 
\newcommand{\be}{\begin{equation}} 
\newcommand{\ec}{\end{center}} 
\newcommand{\bc}{\begin{center}} 
\newcommand{\eea}{\end{eqnarray}} 
\newcommand{\bea}{\begin{eqnarray}} 
%\newcommand{\sumprime}{\mathop{{\sum}'}} 
\newcommand{\bd}{\begin{description}} 
\newcommand{\ed}{\end{description}} 
\newcommand{\bi}{\begin{itemize}} 
\newcommand{\ei}{\end{itemize}} 
\newcommand{\pa}{\partial} 
\newcommand{\hor}{\left(\frac{h}{R_0}\right)} 

\newcommand{\code}[0]{\ttfamily}
\newcommand{\co}[0]{\hbox{c}}
\newcommand{\si}[0]{\hbox{s}}
\newcommand{\pprime}[0]{\prime\prime}
\newcommand{\ppprime}[0]{\prime\prime\prime}
\newcommand{\conv}{\operatorname{conv}}
\newcommand{\pos}{\operatorname{pos}}
\newcommand{\lin}{\operatorname{lin}}
\newcommand{\vertop}{\operatorname{vert}}
\newcommand{\spanop}{\operatorname{span}}
\newcommand{\supp}{\operatorname{supp}}
\newcommand{\intoper}{\operatorname{int}}
\newcommand{\half}{\operatorname{half}}
\newcommand{\rad}{\operatorname{rad}}
\newcommand{\diam}{\operatorname{diam}}
\newcommand{\push}{\operatorname{push}}
\newcommand{\sqz}{\operatorname{sqz}}
\newcommand{\sgn}{\operatorname{sgn}}
%\renewcommand{\Re}{\Bbb{R}}
\renewcommand{\Re}{\mathbf{R}}
\newcommand{\vv}[1]{\mathbf{#1}}
\newcommand{\uu}[1]{\hat {\vv #1}}
\newcommand{\defterm}[1]{\textbf{#1}}
\newcommand{\rot}{\operatorname{rot}}

\newcommand{\btimes}{\times}
\newcommand{\bomega}{\omega}

 
\newcommand{\bis}{\begin{itemstep}} 
\newcommand{\eis}{\end{itemstep}} 

\makeatletter
\define@key{PDF}{Movie}{\pdf@addtoks{#1}{Movie}}
\define@key{PDF}{Activation}{\pdf@addtoks{#1}{Activation}}
\newcommand{\moviewithpreview}[3]{% args: width, preview, movie
   \pdfmark[{\includegraphics[width=#1]{#2}}]{%
   pdfmark=/ANN,Subtype=/Movie,Movie=<< /F (#3) >>,%
   Activation=<< /ShowControls true /Mode /Repeat >>}}
\newcommand{\movie}[3]{% args:width, height, movie
   \pdfmark[{\hbox to #1 {\vbox to #2 { }}}]{%
   pdfmark=/ANN,Subtype=/Movie,Movie=<< /F (#3) /Poster true >>,%
   Activation=<< /ShowControls true /Mode /Repeat >>}}
\makeatother

\title{8.  Representing displacements}
\subtitle{ Mechanics of Manipulation}
\author{Matt Mason}
\institution{Carnegie Mellon}
\email{matt.mason@cs.cmu.edu \\
http://www.cs.cmu.edu/\symbol{"7E}mason}
\slideCaption{Lecture 8. \hfill Mechanics of Manipulation }

\begin{document}

\maketitle


%=======================================================================
%
% SLIDE 2
%

\begin{slide}[R]{Lecture 8.  Representing displacements.}
\vspace{-0.5in}
\includegraphics[height=3.0in]{TOC8}
\end{slide}

%=======================================================================
%
% SLIDE 3
%
%

\begin{slide}[R]{Outline.}

\begin{itemize}
\item Review of spatial displacements
\item Homogeneous coordinates
\item Pl\"ucker coordinates of a line
\item Screw coordinates
\end{itemize}

\end{slide}


%=======================================================================
%
% SLIDE 4
%
%
\begin{slide}[R]{Review of spatial displacements}
\begin{itemize}
\item[]  Definition:  rigid motion
\item[]  Theorem 2.2:  any displacement of $\mathbf{E}^n$ can be represented as a rotation composed with a translation.
\item[]  Definition:  a \defterm{screw} is a line plus a pitch.
\item[]  Definition:  a \defterm{twist} is a motion along a screw.
\item[]  Theorem 2.7 (Chasles's theorem):  every displacement of $\mathbf{E}^3$ is a twist.
\end{itemize}

These can guide design of representations.
\end{slide}  

%=======================================================================
%
% SLIDE 5
%
%
\begin{slide}[R]{Homogeneous coordinates}
Recall theorem~2.2: a displacement can be decomposed into a 
rotation followed by a translation.
\begin{equation*}
        \vv x^\prime = R \vv x + \vv d
\end{equation*}
We can write it more compactly.  Add a fourth component to points:

\begin{equation*}
 \vv x = \left(\begin{array}{c} x_1 \\ x_2 \\ x_3 \\ 1 \\ \end{array}\right)
\end{equation*}
(Remember, we did this before.  If the fourth element is $0$ we get points
at infinity.  Now we're focusing on ordinary points.)
\end{slide}

%=======================================================================
%
% SLIDE 6
%
%
\begin{slide}[R]{Transforms using homogeneous coords}
Define the \emph{homogeneous coordinate transform matrix} $T$:
\begin{equation*}
        T = \left(\begin{array}{ccc|c}
         & & & \\
         \multicolumn{3}{c|}{R} & \vv d \\
         & & & \\
         \cline{1 - 3} \cline{4 - 4}
         & & & \\
         0 & 0 & 0 & 1 \\
        \end{array} \right)
\end{equation*}
And write
\begin{equation*}
        \vv x^\prime = T \vv x
\end{equation*}
It's just a more compact way of writing:
\begin{equation*}
        \vv x^\prime = R \vv x + \vv d
\end{equation*}
Especially useful for expressions such as $\vv x^\prime = T_3 T_2 T_1 \vv x$.

\end{slide}

%=======================================================================
%
% SLIDE 7
%
%
\begin{slide}[R]{Pl\"ucker coordinates}
\begin{minipage}[t]{6cm}
\begin{trivlist}
\item[]Screw coordinates are built on top of Pl\"ucker coordinates,
which are a way of representing lines.
\item[]Let $\vv p$ be a point on the line;
\item[]Let $\vv q$ be the \defterm{direction vector};
\item[]Let $\vv q_0 = \vv p \times \vv q$, the \defterm{moment vector};
\item[]Then $(\vv q, \vv q_0)$ gives the six \defterm{Pl\"ucker coordinates};
\item[](Note choice of $\vv p$ doesn't matter:
\begin{align*}
  \vv p^\prime \times \vv q 
  &= \vv p \times \vv q + (\vv p^\prime - \vv p) \times \vv q \\ 
  &= \vv p \times \vv q
\end{align*}
\end{trivlist}
\end{minipage}
\hfill
\begin{minipage}[t]{4cm}
\begin{figure}[h!]
\includegraphics[width=4cm]{plucker}
\end{figure}
\end{minipage}
\end{slide}

%=======================================================================
%
% SLIDE 8
%
%
\begin{slide}[R]{Pl\"ucker's excess numbers}
\begin{trivlist}
  \item[]  Pl\"ucker coordinates give six numbers.  A line requires only
    four.  
  \item[] First, since $\vv q_0 = \vv p \times \vv q$, there is a
    constraint:
    \begin{equation*}
      \vv q \cdot \vv q_0 = 0 
    \end{equation*} 
  \item[] Second, scaling gives same the line
    \begin{equation*}
      (\vv q, \vv q_0) \equiv k (\vv q, \vv q_0)
    \end{equation*}
  \item[] (So, why not normalize, scaling by $1/|\vv q|$?  Sometimes, as
    we shall see, $|\vv q| = 0$!) 
\end{trivlist}
\end{slide}

%=======================================================================
%
% SLIDE 9
%
%
\begin{slide}[R]{Reading Pl\"ucker coordinates:  generic case}
\begin{minipage}[t]{6cm}
\begin{trivlist}
\item[]Nonzero $\vv q_0$ is orthogonal to a plane containing the line.
\item[]Magnitude $|\vv q_0| / |\vv q|$ gives distance to line.
\end{trivlist}
\end{minipage}
\hfill
\begin{minipage}[t]{4cm}
\begin{figure}[h!]
\includegraphics[width=4cm]{pluckgen}
\end{figure}
\end{minipage}
\end{slide}

%=======================================================================
%
% SLIDE 10
%
%
\begin{slide}[R]{Pl\"ucker coords of line through origin}
\begin{minipage}[t]{6cm}
\begin{trivlist}
\item[]Zero $\vv q_0$:  Line passes through origin.
\end{trivlist}
\end{minipage}
\hfill
\begin{minipage}[t]{4cm}
\begin{figure}[h!]
\includegraphics[width=4cm]{pluckori}
\end{figure}
\end{minipage}
\end{slide}

%=======================================================================
%
% SLIDE 11
%
%
\begin{slide}[R]{Pl\"ucker coords of line at infinity}
\begin{minipage}[t]{6cm}
  \begin{trivlist}
  \item[]Nonzero $\vv q_0$ is orthogonal to a plane containing the line.
  \item[]Magnitude of $|\vv q_0| / |\vv q|$ gives distance to line.
  \item[]Work it out as a limiting process.  Hold $\vv q_0$ constant
  as line goes to infinity. 
\end{trivlist} 
\end{minipage}
\hfill
\begin{minipage}[t]{4cm}
\begin{figure}[h!]
\vspace*{-1.5cm}
\includegraphics[width=4cm]{pluckinf}
\includegraphics[width=4cm]{plucklim}
\end{figure}
\end{minipage}
\end{slide}

%=======================================================================
%
% SLIDE 12
%
%
\begin{slide}[R]{Using Pl\"ucker coordinates}
  \begin{trivlist}
  \item[]Direction of line :  $\vv q$.  
  \item[] Distance of line from $O$:  $|\vv q_0| / |\vv q|$.
  \item[]Point-on-line test for point $x$:
    \begin{align*}
      (\vv x - \vv p) \times \vv q &= 0\\
      \vv x \times \vv q - \vv p \times \vv q &=0 \\
      \vv x \times \vv q &= \vv q_0
    \end{align*}
  \item[]Find point on line closest to $O$:
    \[
    \vv q \times \vv q_0 / \vv q \cdot \vv q, 
    \quad\mbox{for} \,  \vv q \neq 0 
    \]
  \end{trivlist}
\end{slide}

%
\begin{slide}[R]{A topical example.}
\includegraphics[width=10cm]{galvez}
\end{slide}

%=======================================================================
%
% SLIDE 13
%
%
\begin{slide}[R]{Moment about a point}
\begin{minipage}[t]{6cm}
  \begin{trivlist}
  \item[]Moment of a line $l_2$ about a point $p_1$.  In analogy with
  unit force in direction $\vv q_2$.  What would the torque be? 
  \begin{align*}
    &(\vv p_2 - \vv p_1) \btimes \left(\frac{\vv q_2}{| \vv q_2 |}\right) \\
    &\frac{\vv p_2 \btimes \vv q_2 - \vv p_1 \btimes \vv q_2}{|\vv q_2|}\\
    &\frac{\vv q_{02} - \vv p_1 \btimes \vv q_2}{|\vv q_2|}
  \end{align*}
\end{trivlist}
\end{minipage}
\hfill
\begin{minipage}[t]{4cm}
\begin{figure}[h!]
\includegraphics[width=4cm]{pointmom}
\end{figure}
\end{minipage}

\end{slide}

%=======================================================================
%
% SLIDE 14
%
%
\begin{slide}[R]{Moment about a line}
\begin{minipage}[t]{6cm}
  \begin{trivlist}
  \item[]Moment of a line $l_2$ about a \emph{line} $l_1$.
  \item[]Think of the torque at $\vv p_1$, and take the component in
  the $\vv q_1$ direction: 
  \begin{align*}
    &\frac{\vv q_1}{| \vv q_1|} \cdot \frac{\vv q_{02}
      - \vv p_1 \btimes \vv q_2}{|\vv q_2|} \\
    &\frac{\vv q_1 \cdot \vv q_{02}
      - \vv q_1 \cdot \vv p_1 \btimes \vv q_2}{|\vv q_1 \vv q_2|} \\
    &\frac{\vv q_1 \cdot \vv q_{02}
      + \vv q_2 \cdot \vv p_1 \btimes \vv q_1}{|\vv q_1 \vv q_2|} \\
    &\frac{\vv q_1 \cdot \vv q_{02}
      + \vv q_2 \cdot \vv q_{01}}{|\vv q_1 \vv q_2|} 
  \end{align*}
  \item[]It's symmetric.  Moment of $l_1$ about $l_2$ = moment of $l_2$
    about $l_1$. 
  \item[]This interesting product has \emph{LOTS} of uses $\ldots$
  \end{trivlist}
\end{minipage}
\hfill
\begin{minipage}[t]{4cm}
\begin{figure}[h!]
\includegraphics[width=4cm]{linmom}
\end{figure}
\end{minipage}

\end{slide}

%=======================================================================
%
% SLIDE 15
%
%
\begin{slide}[R]{Reciprocal product / virtual product}
  \begin{trivlist}
  \item[]Define \defterm{reciprocal product}, or \defterm{virtual product}:
    \[
    (\vv q_1, \vv q_{01}) * (\vv q_2, \vv q_{02})
    = \vv q_1 \cdot \vv q_{02} + \vv q_2 \cdot \vv q_{01}
    \]
  \item[]For normalized Pl\"ucker coordinates, reciprocal product
  gives moment between the two lines. 
\end{trivlist}
\end{slide}

%=======================================================================
%
% SLIDE 16
%
%
\begin{slide}[R]{More uses for Pl\"ucker coordinates}
  \begin{trivlist}
  \item[]Look at moment geometrically.  Distance between the lines
  times sine of the angle. 
  \[
    d \sin\alpha = (\vv q_1, \vv q_{01})
    * (\vv q_2, \vv q_{02}) / |\vv q_1 \vv q_2|
    \]
  \item[]Note we can also get the angle by
    \[
    \sin\alpha = \vv q_1 \btimes \vv q_2 /|\vv q_1 \vv q_2|
    \]
  \item[]So to get the (signed) distance between two lines:
    \[
    d  = \frac{ (\vv q_1, \vv q_{01}) * (\vv q_2, \vv q_{02}) }{%
      | \vv q_2 \btimes \vv q_1 |}
    \]
  \item[]To tell if two lines intersect, check if reciprocal product
  is zero.  (Parallel lines intersect at infinity!)
\end{trivlist}
\end{slide}

%=======================================================================
%
% SLIDE 17
%
%
\begin{slide}[R]{Example:  using Pl\"ucker}
Find the angle and distance between the two lines:
\begin{figure}[h!]
\includegraphics{linex}
\end{figure}
\end{slide}

%=======================================================================
%
% SLIDE 18
%
%
\begin{slide}[R]{Screw coordinates}
  \begin{trivlist}
  \item[] A screw is a line plus a scalar pitch.  Seven numbers?
  \item[] No!  We aren't really using those six numbers.  Plenty of
    room to sneak pitch in.
  \item[]Given a line $(\vv q, \vv q_0)$, and pitch $p$.  Define the
    screw coordinates to be $(\vv s, \vv s_0)$, where
    \begin{align*}
      \vv s &= \vv q \\
      \vv s_0 &= \vv q_0 + p \vv q
    \end{align*}
  \item[]Why does this work?  Recall $\vv q \cdot \vv q_0$ is zero.
  \item[]To get the pitch back
    \begin{align*}
      \vv s \cdot \vv s_0 =& \vv q \cdot \vv q_0 + p \vv q \cdot \vv q \\
      p =& \frac{\vv s \cdot \vv s_0}{\vv s \cdot \vv s}
    \end{align*}
  \end{trivlist}
\end{slide}


%=======================================================================
%
% SLIDE 18 1/2
%
%
\begin{slide}[R]{Special case screws}
  \begin{trivlist}
  \item[]Zero pitch: just like Pl\"ucker coordinates.
  \item[]Infinite pitch:  $\vv s = 0$.
  \end{trivlist}
\end{slide}


%=======================================================================
%
% SLIDE 19
%
%
\begin{slide}[R]{Representing a twist}
  \begin{trivlist}
  \item[]A twist is a screw plus a magnitude.  Seven numbers?
  \item[]No!  Remember Pl\"ucker coordinates don't use scale.  So take
    Pl\"ucker coordinates, normalize them, and scale. 
  \item[]Let $\theta$ be the angle of rotation, $d$ the distance of
    translation, both nonzero.
  \item[]Let $p = d / \theta$ be the pitch.
    \begin{equation*}
      \left( \theta \, \frac{\vv s}{| \vv s |}, 
        \theta \, \frac{\vv s_0}{| \vv s |}\right)
    \end{equation*}
    Substituting the definition of screw coordinates, we obtain
    \begin{align*}
      \left( \theta \, \frac{\vv s}{| \vv s |}, \theta \, \frac{\vv
          s_0}{| \vv s |}\right) = & \frac{1}{|\vv q|}
      \left( \theta \vv q, \theta \vv q_0 + \theta p \vv q \right) \\
      = & \frac{1}{|\vv q|} \left( \theta \vv q, \theta \vv q_0 + d
        \vv q \right)
    \end{align*}
  \end{trivlist}
\end{slide}

%=======================================================================
%
% SLIDE 20
%
%
\begin{slide}[R]{Twists of zero or infinite pitch}
  \begin{trivlist}
  \item[] Infinite pitch is translation:
    \begin{equation*}
      \left( \vv s, \vv s_0 \right)
      = \frac{1}{|\vv q|} \left( \vv 0, d \vv q \right)
    \end{equation*}

  \item[] Zero pitch is rotation, identical to scaled Pl\"{u}cker coordinates: 
    \begin{equation*}
      \theta (\vv s, \vv s_0) = \theta (\vv q, \vv q_0).
    \end{equation*}
    assuming Pl\"ucker coordinates were normalized.

\end{trivlist}
\end{slide}

%=======================================================================
%
% SLIDE 20 1/2
%
%
\begin{slide}[R]{Twists of zero or infinite pitch}
  \begin{trivlist}
  \item[] Here is an interesting and instructive ambiguity.  Somebody
    gives you, for example, a twist with screw coordinates:
    \[
    (0,0,0, 1,0,0)
    \]
  \item[]  Is it a zero pitch screw with axis at infinity?  I.e. a
  rotation about an axis at infinity? 
  \item[]  Or is it an infinite pitch twist?  I.e. a translation in
    the $z$ direction? 
  \item[]  Both!
\end{trivlist}
\end{slide}


%=======================================================================
%
% SLIDE 21
%
%

\begin{slide}[R]{Consider the extremes}
  \begin{trivlist}
  \item[]Translation: infinite pitch.  $(\vv t, \vv t_0) = (0, \vv
    O^\prime)$.  A very nice way to represent a translation.

  \item[]Rotation through origin:  zero pitch.
    \begin{align*}
      (\vv t, \vv t_0) 
      &= \theta (\frac{\vv s}{|\vv s|}, \frac{\vv s_0}{|\vv s|}) \\
      &= \theta (\frac{\vv q}{|\vv q|}, \frac{\vv q_0}{|\vv q|})\\
      &= (\theta \uu n, 0 )
    \end{align*}
    Angle times axis.  We didn't cover it, but some people like it.
    Behaves well at small $\theta$, but doesn't extend to one-to-one
    smooth map.  Obviously.
  \end{trivlist}
\end{slide}

%=======================================================================
%
% SLIDE 22
%
%
\begin{slide}[R]{Differential twists}
\begin{minipage}[t]{8cm}
  \begin{trivlist}
  \item[]Consider velocity $v$ along $l$ and angular velocity $\omega$
    about $l$. 
  \item[]Let $\vv p$ be any point on $l$.  
  \item[]Pl\"{u}cker coordinates of $l$ are
    \begin{equation*}
      (\vv q, \vv q_0) = (\vv \bomega, \vv p \btimes \vv \bomega)
    \end{equation*}
  \item[]Pitch is $|\vv v| / |\vv \bomega|$ so screw coordinates are
    \begin{align*}
      (\vv s, \vv s_0) & = (\vv \bomega, \vv p \btimes \vv \bomega
      + \frac{|\vv v|}{|\bomega|} \vv \bomega)\\
      (\vv s, \vv s_0) &= (\vv \bomega, \vv p \btimes \vv \bomega +
      \vv v)
    \end{align*}
  \end{trivlist}
\end{minipage}
\hfill
\begin{minipage}[t]{2cm}
\begin{figure}[h!]
\includegraphics[width=2cm]{dtwist}
\end{figure}
\end{minipage}
\end{slide}

%=======================================================================
%
% SLIDE 22 1/2
%
%
\begin{slide}[R]{Differential twists}
\begin{minipage}[t]{8cm}
  \begin{trivlist}
  \item[]The vector $\vv s_0$ gives vel of origin $\vv v_0$ 
    \begin{equation*}
      (\vv s, \vv s_0) = (\vv \bomega, \vv v_0)
    \end{equation*}
  \item[]So, for differential twists, screw coords are close to
    standard practice. 
    
  \item[]Important corollary.  \emph{Screw coordinates for
      differential twists form a vector space.}  We can add
    differential twist screw coordinates, and we can multiply them by
    scalars.

  \end{trivlist}
\end{minipage}
\hfill
\begin{minipage}[t]{2cm}
\begin{figure}[h!]
\includegraphics[width=2cm]{dtwist}
\end{figure}
\end{minipage}
\end{slide}

%=======================================================================
%
% SLIDE last
%

\begin{slide}[R]{Next:  Representing constraints.}
\vspace{-0.5in}
\includegraphics[height=3.0in]{TOC9}
\end{slide}
\end{document}



\end{document}
