CHAPTER 1: Spatial description
§1.1 Description: position, orientation, and frames
Description: specify attributes of objects with which a manipulation
system deals. Objects are parts, tools, and the manipulator itself.
1. Description of position
    Once a coordinate system is established, locate any point in the
universe with a 3×1 position vector.
          px 
     P =  p y  =  px p y pz              P = px Xˆ A  p yYˆA  pz Zˆ A
   A                               T       A
                                       ,
          
          pz 
CHAPTER 1: Spatial description
§1.1 Description: position, orientation, and frames
 There are also other 3-tuple descriptions of position of points.
       r = px2  p 2y  pz2                    r = px2  p 2y
        arctan( p y / px )                    z  pz
         arctan( pz / px2  p 2y )             arctan( p y / px )
       px = r cos  cos                        p x = r cos 
       p y  r cos  sin                       p y  r sin 
       pz  r sin                              pz  z
                        Spherical          Cylindrical
 CHAPTER 1: Spatial description
 §1.1 Description: position, orientation, and frames
2. Description of orientation
   Attach a coordinate system, {B}, to the body, give a description of this
coordinate system relative to the reference system, {A}.
One way: write unit vectors of three principal axes of {B} in terms of the {A}.
Rotation matrix: Stack three unit vectors together as the columns of a 3×3
matrix.
                                  r11 r12    r13 
                 A ˆ A ˆ A ˆ  
           B R   X B YB Z B   r21
           A
                                        r22   r23 
                                                 
                                  r31 r32   r33 
rij : components of any vector, the projections of
    that vector onto the unit directions of its
    reference frame.
  CHAPTER 1: Spatial description
  §1.1 Description: position, orientation, and frames
                                      A
   Each component of                  B   R can be written as dot product of a pair of unit
vectors:
                           Xˆ B  Xˆ A YˆB  Xˆ A   Zˆ B  Xˆ A  cos( Xˆ B , Xˆ A ) cos(YˆB , Xˆ A ) cos( Zˆ B , Xˆ A ) 
         A ˆ A ˆ A ˆ
                                                                                                                         
                       Xˆ B  YˆA YˆB  YˆA      Zˆ B  YˆA    cos( Xˆ B ,YˆA ) cos(YˆB ,YˆA ) cos( Zˆ B ,YˆA ) 
 A
 B R      X
        B B  Y   Z  B
                           ˆ ˆ          ˆ ˆ                                                                              
                           X B  Z A YB  Z A       Zˆ B  Zˆ A   cos( Xˆ B , Zˆ A ) cos(YˆB , Zˆ A ) cos( Zˆ B , Zˆ A ) 
   Dot product of two unit vectors yields the cosine of the angle between
them, rotation matrices are often referred to as direction cosines.
E.g.: Basic rotation matrix (Elementary Rotations)
             1    0        0                    cos          0 sin                cos                  sin     0
R( X ,  )  0 cos      sin   , R(Y ,  )   0             1   0  , R( Z ,  )   sin                cos       0
                                                                                                                      
             0 sin    cos                    sin       0 cos                0                     0       1 
CHAPTER 1: Spatial description
§1.1 Description: position, orientation, and frames
                 A
   Rows of the B R are the unit vectors of {A} expressed in {B}. Hence, AB R ,
description of {A} relative to {B}, is given by transpose of rotation matrix.
                               B Xˆ AT 
               A ˆ A ˆ A ˆ
                              B T                       T
                                 ˆ       B ˆ B ˆ B ˆ
                                                        
       B R   X B YB Z B    YA    X A YA Z A   A R                        R  BA RT
       A                                                    B T                B
                                                                           ,   A
                              B ˆT 
                               Z A 
  From linear algebra, inverse of a matrix with orthonormal columns is
