Odometry
Odometry
Odometry
Introduction
Odometry requires three non-powered omni wheels connected to encoders: two forward facing wheels
and one lateral wheel located at the back of the robot.
To simplify this task, we can make a few assumptions, the first of which is making motor pow-
ers constant. Since we update odometry once a loop, the same frequency at which we update motor
powers, the motor powers won’t change between two consecutive odometry calls. As a result, we
have only the 5 different movements that are possible with constant motor powers to account for in
the algorithm. These are:
• Forwards/backwards line
• Strafing line
• Diagonal line
• Forwards/backwards arc
• Strafing arc
We can also treat lines as if they are arcs with infinite radius. As a result, we can combine the
forwards/backwards line and left/right line into their respective arcs. This drops the number of
cases to three:
• Diagonal line
• Forwards/backwards arc
• Strafing arc
One thing to notice is that with the forwards/backwards arc, the robot’s front is always facing
the direction of movement, while with the strafing arc, it’s instead the robot’s side that’s facing
the direction of movement. What this means is that the forwards/backwards arc only has a for-
wards/backwards component to it, while the strafing arc only has a strafing component to it. The
diagonal line can be split into both forwards/backwards and strafing components, similar to how vec-
tors can be split into x and y components. Because of this, we can solve for the forwards/backwards
and strafing components separately, and then add them together at the end.
1
Forwards/Backwards Movement
The first task is to find the change in heading over the course of the loop iteration. This can be
found by treating the movement as an arc and solving for the angle.
∆L = (rt − r)∆θ
∆R = (rt + r)∆θ
Subtracting the first equation from the second yields
∆R − ∆L = 2r∆θ
∆R − ∆L
∆θ =
2r
Now we must solve for the turning radius, using the original arc equations.
∆L
∆θ =
rt − r
∆R
∆θ =
rt + r
∆L ∆R
=
rt − r rt + r
∆Lrt + ∆Lr = ∆Rrt − ∆Rr
∆Lrt − ∆Rrt = −∆Lr − ∆Rr
rt (∆L − ∆R) = −r(∆L + ∆R)
r(∆L + ∆R)
rt =
∆R − ∆L
Using trigonometry, we can find the movement in each direction.
∆x = rt (cos ∆θ − 1)
∆y = rt sin ∆θ
2
Strafing
The angle equation that we found for forwards/backwards movements works for strafing as well, so
there is no need to create a new one. But we can solve for the strafing radius using the arc length
formula.
∆B = (rs + rb )∆θ
∆B = rs ∆θ + rb ∆θ
rs ∆θ = ∆B − rb ∆θ
∆B
rs = − rb
∆θ
Using trigonometry, we can find the movement in each direction. It is important to note the rotated
axes relative to the robot, as it’s strafing.
∆x = rs sin ∆θ
∆y = rs (1 − cos ∆θ)
Final Equations
After deriving the equations for forwards/backwards as well as strafing movement, we must add the
two components together to get the final equations.
∆x = rt (cos ∆θ − 1) + rs sin ∆θ
As these are lines, ∆θ = 0, which makes everything a lot easier. The change in x is the change
in the back encoder, while the change in y is the average of the changes in the two forward encoders.
3
∆R − ∆L
∆θ =
2r
If ∆θ = 0:
∆x = ∆B
∆L + ∆R
∆y =
2
And if ∆θ 6= 0:
r(∆L + ∆R)
rt =
∆R − ∆L
∆B
rs = − rb
∆θ
∆x = rt (cos ∆θ − 1) + rs sin ∆θ
∆y = rt sin ∆θ + rs (1 − cos ∆θ)