When thinking about robotics, we typically want to consider the following standard coordinate frames:
- Global (spatial, fixed) frame: A fixed frame of reference attached to the earth.
- Local (body, moving) frame: A frame placed in some key locations within the robot.
Coordinate transformations are a mathematical relation between a point seem from one frame, with the same point seen from another frame. Essentially, they tell us the position and orientation of a coordinate frame with respect to another frame.
Rotation in 2D
Assuming only rotation (no translation yet) between our global and local frames for now, how do transform a point to ?
We can do this using a Rotation Matrix:
where is a rotation matrix that transforms a vector from frame into frame .
For a nice visual derivation on the matrix, see here. (Note that the derived matrix here is the inverse of what we wrote above, but this is fine because it’s just going in the other direction.)
The rotation matrix has some special properties:
- Its inverse is equal to its transpose:
- Its inverse is also equal to a rotation matrix that goes the other way (from frame to frame ):
- Multiplying it by its transpose give the identity matrix (orthogonal matrix):
We say that which stands for Special Orthogonal Group in 2D.
Time derivative of rotation matrix
If the angle changes with time, then we can take the time derivative of the rotation matrix:
Recall that is the angular velocity.
We can factor the above derivative into a nice form:
This is the matrix representation of angular velocity in 2D. Note that we can also write
Note that this matrix is skew-symmetric such that .
For a point , we can find its time derivative using the above as
Alternatively, we can write
Rotation + Translation in 2D
What if we rotate but also have a translation between the coordinate frames? How do transform a point to ?
This can be done in two steps.
First, we rotate frame by using the rotation matrix:
Then, we translate by :
Thus, . Note that this means is in frame .
Homogeneous Representation
We can represent this rotation + translation as one matrix using Homogeneous Coordinates.
Let
Then, we write the rotation + translation as
We denote which is the Special Euclidean Group for 2D.
Properties
Composition:
Inverse:
can be generalized to in the same way with rotation matrices.
- 3D rotation matrices are tricky to handle, so we often use other parameterizations such as Euler Angles, quaternions, etc.
Example
- If an object seen from the camera is located at w.r.t to the frame, then we can find its location in frame using .