equal to its transpose:
                        A Xˆ BT 
                       A T  A
                       YˆB   Xˆ B YˆB Zˆ B   I 3         R  AB R 1  AB RT
             A T A                     A   A                  A
             B R B R                                          B
                       A ˆT 
                        Z B 
                         SO(3)  {R  R 33 | RRT  I ,det( R)  1}
 CHAPTER 1: Spatial description
 §1.1 Description: position, orientation, and frames
3. Description of frame
   Information needed to completely specify whereabouts of manipulator
hand is a position and an orientation. Situation of a position and an
orientation pair arises so often that define an entity called a frame.
E.g.: {B} is described relative to {A}   {B}  { BA R , A PBORG }
Graphical representation: An arrow is drawn from one origin to another,
represents the position of origin at head of arrow in terms of frame at tail of
arrow.
 CHAPTER 1: Spatial description
 §1.2 Mappings: changing description
   Change descriptions from frame to frame: express same quantity in
terms of various reference coordinate systems.
1. Mappings involving translated frames
   A position defined by a vector B P . We wish to
express the point in space in terms of {A}, A P ,
when {A} has the same orientation as {B}.
                   A
                       P  B P  A PBORG
2. Mappings involving rotated frames
    Origins of two frame {A}, {B} are coincident.
Know definition of a vector w.r.t {B}, B P , and
rotation matrix BA R , its definition w.r.t {A}, A P :
                        A
                            P  BA R B P
CHAPTER 1: Spatial description
§1.2 Mappings: changing description
    Computation is possible when description of orientation of {B} is known
                 A
relative to {A}, B R . Components of A P may be calculated as:
       A
         px = B Xˆ A  B P  B Xˆ AT B P                     A px   B Xˆ A  B P   B Xˆ AT 
                                                             A   B ˆ B   B ˆT  B
         p = BYˆ  B P  BYˆ T B P                     P   py  =  YA  P    YA  P  BA R B P
       A                                              A
            y       A             A
                                                             A  B ˆ B  B ˆT 
           pz = B Zˆ A  B P  B Zˆ AT B P                   pz   Z A  P   Z A 
       A
E.g.: {B} is rotated relative to {A} about Ẑ by 30 degrees.
          cos          sin     0 0.866 0.500 0.000
                                  0  0.500 0.866 0.000
    B R   sin        cos 
    A
                                                         
           0            0        1 0.000 0.000 1.000 
                  0.0                                 1.000
            B
              P   2.0             A
                                        P  BA R B P   1.732 
                                                             
                  0.0                               0.000 
 CHAPTER 1: Spatial description
 §1.2 Mappings: changing description
3. Mappings involving general frames
  – Origin of {B} is not coincident with that of {A}, has a general vector
            A
    offset, PBORG .
  – {B} is rotated w.r.t {A}, BA R .
                    B
   First change P to its description relative to an intermediate frame that
has same orientation as {A}, but whose origin in coincident with the origin
of {B}. Then account for the translation between origins by simple vector
addition.                A
                           P  BA R B P  A PBORG
4. Homogeneous transform
    Define a 4×4 matrix operator and use
4×1 position vectors:
    A P   BA R       A
                            PBORG   B P 
                                              P  ABT B P
                                              A
                                    ,
    1  0 0 0              1  1 
 CHAPTER 1: Spatial description
 §1.2 Mappings: changing description
  This representation is conceptually clear, but is mainly for convenience
when thinking and writing equations down on paper, because of time
wasted multiplying ones and zeros.
               R t    44
                                              
                                             3
   SE (3)  T   T   R | R  SO(3), t  R 
               0 1                        
E.g.: {B} is rotated relative to {A} about Zˆ A by 30 degrees, translated 10
units in Xˆ A , and 5 unit in YˆA . Find A P , where B P  [3.0 7.0 0.0]T .
       0.866  0.500 0.000 10.0
       0.500                                              9.098 
                0.866 0.000 5.0 
  BT 
                                          P  ABT B P  12.562 
  A                                       A
       0.000   0.000 1.000 0.0                                   
                                                         0.000 
        0        0     0    1 
 CHAPTER 1: Spatial description
 §1.3 Transformation arithmetic
