UP | HOME

Rigid Body Transformations in 2D

Overview

Provides a brief review of 2D rigid body transformations, from the perspective of a programmer who just wants to use them. See (Lynch, Park Modern Robotics Chapter 3) for more details.

Coordinate Frames

A 2D coordinate frame consists of 2 orthogonal unit vectors located somewhere in space

  • Whenever I discuss frames in these notes, they are stationary. The body frame of a moving robot is assumed to be instantaneously fixed to the location of the robot at any given time.

Rotation Matrix

A rotation matrix describes the rotation between two coordinate frames. If there is a pure rotation (i.e., no translation) between frames \(\{a\}\) (with coordinate vectors \(\hat{x}_a\) and \(\hat{y}_a\)) and \(\{b\}\) (with coordinate vectors \(\hat{x}_b\) and \(\hat{y}_b\)) the rotation matrix \(R_{ab}\) lets you find the coordinates of a point \(p\) in frame \(a\) given coordinates in frame \(b\) using the equation

\begin{equation} p_a = R_{ab} p_b \end{equation} \begin{equation} R_{ab} = \begin{bmatrix} \cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \end{bmatrix} \end{equation}
  • Rotations can be composed: \(R_{ac} = R_{ab}R_{bc}\).
  • Rotations can always be inverted and this reverses the rotation:
\begin{equation} R_{ba} = R_{ab}^{-1} = \begin{bmatrix} \cos\theta & \sin\theta \\ -\sin\theta & \cos\theta \end{bmatrix} \end{equation}

Transformation Matrix

If the origin of frame \(\{j\}\) is displaced from frame \(\{i\}\) by \(x \hat{x}_i + y \hat{y}_i\) and the angle between the frames is \(\theta\), then to convert a point \(p_j\) in frame \(j\) to frame \(i\) coordinates:

\begin{equation}\label{eq:homtran} \begin{bmatrix}p_i \\ 1\end{bmatrix} = T_{ij}\begin{bmatrix}p_j \\ 1 \end{bmatrix}, \end{equation}

where

\begin{equation} T_{ij} = \begin{bmatrix} \cos\theta & -\sin\theta & x \\ \sin\theta & \cos\theta & y \\ 0 & 0 & 1 \end{bmatrix} \end{equation}

The inverse is also well defined and allows you to reverse the transformation

\begin{equation} T_{ij}^{-1} = T_{ji} = \begin{bmatrix} \cos\theta & \sin\theta & -x\cos\theta -y\sin\theta \\ -\sin\theta & \cos\theta & -y\cos\theta +x\sin\theta \\ 0 & 0 & 1 \end{bmatrix} \end{equation}

In Equation\eqref{eq:homtran} the points \(p_i\) and \(p_j\) are written in homogeneous coordinates, that is a two-dimensional point \((x, y)\) is written as \((x, y, 1)\).

  • There is intuition and geometric understanding you can learn to understand the reasoning behind the use of homogeneous coordinates (discussed later)
  • You can also, for the purposes of this class, view homogeneous coordinates as a mechanical rule: append a 1 to the point/vector you are transforming, then use only the first two elements of the result

Twist

A 2D twist consists of an angular velocity and two translational velocities:

\begin{equation} V = \begin{bmatrix} \dot{\theta} \\ \dot{x} \\ \dot{y} \end{bmatrix} \end{equation}
  • A twist represents a rigid body motion.
  • For a moving rigid body, each point on that body may have a different velocity.
  • For example, on a spinning disc, the points farther from the center of rotation have a higher translational velocity.

Adjoint

The 2D adjoint converts a twist in one frame to a twist in another frame.

  • These are just different coordinate representations for what is the same rigid body motion.

The 2D Adjoint is

\begin{equation} \mathrm{Ad}_{ij} = \begin{bmatrix} 1 & 0 & 0 \\ y & \cos\theta & -\sin\theta \\ -x & \sin\theta & \cos\theta \end{bmatrix}. \end{equation}

To convert a twist from one frame to another

\begin{equation} V_i = \mathrm{Ad}_{ij} V_j \end{equation}

Thought Experiments

  • These are some thought exercises designed to help build intuition about frames
  • They are designed as a guide for thinking about these concepts
  • Use interactively: read a line, then try to visualize. It may help to close your eyes
  • This section is experimental: everyone thinks differently and I tried to put in words how I think about these concepts. I'm not sure how helpful it will be to others: let me know!

Homogeneous Coordinates and Transformations

1-D Homogeneous coordinates

  1. Imagine a blank wall.
  2. Horizontally on that wall, there is a numberline stretching horizontally.
    • Zero is centered in front of you, negative numbers go to the left, positive to the right
    • Your one-dimensional coordinates are this numberline.
  3. Now, one unit below the number line, is a point. It is at (0, 0). This is the origin of the homogeneous coordinate system.
  4. Cast a ray from the origin to the number 0. The ray extends upwards, vertically and infinitely
  5. Notice that the ray intersects the numberline at (0, 1). This point is one representation of the number zero
  6. Consider all the other points on this ray. Notice that they too cross through the numberline at (0,1). This whole ray (and all the 2D points on it) correspond to the one-dimensional point 0.
  7. Imagine a ray from the origin that passes through (1,1). This ray (and all the 2D points on it) represents the 1-D point at 1.
    • What are some points on this ray: (2, 2), (3, 3), (4,4) etc.
    • Notice that \((2/2) = 1\), \((3/3) = 1\), etc. In general the 2D homogeneous point \((x, w)\) corresponds to the 1D point \(x/w\) (at least for \(w \neq 0\)).
  8. Now, consider the angle of the ray with respect to the horizontal. Consider what happens as that angle gets smaller and smaller
    • The ray becomes closer and closer to the horizontal
    • The point on the real-line that it intersects gets larger and larger in magnitude
  9. What happens when the ray is completely horizontal?
    • It doesn't intersect the real number line at all
    • But as we approached horizontal, the magnitude of the 1D number the ray represented got larger and larger.
    • When the ray is finally horizontal, it lets us represent a point at infinity!
    • Loosely speaking, 2D homogeneous point \((x,w)\) maps to 1D point \(x/w\). When \(w = 0\) it makes sense that the 1D point is infinity.

