Algorithm Search⌘K

Modelcore

Odometry motion model

Also called odometry-based motion model.

A probabilistic model of motion as a rotation, a translation and a rotation read from wheel odometry, each with noise.

The odometry motion model gives the probability that a planar robot moves from one pose to another, given what its wheel encoders report. A pose is a position (x,y)(x, y) and a heading θ\theta. The encoders do not measure the true motion: wheels slip, the floor is uneven, and the wheel radius is not known exactly. The model treats the reported motion as a measurement of the true motion. It splits each motion into three steps, a rotation, a straight translation and a second rotation, and adds independent zero-mean Gaussian noise to each step. The result is the motion model p(xt∣ut,xt−1)p(x_t \mid u_t, x_{t-1}) of the Bayes filter, where the control utu_t is a pair of odometry readings. Monte Carlo localization draws samples from it, and EKF localization uses a linearized form of it. The notation is the one of Thrun, Burgard and Fox (2005).

The machine

State. The pose xt=(x,y,θ)x_t = (x, y, \theta) of the robot in the world frame, in meters and radians. The pose before the motion is xt−1x_{t-1} and the pose after it is xt=(x′,y′,θ′)x_t = (x', y', \theta').

Input. Two readings of the internal odometry of the robot, ut=(xˉt−1,xˉt)u_t = (\bar x_{t-1}, \bar x_t), with xˉt−1=(xˉ,yˉ,θˉ)\bar x_{t-1} = (\bar x, \bar y, \bar\theta) and xˉt=(xˉ′,yˉ′,θˉ′)\bar x_t = (\bar x', \bar y', \bar\theta'). The odometry frame drifts against the world frame, so only the relative motion between the two readings is used. It is the motion that the encoders report:

δrot1=atan2⁡(yˉ′−yˉ, xˉ′−xˉ)−θˉ,δtrans=(xˉ′−xˉ)2+(yˉ′−yˉ)2,δrot2=θˉ′−θˉ−δrot1.\delta_{\mathrm{rot1}} = \operatorname{atan2}(\bar y' - \bar y,\ \bar x' - \bar x) - \bar\theta, \qquad \delta_{\mathrm{trans}} = \sqrt{(\bar x' - \bar x)^2 + (\bar y' - \bar y)^2}, \qquad \delta_{\mathrm{rot2}} = \bar\theta' - \bar\theta - \delta_{\mathrm{rot1}}.

The first rotation turns the robot towards the end point, the translation drives it there, and the second rotation turns it to the final heading.

Noise. The true motion is the reported motion minus independent Gaussian errors. In the variance form used on this page,

δ^rot1=δrot1−ε1,ε1∼N(0, α1δrot12+α2δtrans2),\hat\delta_{\mathrm{rot1}} = \delta_{\mathrm{rot1}} - \varepsilon_1, \quad \varepsilon_1 \sim \mathcal N(0,\ \alpha_1 \delta_{\mathrm{rot1}}^2 + \alpha_2 \delta_{\mathrm{trans}}^2),
δ^trans=δtrans−ε2,ε2∼N(0, α3δtrans2+α4(δrot12+δrot22)),\hat\delta_{\mathrm{trans}} = \delta_{\mathrm{trans}} - \varepsilon_2, \quad \varepsilon_2 \sim \mathcal N(0,\ \alpha_3 \delta_{\mathrm{trans}}^2 + \alpha_4 (\delta_{\mathrm{rot1}}^2 + \delta_{\mathrm{rot2}}^2)),
δ^rot2=δrot2−ε3,ε3∼N(0, α1δrot22+α2δtrans2).\hat\delta_{\mathrm{rot2}} = \delta_{\mathrm{rot2}} - \varepsilon_3, \quad \varepsilon_3 \sim \mathcal N(0,\ \alpha_1 \delta_{\mathrm{rot2}}^2 + \alpha_2 \delta_{\mathrm{trans}}^2).

The second argument of N\mathcal N is a variance. The printings of the source and many course notes differ here: some use the standard deviation α1∣δrot1∣+α2δtrans\alpha_1 |\delta_{\mathrm{rot1}}| + \alpha_2 \delta_{\mathrm{trans}} instead. The two forms are different models, and alpha values fitted for one do not carry over to the other.

Parameters. Four dimensionless numbers α1,…,α4≥0\alpha_1, \ldots, \alpha_4 \ge 0. α1\alpha_1 scales rotation noise from rotation, α2\alpha_2 rotation noise from translation, α3\alpha_3 translation noise from translation, and α4\alpha_4 translation noise from rotation. They depend on the robot and the floor, and they are fitted to data; there are no correct default values.

Output. The new pose is the old pose moved by the true motion:

x′=x+δ^transcos⁡(θ+δ^rot1),y′=y+δ^transsin⁡(θ+δ^rot1),θ′=θ+δ^rot1+δ^rot2.x' = x + \hat\delta_{\mathrm{trans}} \cos(\theta + \hat\delta_{\mathrm{rot1}}), \qquad y' = y + \hat\delta_{\mathrm{trans}} \sin(\theta + \hat\delta_{\mathrm{rot1}}), \qquad \theta' = \theta + \hat\delta_{\mathrm{rot1}} + \hat\delta_{\mathrm{rot2}}.

Standing assumptions. The robot moves in a plane. The three errors are independent of each other, of the pose and of the errors of earlier steps; this independence is what makes the motion a Markov process, and it is an approximation (slip on a wet patch persists over several steps). Odometry is treated as a measurement and not as a control, so the model can be used only after the motion, not to plan it.

Two algorithms. Sampling draws ε1,ε2,ε3\varepsilon_1, \varepsilon_2, \varepsilon_3 and applies the output equations. The closed form takes a hypothesized pair (xt−1,xt)(x_{t-1}, x_t), computes the motion (δ^rot1,δ^trans,δ^rot2)(\hat\delta_{\mathrm{rot1}}, \hat\delta_{\mathrm{trans}}, \hat\delta_{\mathrm{rot2}}) that would produce it with the same three equations as for utu_t, and returns p1p2p3p_1 p_2 p_3, the product of the three Gaussian densities of the differences δ−δ^\delta - \hat\delta. Angle differences must be wrapped into (−π,π](-\pi, \pi] before the Gaussian is evaluated. Implementations differ in where they take the variances from: from the reported motion δ\delta, as the sampler does, or from the hypothesized motion δ^\hat\delta.

Example. The odometry reports xˉt−1=(0,0,0)\bar x_{t-1} = (0, 0, 0) and xˉt=(1,1,π/2)\bar x_t = (1, 1, \pi/2), so δrot1=π/4≈0.7854\delta_{\mathrm{rot1}} = \pi/4 \approx 0.7854, δtrans=2≈1.4142\delta_{\mathrm{trans}} = \sqrt 2 \approx 1.4142 and δrot2=π/4\delta_{\mathrm{rot2}} = \pi/4. Take α=(0.05,0.01,0.02,0.005)\alpha = (0.05, 0.01, 0.02, 0.005). The variances are 0.05(π/4)2+0.01⋅2≈0.0508430.05 (\pi/4)^2 + 0.01 \cdot 2 \approx 0.050843 for each rotation (standard deviation 0.22550.2255 rad) and 0.02⋅2+0.005⋅2(π/4)2≈0.0461690.02 \cdot 2 + 0.005 \cdot 2 (\pi/4)^2 \approx 0.046169 for the translation (standard deviation 0.21490.2149 m). A robot at xt−1=(2,3,π/2)x_{t-1} = (2, 3, \pi/2) ends at (1,4,π)(1, 4, \pi) if there is no noise. At that pose the closed form returns p1p2p3=(2π⋅0.050843)−1(2π⋅0.046169)−1/2≈5.8121p_1 p_2 p_3 = (2\pi \cdot 0.050843)^{-1} (2\pi \cdot 0.046169)^{-1/2} \approx 5.8121.

What it counts

The model assigns a probability to a motion. It gives two things:

  • the density p(xt∣ut,xt−1)p(x_t \mid u_t, x_{t-1}) for a hypothesized end pose, which the Bayes filter needs in its prediction step on a grid (histogram filter, Markov localization);
  • samples of xtx_t given xt−1x_{t-1} and utu_t, which a particle filter needs.

Both take O(1)O(1) arithmetic operations and calls to sin⁡\sin, cos⁡\cos and atan2⁡\operatorname{atan2} for one pose. The prediction step of a particle filter with NN particles therefore costs O(N)O(N), and the prediction step on a grid of gg poses costs O(g2)O(g^2) if every pair of cells is evaluated. The model does not predict where the robot is in the world; it predicts how far the robot is from where the odometry says it moved, relative to the last pose.

Relation to other models

  • Velocity motion model. Uses the commanded linear and angular velocities instead of odometry readings, and moves the robot on an arc instead of along a rotation, a translation and a rotation. Thrun, Burgard and Fox (2005) note that odometry is usually more accurate than the commands, so the odometry model is the common choice when encoders exist. The velocity model is needed for planning and control, before the motion has happened.
  • Dead reckoning. Dead reckoning integrates the same odometry with no noise and no correction; it is the mean path of this model, up to the shrinking effect below. The errors grow without bound over time, which is why the noise model is used inside a filter that also has a measurement model, such as the beam range finder model.
  • Differential drive model and unicycle model. These are the kinematic models that turn wheel rotations into the odometry pose xˉt\bar x_t. The odometry model sits on top of them and adds noise to their output.
  • EKF localization. Linearizes the output equations around the mean motion. The noise is Gaussian in (δ^rot1,δ^trans,δ^rot2)(\hat\delta_{\mathrm{rot1}}, \hat\delta_{\mathrm{trans}}, \hat\delta_{\mathrm{rot2}}) and is mapped into the pose space by the Jacobian of the output equations, so the pose noise in the filter is only approximately Gaussian.

Known results in the model

  • Theorem (change of variables). The output map (δ^rot1,δ^trans,δ^rot2)↦(x′,y′,θ′)(\hat\delta_{\mathrm{rot1}}, \hat\delta_{\mathrm{trans}}, \hat\delta_{\mathrm{rot2}}) \mapsto (x', y', \theta') for a fixed xt−1x_{t-1} has a Jacobian with determinant −δ^trans-\hat\delta_{\mathrm{trans}}. Proof: the derivatives of (x′,y′)(x', y') with respect to (δ^rot1,δ^trans)(\hat\delta_{\mathrm{rot1}}, \hat\delta_{\mathrm{trans}}) form the matrix (−tsctcs)\begin{pmatrix} -t s & c \\ t c & s \end{pmatrix} with t=δ^transt = \hat\delta_{\mathrm{trans}}, c=cos⁡(θ+δ^rot1)c = \cos(\theta + \hat\delta_{\mathrm{rot1}}), s=sin⁡(θ+δ^rot1)s = \sin(\theta + \hat\delta_{\mathrm{rot1}}), whose determinant is −t(s2+c2)=−t-t(s^2 + c^2) = -t; the third output adds a row (1,0,1)(1, 0, 1), and (x′,y′)(x', y') does not depend on δ^rot2\hat\delta_{\mathrm{rot2}}, so expanding along the last column gives −t-t. Hence, when the variances are taken from the reported motion, p1p2p3p_1 p_2 p_3 is the density of the motion parameters, and the density of the pose is p1p2p3/δ^transp_1 p_2 p_3 / \hat\delta_{\mathrm{trans}} (summed over every parameter triple that gives the same pose, which matters only when the noise can make the translation negative). The closed form that returns p1p2p3p_1 p_2 p_3 is therefore not a density over poses. In a particle filter this does not matter, since the sampler is exact. On a grid it adds a weight that favors poses far from xt−1x_{t-1}.
  • Measurement (the size of the factor). For the example above, a numerical integral of p1p2p3p_1 p_2 p_3 over a fine grid of end poses gives about 1.4131.413, close to δtrans=2\delta_{\mathrm{trans}} = \sqrt 2, and the integral of p1p2p3/δ^transp_1 p_2 p_3 / \hat\delta_{\mathrm{trans}} gives about 0.9990.999. The pose density at the noise-free end pose is 5.8121/2≈4.10985.8121 / \sqrt 2 \approx 4.1098. With the variances taken from the hypothesized motion instead, the integral after the division is about 1.081.08, so that variant is not exactly a density in any coordinates.
  • Theorem (the mean falls short). If ε∼N(0,v)\varepsilon \sim \mathcal N(0, v), then E[cos⁡(a+ε)]=e−v/2cos⁡a\mathbb E[\cos(a + \varepsilon)] = e^{-v/2} \cos a, and the same holds for sin⁡\sin. Since δ^trans\hat\delta_{\mathrm{trans}} and δ^rot1\hat\delta_{\mathrm{rot1}} are independent, E[x′]=x+δtrans e−v1/2cos⁡(θ+δrot1)\mathbb E[x'] = x + \delta_{\mathrm{trans}}\, e^{-v_1/2} \cos(\theta + \delta_{\mathrm{rot1}}) and E[y′]=y+δtrans e−v1/2sin⁡(θ+δrot1)\mathbb E[y'] = y + \delta_{\mathrm{trans}}\, e^{-v_1/2} \sin(\theta + \delta_{\mathrm{rot1}}), where v1v_1 is the variance of ε1\varepsilon_1, and E[θ′]=θ+δrot1+δrot2\mathbb E[\theta'] = \theta + \delta_{\mathrm{rot1}} + \delta_{\mathrm{rot2}} when the heading is not wrapped. So the mean position is not the noise-free position: it lies on the same line, closer to the start. In the example e−v1/2≈0.974899e^{-v_1/2} \approx 0.974899, and the mean is (1.025101,3.974899,π)(1.025101, 3.974899, \pi); a Monte Carlo run with 200000 samples gave (1.02500,3.97494,3.14164)(1.02500, 3.97494, 3.14164). The samples form a curved, banana-shaped cloud around the arc of radius δtrans\delta_{\mathrm{trans}}, so a single Gaussian in (x,y,θ)(x, y, \theta) fits them badly when the rotation noise is large.
  • Pure rotation. When δtrans=0\delta_{\mathrm{trans}} = 0, the direction δrot1\delta_{\mathrm{rot1}} is not defined, and a tiny translation makes it jump. Implementations set δrot1=0\delta_{\mathrm{rot1}} = 0 below a small threshold on δtrans\delta_{\mathrm{trans}} and put the whole rotation into δrot2\delta_{\mathrm{rot2}}. The same issue appears in the closed form for hypothesized poses with x′=xx' = x and y′=yy' = y.
  • Heuristic (fitting the alphas). The alphas are fitted to data, for example by driving known paths and matching the spread of the end poses, or by maximum likelihood inside a localization run. The Gaussian shape and the independence of the three errors are modeling choices, not facts about wheels. Since the true errors are correlated in time, alphas fitted to single steps can make the predicted spread over many steps too small.

References

  1. Sebastian Thrun, Wolfram Burgard and Dieter Fox, Probabilistic Robotics, MIT Press, 2005, Chapter 5, Section 5.4 (the odometry motion model: the closed form density in Section 5.4.1, sampling in Section 5.4.2 and the derivation in Section 5.4.3), and Chapter 2, Section 2.4 (the place of the motion model in the Bayes filter)

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW3 standard
  • at least two sources