1. Compound transformation
                                                                                             C
    {C} is known relative to {B}, and {B} is known relative to {A}, we have                      P
                  A
 and wish to find P .
General transform:            B
                                P  BRCP  BP    C             CORG
                         A
                             P  BA R B P  A PBORG  BA R( CB R C P  B PCORG )  A PBORG
                                ( BA R CB R) C P  ( BA R B PCORG  A PBORG )
Homogeneous transform:
            B
                P  CBT C P
            A
                P  ABT B P  ABT CBT C P  CAT C P
            T  ABT CBT
            A
            C
      BA R CB R                A
                                    R B PCORG  A PBORG 
 A
 CT                           B
                                                        
     0    0     0                         1            
CHAPTER 1: Spatial description
§1.3 Transformation arithmetic
2. Inverting transform
                                          A
   {B} is known with respect to a {A}, B T , inverting transform to get a
                                    B
description of {A} relative to {B}, A T .
                                         AB R        B
                                                          PAORG 
                                    B
                                    AT                        
                                        0 0 0             1 
 – First, recall from discussion of rotation matrices:                        B
                                                                              A   R  BA RT
                                     A
 – Next, change the description of PBORG into {B}:
       ( PBORG )  AB R A PBORG  B PAORG
      B A
                                                B
                                                     PAORG   AB R A PBORG   BART APBORG
                                    BA RT        BA RT A PBORG 
                               B
                               AT                              
                                   0 0 0             1          
Note that, with our notation: BAT  ABT 1
But the orthogonal property does not hold good:                       B
                                                                      AT 1  BAT T
CHAPTER 1: Spatial description
§1.3 Transformation arithmetic
E.g.: {B} is rotated relative to {A} about Ẑ by 30 degrees and translated
four units in Xˆ and three units in Yˆ . Find Τ .
                                                B                         A
               A                      A       A                           BT
         0.866  0.500 0.000 4.0
         0.500   0.866 0.000 3.0
    BT 
    A                            
         0.000   0.000 1.000 0.0 
                                 
         0       0      0    1 
         BA RT  BA RT A PBORG 
    B
    AT                        
        0 0 0        1         
         0.866 0.500 0.000  4.964 
         0.500 0.866 0.000  0.598
                                    
         0.000 0.000 1.000       0.0 
                                     
           0      0         0    1   
CHAPTER 1: Spatial description
§1.3 Transformation arithmetic
3. Transform equations
   {D} can be expressed as products of transformations in two different
ways:
                   U
                    T  UAT DAT
                   D
                                               T DAT  UBT CBT CDT
                                                U
                                                A
                   U
                   DT  UBT CBT CDT
In case that all transforms are known except CBT : have one transform
equation and one unknown transform.
                   B
                   CT  UBT 1 UAT DAT CDT 1
   Transform equations can be used to
solve for transforms in the case of n
unknown transforms and n transform
equations.
CHAPTER 1: Spatial description
§1.3 Transformation arithmetic
E.g.: know the transform TB T , and where the tabletop is located in space
                                      B
relative to the manipulator’s base, S T , and the location of frame attached
                                                             S
to the bolt lying on the table relative to the table frame, G T . Calculate
position and orientation of the bolt relative to hand, GT T .
                    B
                    TT GTT  BST GST      T  BTT 1 BST GST
                                           T
                                           G
 CHAPTER 1: Spatial description
 §1.4 More on representation of orientation
   Nine elements of rotation matrix are not all independent.
 – Each is a unit vector   Xˆ  1 , Yˆ  1 , Zˆ  1
 – All three must be mutually perpendicular Xˆ  Yˆ  0 , Xˆ  Zˆ  0 , Yˆ  Zˆ  0
