Odometry (often called “odom” for short) is the process of using motion sensors to continuously track how far and in what direction a robot has moved from its starting position. It works by constantly reading data from motor encoders and IMUs and doing math to figure out where the robot is on the field.

Think of it like counting your steps while walking blindfolded. If you know how big each step is and which way you are facing, you can calculate where you ended up — even without looking!

Why does this matter?

Odometry lets your robot keep track of its position on the field during autonomous mode. Without it, the robot has no idea where it is and cannot reliably execute complex movement sequences.

The Math

Odometry converts wheel rotation data into a position on a 2D grid (x, y coordinates on the field).

Step 1 — Find how far the robot moved:

Every time the wheels spin, the encoder counts rotations. Multiply the number of rotations by the circumference of the wheel (how far it travels in one full spin) to get real distance:

Rolling

$$ \text{Distance} = \text{Rotations} \times (\pi \times \text{Wheel Diameter}) $$

Step 2 — Find the direction the robot is facing:

The IMU (Inertial Measurement Unit) tracks the robot’s heading — what angle it is pointing on the field.

Step 3 — Calculate the X and Y change:

Using the distance and heading together, you can use trigonometry to figure out how far the robot moved horizontally and vertically:

$$ \text{Horizontal Distance} = \text{Total Distance} \times \cos(\text{Heading}) $$

$$ \text{Vertical Distance} = \text{Total Distance} \times \sin(\text{Heading}) $$

Add those changes to the robot’s starting coordinates, and you have the robot’s new position!

Limitations

Odometry is very powerful but has a few weaknesses:

  • Wheel Slip: If your robot skids (like when another robot shoves it), the wheels slip but the encoders keep counting. The robot thinks it moved, but it did not. This throws off the position calculation. Solution: use dead wheels — unpowered wheels attached to their own encoders. Because they have no motor, they only count movement when the robot is genuinely rolling across the ground.

  • Starting Position: Odometry calculates the robot’s position relative to where it started. If the robot is not placed in the correct starting spot, every future calculation will be off by the same amount.

  • Sensor Drift: No sensor is perfect. Over a full match, tiny errors in each reading add up, causing the robot’s calculated position to slowly drift away from its true position. See Localization for strategies (like using AprilTags) to correct for drift.