2-D Homogeneous coordinates

  1. Think about the 1D homogeneous coordinates. They are flat, on the wall.
  2. Now, imagine of these walls, intersecting each other.
    • There are two number lines, 90 degrees apart.
    • The two number lines form a horizontal plane.
    • One number line is the \(x\) axis, the other is the \(y\) axis, and the horizontal plane is the \(x,y\) plane
    • The \((x,y)\) plane is at a height of \(1\), so points in this plane can be written \((x, y, 1)\). But in general a plane parallel to this \(x,y\) plane can be placed at a height of \(w\).
  3. Cast a ray from the origin through the point \((x,y, 1)\)
    • This ray (and all the points on it) are equivalent to the point \((x,y)\).
    • In general, \((x, y, w)\) is equivalent to the point \((x/w, y/w)\).
  4. Imagine a vertical plane that contains the ray and is perpendicular to the \((x,y)\) plane.
    • If we confine everything to the points in this plane, we are now in the 1-D situation
    • Thus, in this plane, as the ray moves more horizontal it selects more distant points
    • When the ray is completely horiziontal it is equivalent to \(\infty\).
    • In this way, each point in 2-D has its own representation of infinity.

Transformation Matrix

  1. The goal is to be able to translate a point a fixed distance regardless of where the point is with a single matrix multiplication
    • This is impossible with Euclidean points:
      • 1D Example: if you multiply a point \(x\) by some fixed amount \(a\), it ends up at \(ax\).
        • Thus, the amount moved by \(a\) depends on \(x\) (for example, \(x = 0\) can never be moved.
  2. The fundamental operation on homogeneous points is shear
    • All points along a line are shifted by an amount proportional to their perpendicular distance from that line
      • 1D Example: Each point in 1D is represented by a ray in homogeneous coordinates.
        • A shear operation that moves a point by \(-1\) in the \(w = 1\) plane, also moves points in the \(w\) plane by \(w(-1)\).
          • So where the ray representing \(-1\) intersects the \(w = 2\) plane, it will be moved by \(-2\).
          • This proportional movement can be captured by the matrix \(\begin{matrix}1 & k \\ 0 & 1\end{matrix}\), where in this example \(k = -1\).
        • For rigid body transformations, all the points are in the \(w = 1\) plane.
      • Expanding to 2D:
        • In 2D the shear is completed in the plane is repeated in the \(x\) and \(y\) direction
        • A rotation matrix is used to align the axis in the target frame with the destination frame.
  3. If you know know the distance and rotation angle between frames \(\{s\}\) and \(\{b\}\) you can
    1. Form the rotation matrix between them
    2. Compute the translation as the location of the \(\{b\}\) frame's origin relative to the \(\{s\}\) frame's origin.

Velocities and Twist

Pure Translations

  1. A twist combines angular and translational velocity and describes how a reference frame is moving: \((\dot{\theta}, \dot{x}, \dot{y})\)
  2. Imagine you are sliding a closed laptop across a table at constant velocity directly to the right, without rotation
    • Look at the lower left corner of the lid, and the upper left corner of the lid. how far do these points travel after you slide the laptop for a few seconds?
    • How far do other points on the laptop travel?
    • Now assume the laptop grows to completely cover the table and beyond, all the way to infinity.
      • Think of a piece of this object that is far away from the laptop, how does it move?
  3. If an object is purely translating, how does each point on the object move?

Pure Rotations

  1. Imagine that you are holding onto an infinitely large object by a handle.
    • You are holding on at reference frame \(\{b\}\)
    • You rotate the handle counter-clockwise at a speed of \(\dot{\theta}\)
  2. Imagine the point directly at the origin of \(\{b\}\).
    • What is happening to that point? Is it moving?
  3. Imagine a point directly to the right of the origin
    • In which direction is it moving?
    • What happens to its speed as it moves further to the right
    • What about the points above, below and to the left of the origin?
  4. Now imagine that the points from the previous thoughts are arrows (they can point in any direction, but assume they point in the initial direction of the movement).
    • What happens to these arrows as the object rotates? Think of some specific orientations of the main object (say 90 degrees, 180 degrees, 45 degrees). What is the orientation of these arrows?
    • Does the rotational velocity of a point on the object depend on the location of that point?

Everything is Rotation

  1. Center of Rotation - a point in space where the twist has only an angular component
    • When we did a pure rotation, how many points had only an angular component and where were they?
  2. Imagine an (infinitely large) object that is translating and rotating simultaneously.
    • Is there a point that undergoes a pure rotation?
  3. Where is the center of rotation for a pure translation?
    • It is at infinity

Body Twist vs Velocity

  1. Typically, for a robot at position \(q = (x, y, \theta)\), we represent its velocity \(\dot{q}\).
  2. The velocity of the robot \(\dot{q}\) is NOT the same as its body twist in the world frame
    • The body twist of the robot in the world frame is the velocity (expressed in the world frame) of a point at the world frame origin that is moving as if it were rigidly attached to the robot. This quantity depends on the distance between the world frame and the robot!
    • The velocity \(\dot{q}\) is actually the twist at the origin of the robot's body frame expressed in a frame aligned with the world but coincident with the body.

Author: Matthew Elwin