Problem: whether representations of orientation can be conveniently
specified with three parameters?
Cayley’s formula: for any proper orthonormal matrix, there exists a skew-
symmetric matrix ( S   S ) such that:
                          T
                                                  0        Sz   Sy 
                                                                     
              R  ( I3  S )1 ( I 3  S )   S   Sz        0    Sx 
                                                   S y   Sx     0 
  An immediate consequence is that any 3×3 rotation matrix can be
specified by just three parameters.
 CHAPTER 1: Spatial description
 §1.4 More on representation of orientation
1. X-Y-Z fixed angles
   Orientation of a frame {B} as follow: Start with the frame coincident with
a known reference frame {A}. Rotate {B} first about Xˆ A by an angle  , then
about YˆA by an angle  , and, finally, about Zˆ A by an angle  .
   This convention is referred to as roll, pitch, yaw angles.
                          c  s 0  c 0 s  1 0          0 
                             c 0  0        1 0  0 c      s 
   B RXYZ ( ,  ,  )   s
   A
                                                                
                          0  0 1    s 0 c  0 s   c 
      c c c s c  s c c s c  s s 
     s c s s s  c c s s c  c s 
                                                
       s            c s            c c   
   Keep in mind that the order of the
three rotations.
CHAPTER 1: Spatial description
§1.4 More on representation of orientation
E.g.: rotations don’t generally commute.
              1.000 0.000 0.000                     0.866 0.500 0.000
  RX (30.0)  0.000 0.866 0.500        RZ (30.0)  0.500 0.866 0.000
                                                                       
              0.000 0.500 0.866                   0.000 0.000 1.000 
                           0.87 0.43 0.25 
     RZ (30.0) RX (30.0)  0.50 0.75 0.43
                                             
                            0.00 0.50 0.87 
                                                    RX RZ  RZ RX
                            0.87 0.50 0.00 
     RX (30.0) RZ (30.0)   0.43 0.75 0.5
                                             
                             0.25 0.43 0.87 
 CHAPTER 1: Spatial description
 §1.4 More on representation of orientation
Inverse problem: extracting equivalent three fixed angles from a rotation
matrix.
Transcendental equations: there are nine equations and three unknowns if
equation is equated to a given rotation matrix.
                        c c     c s c  s c       c s c  s s   r11 r12     r13 
  A
    R   ( ,  ,  )   s c     s s s  c c       s s c  c s    r21 r22   r23 
  B XYZ                                                                                     
                         s          c s                  c c         r31 r32   r33 
                                   A tan 2(r31 ,  r112  r212 )
                                   A tan 2(r21 / c , r11 / c )
                                   A tan 2(r32 / c , r33 / c )
   Atan2(x,y) use the signs of both x and y to identify the quadrant in which
the resulting angle lies.
 CHAPTER 1: Spatial description
 §1.4 More on representation of orientation
2. Z-Y-X Euler angles
   Orientation of a frame {B} as follow: Start with the frame coincident with
a known reference frame {A}. Rotate {B} first about Zˆ B by an angle  , then
about YˆB by an angle  , finally, about Xˆ B by an angle  .
                                              c  s 0  c         0 s  1 0        0 
                                                     c 0  0        1 0  0 c        s 
      B RZ'Y'X'  RZ ( ) RY (  ) RX ( )   s
      A
                                                                                          
                                              0      0 1   s   0 c   0 s   c 
         c c c s c  s c c s c  s s 
        s c s s s  c c s s c  c s 
                                                        
          s          c s                  c c    
             B RXYZ ( ,  ,  )  B RZ'Y'X' ( ,  ,  )
             A                     A
Duality:
   3 rotations taken about fixed frame
yield same orientation as 3 rotations in
opposite order about moving frame.
CHAPTER 1: Spatial description
§1.4 More on representation of orientation
E.g.: Z-Y-Z Euler angles ( is commonly used )
   Orientation of a frame {B} as follow: Start with the frame coincident with
