Algorithm Search⌘K

Modelcore

Velocity motion model

Also called velocity-based motion model.

A probabilistic model of the next pose of a planar robot given linear and angular velocity commands with noise.

The velocity motion model gives the probability of the next pose of a planar robot, given the linear and angular velocity that it was told to drive with. A pose is a position (x,y)(x, y) and a heading θ\theta. If the robot followed the command exactly, with constant velocities vv and ω\omega for a time Δt\Delta t, it would move on a circular arc. Real robots do not follow commands exactly, so the model adds Gaussian noise to both velocities and also adds a small noisy rotation at the end. The result is the motion model p(xt∣ut,xt−1)p(x_t \mid u_t, x_{t-1}) of the Bayes filter, with the control ut=(v,ω)u_t = (v, \omega). Since it needs only the command, it can be used before the motion happens, for prediction and planning. The notation is the one of Thrun, Burgard and Fox (2005).

The machine

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

Input. The command ut=(v,ω)u_t = (v, \omega): a linear velocity vv in m/s and an angular velocity ω\omega in rad/s, held constant for the time step Δt\Delta t in seconds.

Noise. The robot executes noisy velocities and a final rotation rate:

v^=v+ε1,ε1∼N(0, α1v2+α2ω2),\hat v = v + \varepsilon_1, \quad \varepsilon_1 \sim \mathcal N(0,\ \alpha_1 v^2 + \alpha_2 \omega^2),
ω^=ω+ε2,ε2∼N(0, α3v2+α4ω2),\hat\omega = \omega + \varepsilon_2, \quad \varepsilon_2 \sim \mathcal N(0,\ \alpha_3 v^2 + \alpha_4 \omega^2),
γ^=ε3,ε3∼N(0, α5v2+α6ω2).\hat\gamma = \varepsilon_3, \quad \varepsilon_3 \sim \mathcal N(0,\ \alpha_5 v^2 + \alpha_6 \omega^2).

The second argument of N\mathcal N is a variance. The printings of the source and many course notes differ: some use the standard deviation α1∣v∣+α2∣ω∣\alpha_1 |v| + \alpha_2 |\omega| instead. The two forms are different models, and alpha values fitted for one do not carry over.

Parameters. Six numbers α1,…,α6≥0\alpha_1, \ldots, \alpha_6 \ge 0. They carry units, since each adds a squared linear and a squared angular velocity. They depend on the robot, its controller and the floor, and they are fitted to data.

Output. With r=v^/ω^r = \hat v / \hat\omega,

x′=x−rsin⁡θ+rsin⁡(θ+ω^Δt),y′=y+rcos⁡θ−rcos⁡(θ+ω^Δt),θ′=θ+ω^Δt+γ^Δt.x' = x - r \sin\theta + r \sin(\theta + \hat\omega \Delta t), \qquad y' = y + r \cos\theta - r \cos(\theta + \hat\omega \Delta t), \qquad \theta' = \theta + \hat\omega \Delta t + \hat\gamma \Delta t.

The robot moves on a circle of signed radius rr around the center (x−rsin⁡θ, y+rcos⁡θ)(x - r \sin\theta,\ y + r \cos\theta). For ω^=0\hat\omega = 0 the arc becomes a straight line, x′=x+v^Δtcos⁡θx' = x + \hat v \Delta t \cos\theta and y′=y+v^Δtsin⁡θy' = y + \hat v \Delta t \sin\theta, and code must treat this case on its own.

Standing assumptions. The robot moves in a plane, and the velocities are constant during Δt\Delta t; a real controller changes them during the step. The three errors are independent of each other and of the errors of earlier steps, which is an approximation. The model is the unicycle model with noise, so it fits robots that can follow any arc, such as a differential drive. It does not fit a car, whose turning radius has a lower bound.

Two algorithms. Sampling draws ε1,ε2,ε3\varepsilon_1, \varepsilon_2, \varepsilon_3 and applies the output equations. The closed form inverts the output equations. Given xt−1x_{t-1} and xtx_t, the center of the circle through the two positions that is tangent to the start heading is (x∗,y∗)(x^*, y^*) with

μ=12 (x−x′)cos⁡θ+(y−y′)sin⁡θ(y−y′)cos⁡θ−(x−x′)sin⁡θ,x∗=x+x′2+μ(y−y′),y∗=y+y′2+μ(x′−x).\mu = \frac{1}{2}\, \frac{(x - x')\cos\theta + (y - y')\sin\theta}{(y - y')\cos\theta - (x - x')\sin\theta}, \qquad x^* = \frac{x + x'}{2} + \mu (y - y'), \qquad y^* = \frac{y + y'}{2} + \mu (x' - x).

