Odometry for Wheeled Mobile Robots
What is Odometry
Odometry is an estimate of the robot's configuration based on information from motion sensors. In this document we specifically discuss wheel odometry, where the estimate is about how the wheels have moved.
Advantages and Disadvantages of Odometry
- Readily available:
- Either the motors have encoders or you estimate how far they've turned based on the commands you've provided
- Accurate over short distances
- Errors accumulate over time
- Slipping and sliding of the wheels
- Inaccuracies in measuring rotations of wheels
- In ROS an odometry-like measurement is considered to be continuous but have drift, while other positioning methods are generally considered to be slow and discontinuous: See https://www.ros.org/reps/rep-0105.html
Odometry HOWTO
Computing the Twist
- Determine the distance each wheel has traveled over the last \(\Delta t\) time interval.
- Assume that the wheels moved with constant velocity for \(\Delta t\)
Convert the wheel distance to a body twist using the mapping from wheel velocities to twists:
\begin{equation} \begin{bmatrix} \frac{\Delta\theta}{\Delta t}\\ \frac{\Delta x_b}{\Delta t} \\ \frac{\Delta y_b}{\Delta t} \end{bmatrix} = H^{\dagger} \begin{bmatrix} \frac{\Delta \phi_1}{\Delta t} \\ \vdots\\ \frac{\Delta \phi_n}{\Delta t} \end{bmatrix} \end{equation}- \(\Delta t\) does not factor into the equation as it "cancels out" on both sides (or take \(\Delta t = 1\), without loss of generality since the time units are arbitrary)
- Although \(\Delta t\) does not factor into the math, it must be short enough such that the constant velocity assumption remains accurate (among other factors).
- In most practical circumstances with robots, it is arguably incorrect to incorporate \(\Delta t\) into odometry calculations because it introduces unnecessary error
- If using floating point numbers, it adds numerical error
- Even with perfect arithmetic, the time interval between measurements (or the estimate of that time used in the calculation) may not be exact
Integrating the Twist
- Once the twist \(V_b\) is determined, integrate it to find \(T_{bb'}\), where \(\{b\}\) is the original body frame and \(\{b'\}\) is the body frame after the latest movement
- The twist must be integrated. It cannot be added to the previous location because if there is simultaneous rotation and translation then the translational direction is constantly hanging throughout the motion
- However, there always exists a frame in which the movement is a pure rotation. This frame is located at the center of rotation.
- This means that all rigid body motions in the plane follow a circular path. The circle is centered at the center of rotation
- For pure translation the center of rotation is at infinity (note that as radius grows the arc of a circle becomes flatter. A "circle" with infinite radius has a completely flat arc.
- Geometrically, the center of rotation can be constructed (e.g., using a straight-edge and compass):
- Draw a line between two corresponding points at the old location and new location
- Draw the perpendicular bisector
- Repeat with two different points
- The perpendicular bisectors meet at the center of rotation
2D Geometry
- If \(V_b\) has zero angular displacement, then \(T_{bb'}\) is a pure translation: \(T(0, \Delta x, \Delta y)\),
If \(V_b\) has nonzero angular displacement, then
Find the center of rotation in a frame \(\{s\}\), which is aligned with \(\{b\}\) (this is the point on the body that undergoes a pure rotation. You can do this geometrically, or use the adjoint:
\begin{equation} \begin{bmatrix} \dot{\theta}\\ 0 \\ 0 \end{bmatrix}= \begin{bmatrix} 1 & 0 & 0\\ y_s & 1 & 0 \\ -x_s & 0 & 1 \end{bmatrix} \begin{bmatrix} \Delta\theta\\ \Delta x_b\\ \Delta y_b \end{bmatrix} \end{equation}Solving for \(x_s\) and \(y_s\) gives you the transform \(T_{sb}\), from the body frame to the center of rotation frame.
Next, perform the pure rotation in the new frame:
\begin{equation} T_{ss'} = T(\Delta \theta, 0, 0) \end{equation}- The frame \(\{s'\}\) is at the center of rotation, rotated by \(\Delta \theta\)
- Next we need to translate back to the body frame location while keeping
the new orientation. \(T_{b's'} = T_{bs}\) because
- \(T_{bs}\) is a pure translation from the center-of-rotation to a point \(p\) on the old body
- \(T_{b's'}\) is a pure translation from the center-of-rotation to the same point \(p\) on the new body
- All points on the body have moved along a circular arc centered at \(\{s\}\) (which is coincident with \(\{s'\}\)
Putting all the transforms together:
\begin{equation} T_{bb'} = T_{bs}T_{ss'}T_{s'b'}. \end{equation}
Matrix Exponential
- Augment twist to make it a 3D twist, then \(T_{bb'}=e^{[V_b]}\). See (Lynch, Park Modern Robotics Ch 3).
The New Configuration
- We have \(T_{bb'}\), but we still need to compute the location of the robot in the world frame
- Odometry can only provide a relative measurement, therefore we assume we know the previous configuration \(q(k) = \begin{bmatrix}\theta, x, y \end{bmatrix}\).
- We can compute \(T_{wb'} = T_{wb}T_{bb'}\).
- \(T_{wb} = T(\theta, x, y)\)
- The resulting expression is in the form \(T_{wb'} = T(\theta', x', y')\), which contains the new robot coordinates in the world frame.
- The transformation \(T_{bb'} = T(\Delta\theta_b,\Delta x_b, \Delta y_b)\):
- The vector \(\Delta p_b = \begin{bmatrix} \Delta x_b \\ \Delta y_b \end{bmatrix}\)
points from the origin of frame \(\{b\}\) to the origin of frame \(\{b'\}\), expressed in frame \(\{b\}\)
- The robot has been displaced along this vector
- \(\Delta p_w = R_wb p_b\) is the displacement in the world frame
- The angular displacement \(\Delta\theta_b\) is the same in all frames (in two dimensions).
- Thus $Δ q_w = \begin{bmatrix}Δθ_b \\ Δ p_w \end{bmatrix}
- The new position in the world is then \(q_w(k+1) = q_w(k) + \Delta q_w\)
- The vector \(\Delta p_b = \begin{bmatrix} \Delta x_b \\ \Delta y_b \end{bmatrix}\)
points from the origin of frame \(\{b\}\) to the origin of frame \(\{b'\}\), expressed in frame \(\{b\}\)
- We have shown two ways of finding the location of the robot:
- Find \(T_{wb'}\) and extract the absolute coordinates directly
- Extract the displacement from \(T_{bb'}\), convert it to the world frame, and add to the previous location
- Mathematically, both of these methods are the same, however, depending on implementation one may be computationally better than the other
- The displacement can also be computed as \(\Delta q_w = A(\theta, 0, 0) \Delta q_b\)
- This expression carries over the angular displacement while rotating the linear displacement into the world frame.
Odometry Questions
- Should odometry be treated as a sensor reading or as part of the robot model
(i.e., the control signal)?
- It can be either, but usually it is treated as part of the robot model,
despite the fact that sensors can be involved
- It measures the effect of the control
- If the robot does not have encoders, than "odometry" is just using your forward model of the robot to determine position.
- Thus, encoders are, in a sense, a way of gathering better information about what your controls are doing.
- It can be either, but usually it is treated as part of the robot model,
despite the fact that sensors can be involved