a known reference frame {A}. Rotate {B} first about Zˆ B by an angle  , then
about YˆA by an angle  , finally, about Zˆ B by an angle  .
                           c c c  s s      c c s  s c   c s   r11 r12     r13 
  A
    R      ( ,  ,  )   s c c  c s       s c s  c c   s s    r21 r22   r23 
  B Z'Y'Z'                                                                                   
                               s c                 s s          c   r31 r32     r33 
Extracting:
                 A tan 2( r312  r322 , r33 )
                A tan 2(r23 / s , r13 / s )
                A tan 2(r32 / s , r31 / s )
 CHAPTER 1: Spatial description
 §1.4 More on representation of orientation
   We have seen three conventions for specifying orientation: X-Y-Z fixed
angles, Z-Y-X Euler angles and Z-Y-Z Euler angles. These conventions are
examples of a set of 24 conventions that we will call angle-set conventions.
Of these, 12 conventions are for fixed-angle sets, and 12 are for Euler-angle
sets.
   Because of duality of fixed-angle sets with Euler-angle sets, there are
really only 12 unique parameterizations of a rotation matrix by using
successive rotations about principal axes.
3. Equivalent angle-axis representation
    Describing orientation of a frame {B} as follow:
Start with the frame coincident with a known
reference frame {A}. Then rotate {B} about the
vector A Kˆ by an angle  according to the right-
hand rule.
 CHAPTER 1: Spatial description
 §1.4 More on representation of orientation
  Vector Kˆ is called the equivalent axis of a finite rotation. A Kˆ  [k x , k y , k z ]T
          A
Consider a reference {C} with Zˆ coincident with Kˆ :
                                                   A
                                                  C
              Xˆ C  Xˆ A YˆC  Xˆ A        Zˆ C  Xˆ A   nx         ox    ax     ax  k x 
                                                                                      
                 ˆ ˆ
       C R   X C  YA
       A
                            YˆC  YˆA          ˆ     ˆ
                                              ZC  YA   n y           oy    a y  , a y   k y 
                                                                                 
              ˆ ˆ                                                                   a  k 
                             ˆ ˆ
              X C  Z A YC  Z A           Zˆ C  Zˆ A   nz       oz    a z    z  z
           A
           B   RK ( )  CA RRot ( Zˆ C ,  ) AC R  CA RRot ( Zˆ C ,  ) CA R 1
                           nx     ox    a x   c     s      0  n x     ny    nz 
                                                                                       
                         n y    oy     a y   s    c        0  ox      oy    oz 
                                                               
                           nz   oz     a z   0    0        1  a x   ay    a z 
                          nx     ox    a x   n x c  ox s      n y c  o y s      nz c  oz s 
                                                                                                       
                        n y     oy    a y   n x s  ox c      n y s  o y c      n z s  oz c 
                                           
                          nz    oz    a z       ax                  ay                   az       
 CHAPTER 1: Spatial description
 §1.4 More on representation of orientation
                  k x k x v  c         k x k y v  k z s   k x k z v  k y s 
                                                                                    
      A
        R
      B K ( )   k x k y v  k z s      k y k y v  c      k y k z v  k x s    v  1  cos
                  k x k z v  k y s    k y k z v  k x s    k z k z v  c 
Element (1,1):                n2c  n     o s  nx ox s  ox2c  ax2
                                 x        x x
                                k x k x v  c     (nx2  ox2  ax2  1)
Element (2,1):
    nx n y c  n yox s  nxo y s  oxo y c  a x a y  (nx n y  oxo y )c  (nxo y  n yox )s  a x a y
     k x k y v  k z s   ( C Xˆ A  CYˆA  0 , A Xˆ C  AYˆC  AZˆC )