The turn is Δθ=atan2⁡(y′−y∗,x′−x∗)−atan2⁡(y−y∗,x−x∗)\Delta\theta = \operatorname{atan2}(y' - y^*, x' - x^*) - \operatorname{atan2}(y - y^*, x - x^*), wrapped into (−π,π](-\pi, \pi]. Then ω^=Δθ/Δt\hat\omega = \Delta\theta / \Delta t, v^=ω^ rs\hat v = \hat\omega\, r_s with the signed radius rs=−(x∗−x)sin⁡θ+(y∗−y)cos⁡θr_s = -(x^* - x)\sin\theta + (y^* - y)\cos\theta, and γ^=(θ′−θ)/Δt−ω^\hat\gamma = (\theta' - \theta)/\Delta t - \hat\omega. The closed form returns the product p1p2p3p_1 p_2 p_3 of the Gaussian densities of v−v^v - \hat v, ω−ω^\omega - \hat\omega and γ^\hat\gamma.

Example. Start at (0,0,0)(0, 0, 0) with v=1v = 1 m/s, ω=0.5\omega = 0.5 rad/s and Δt=1\Delta t = 1 s. The noise-free end pose is (sin⁡0.5, 2(1−cos⁡0.5), 0.5)≈(0.95885,0.24483,0.5)(\sin 0.5,\ 2(1 - \cos 0.5),\ 0.5) \approx (0.95885, 0.24483, 0.5), on the circle of radius 2 around (0,2)(0, 2). The closed form gives μ≈1.95816\mu \approx 1.95816, the center (0,2)(0, 2), Δθ=0.5\Delta\theta = 0.5, and so v^=1\hat v = 1, ω^=0.5\hat\omega = 0.5 and γ^=0\hat\gamma = 0. With every αi=0.01\alpha_i = 0.01, each variance is 0.01⋅1+0.01⋅0.25=0.01250.01 \cdot 1 + 0.01 \cdot 0.25 = 0.0125, and p1p2p3=(2π⋅0.0125)−3/2≈45.432p_1 p_2 p_3 = (2\pi \cdot 0.0125)^{-3/2} \approx 45.432.

What it counts

The model assigns a probability to a motion under a command. It gives the density p(xt∣ut,xt−1)p(x_t \mid u_t, x_{t-1}) for a hypothesized end pose, which grid filters such as the histogram filter need, and samples of xtx_t, which a particle filter needs. Both take O(1)O(1) arithmetic operations and trigonometric calls per pose, so the prediction step of a filter with NN particles costs O(N)O(N). The model also predicts the mean motion of a command, which a planner can use before the robot moves.

Relation to other models

  • Odometry motion model. Uses the motion that the wheel encoders measured, as a rotation, a translation and a rotation, instead of the command. Thrun, Burgard and Fox (2005) note that odometry is usually more accurate than the commanded velocities, so the odometry model is the usual choice for localization when encoders exist. The velocity model is the one available for planning and for robots without encoders.
  • Unicycle model and differential drive model. The noise-free output equations are the exact solution of the unicycle equations x˙=vcos⁡θ\dot x = v\cos\theta, y˙=vsin⁡θ\dot y = v\sin\theta, θ˙=ω\dot\theta = \omega with constant vv and ω\omega. A differential drive maps its two wheel speeds to (v,ω)(v, \omega).
  • Kinematic bicycle model. Also moves on arcs under constant inputs, but its curvature is bounded by the steering limit, and its input is a steering angle, not ω\omega.
  • EKF localization. Linearizes the output equations around the command. The noise of (v^,ω^)(\hat v, \hat\omega) is mapped into pose space by the Jacobian of the output equations with respect to the control.
  • Dead reckoning. Integrating the noise-free output equations step by step is dead reckoning from commands.

Known results in the model

  • Theorem (why the final rotation is needed). Without γ^\hat\gamma, the end pose depends on only two random numbers, v^\hat v and ω^\hat\omega, so it lies on a two-dimensional surface in the three-dimensional pose space. On that surface the heading is fixed by the position: the chord from (x,y)(x, y) to (x′,y′)(x', y') has the direction θ+ω^Δt/2\theta + \hat\omega\Delta t / 2, so θ′=2φ−θ\theta' = 2\varphi - \theta, where φ\varphi is the direction of the chord (for v^>0\hat v > 0, modulo 2π2\pi). The distribution of xtx_t then has no density, and every pose off the surface has probability zero, however close it is to the surface. The term γ^\hat\gamma gives the end pose a density in all three coordinates. In the example the chord direction is atan2⁡(0.24483,0.95885)=0.25=ωΔt/2\operatorname{atan2}(0.24483, 0.95885) = 0.25 = \omega\Delta t / 2.
  • Theorem (change of variables). For fixed xt−1x_{t-1}, the map (v^,ω^,γ^)↦(x′,y′,θ′)(\hat v, \hat\omega, \hat\gamma) \mapsto (x', y', \theta') has a Jacobian determinant of absolute value ∣v^∣ Δt2(1−cos⁡ω^Δt)/ω^2|\hat v|\, \Delta t^2 (1 - \cos \hat\omega\Delta t) / \hat\omega^2. Proof: γ^\hat\gamma enters only θ′\theta', with coefficient Δt\Delta t, so the determinant is Δt\Delta t times the 2×22 \times 2 determinant of (x′,y′)(x', y') with respect to (v^,ω^)(\hat v, \hat\omega). After a rotation to θ=0\theta = 0, with a=ω^Δta = \hat\omega \Delta t, the position is (v^/ω^)(sin⁡a, 1−cos⁡a)(\hat v/\hat\omega)(\sin a,\ 1 - \cos a), and a direct computation gives that determinant as v^Δt(sin⁡2a+cos⁡2a−cos⁡a)/ω^2=v^Δt(1−cos⁡a)/ω^2\hat v \Delta t (\sin^2 a + \cos^2 a - \cos a)/\hat\omega^2 = \hat v \Delta t (1 - \cos a)/\hat\omega^2. Hence p1p2p3p_1 p_2 p_3 is a density over the controls, and the density over poses is p1p2p3p_1 p_2 p_3 divided by this factor. In the example the factor is (1−cos⁡0.5)/0.25≈0.12242/0.25≈0.48967(1 - \cos 0.5)/0.25 \approx 0.12242/0.25 \approx 0.48967, and the pose density at the noise-free end pose is about 45.432/0.48967≈92.7845.432 / 0.48967 \approx 92.78. The factor tends to ∣v^∣Δt4/2|\hat v| \Delta t^4 / 2 as ω^→0\hat\omega \to 0 and is zero for v^=0\hat v = 0, where the position does not depend on ω^\hat\omega.
  • The sign of the velocity. With the unsigned radius r∗=(x−x∗)2+(y−y∗)2r^* = \sqrt{(x - x^*)^2 + (y - y^*)^2}, the formula v^=(Δθ/Δt) r∗\hat v = (\Delta\theta / \Delta t)\, r^* gives v^\hat v the sign of ω^\hat\omega, which is wrong whenever vv and ω\omega have opposite signs. For example, a robot at (0,0,0)(0, 0, 0) that drives forward with v=0.8v = 0.8 and turns right with ω=−0.4\omega = -0.4 gets v^=−0.8\hat v = -0.8 from that formula, and one that backs up with v=−1v = -1, ω=0.5\omega = 0.5 ends at (−0.95885,−0.24483,0.5)(-0.95885, -0.24483, 0.5) and gets v^=1\hat v = 1. The signed radius rsr_s above, the position of the center to the left of the start heading, fixes this.
  • Degenerate cases. The denominator of μ\mu is zero when the end position lies on the line of the start heading. Then the motion is straight, ω^=0\hat\omega = 0, and v^\hat v is the signed distance along the heading divided by Δt\Delta t. When the end position equals the start position, v^=0\hat v = 0 and ω^\hat\omega is not determined by the positions. The closed form must handle both cases on their own, and the wrap of Δθ\Delta\theta assumes ∣ω^Δt∣<π|\hat\omega \Delta t| < \pi.
  • Heuristic (fitting the alphas). The alphas are fitted to data, for example by driving fixed commands and matching the spread of the end poses. The Gaussian shape, the constant velocity over Δt\Delta t and the independence of the errors over time are modeling choices.

References

  1. Sebastian Thrun, Wolfram Burgard and Dieter Fox, Probabilistic Robotics, MIT Press, 2005, Chapter 5, Section 5.3 (the velocity motion model: the closed form density, the sampling algorithm and the derivation with the final rotation)

Where this leads

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