Inverse problem:
                r11 r12    r13                                         r32  r23 
                                              r  r  r 1         1 
               
   B RK ( )   r21
   A
                      r22   r23     A cos( 11 22 33 ) , Kˆ            r13  r31 
                                                   2            2sin               
                r31 r32   r33                                        r21  r12 
 CHAPTER 1: Spatial description
 §1.4 More on representation of orientation
    For any axis-angle pair ( Kˆ , ) , these is another pair, (  Kˆ ,  ) which
                             A                                    A
results in same orientation in space, with same rotation matrix describing it.
In converting from a rotation-matrix into a angle-axis representation, we are
faced with choosing between solutions.
   For small angular rotations, the axis become ill-defined. If the amount of
rotation goes to zero, the axis of rotation becomes completely undefined.
E.g.: a frame {B} is described as initially coincident with {A}, then be
rotated about the vector Kˆ  [0.707,0.70,0] (passing through the origin) by
                          A                  T
  300 degrees. Give the frame description of {B}.
                                                                             0.933 0.067  0.354 0.0 
      k x k x v  c        k x k y v  k z s   k x k z v  k y s                            
                                                                         0.067 0.933  0.354 0.0 
     k x k y v  k z s     k y k y v  c      k y k z v  k x s  
A
 T
                                                                             0.354 0.354 0.866 0.0
B
      k x k z v  k y s   k y k z v  k x s    k z k z v  c                              
                                                                              0     0     0     1   
CHAPTER 1: Spatial description
§1.4 More on representation of orientation
E.g.: Frame {B} is described as initially coincident with {A}. Rotate {B} about
the vector A Kˆ  [0.707,0.70,0]T (passing through the point P  [1,2,3] ) by an
                                                             A
amount   30 degrees. Give the frame description of {B}.
   Define two new frames, {A’} and {B’}, which are coincident with each
other and have the same orientation as {A} and {B} respectively, but are
translated relative to {A} by an offset that places their origins on the axis of
rotation.
             1.0   0.0   0.0 1.0 
             0.0   1.0   0.0 2.0
       AT 
       A                         
             0.0   0.0   1.0 3.0 
                                 
             0     0     0    1 
            1.0    0.0   0.0  1.0 
            0.0    1.0   0.0  2.0
       B
       BT 
                                   
            0.0    0.0   1.0  3.0
                                   
            0      0     0     1 
CHAPTER 1: Spatial description
§1.4 More on representation of orientation
   Now rotate {B’} relative {A’}, this is a rotation about an axis that passes
through the origin:
                          0.933 0.067   0.354 0.0
                          0.067 0.933  0.354 0.0 
                   A
                   BT 
                                                  
                          0.354 0.354  0.866 0.0 
                                                  
                            0     0       0    1  
  Finally, we can write a transform equation to compute the desired frame:
                                0.933 0.067   0.354  1.13 
                                0.067 0.933  0.354   1.13
                  A A B
             BT  AT BT BT 
             A                                             
                                0.354 0.354  0.866   0.05
                                                           
                                  0      0      0       1  
 CHAPTER 1: Spatial description
 §1.5 Transformation of free vectors
Define two basic classes of vector:
 – Line vector: refers to a vector that is dependent on its line of action,
   along with direction and magnitude, for causing its effects. The effects
   of a force vector depend upon its line of (or point of application).
 – Free vector: refers to a vector that may be positioned anywhere in space
   without loss or change of meaning, provided that magnitude and
   direction are preserved. For example, a pure moment vector is always a
   free vector.
   If we have a moment vector B N that is known in terms of {B}, we
calculate the same moment in terms of {A} as: N  B R N
                                               A     A B
                             V  BA R BV
                             A
  Only the rotation matrix relating the two systems is used in transforming.
Relative locations of the origins do not enter into the calculation.
 CHAPTER 1: Spatial description
Problems:
1. Definition of rotation matrix and derive elementary rotation matrix.
2. Mappings involving general frames and homogeneous transform.
3. Three kind of representations of rotation matrix specified with three
parameters.
4. Why the order of three rotations of fixed angles and Euler angles are
different when calculating rotation matrix?