Code
Code
The room and the robot
The experiment uses the same environment as the finite navigation MDP: a 4 m square room, four circular obstacles, and a goal at . The TurtleBot3 Waffle is represented by a disk with a 0.2 m radius and follows the same noisy unicycle model. Each commanded speed receives Gaussian noise with standard deviation 0.02. Reaching within 0.25 m of the goal or colliding ends the episode; otherwise it is truncated after 200 steps of 0.2 s. The simulator also records the achieved twist , including actuation noise, because that motion determines the wheel-encoder readings. The dynamics are unchanged from the navigation MDP; only the sensing and state estimation are new.Code
Code
Wheel odometry
The Waffle’s nominal wheel radius is m, and each wheel sits m from the centerline. Under the differential-drive model, a twist corresponds to and . The encoders report the wheel rotations associated with the achieved twist plus noise. As in the EKF SLAM chapter, the standard deviation for a wheel rotating at is , with and rad/s. Odometry converts the reported wheel speeds back to a twist using the nominal radius. This conversion is exact only when both physical wheels have radius . Wear or an uneven load can change the effective radius; model the right wheel as , following the example in EKF localization. Its angular speed is then Odometry multiplies this measurement by , producing a distance error by the factor . Because the bias keeps the same sign, it accumulates over the trajectory instead of averaging away. The filter does not include in its model. The filter’s motion model integrates the twist from the reported wheel speeds over one step, the same Euler step the simulator takes. Its Jacobians (with respect to the pose) and (with respect to the wheel speeds) give the motion noise , where is the diagonal covariance of the encoder noise. The course writes motion noise as and measurement noise as , the reverse of the letters in Thrun, Burgard and Fox (Thrun et al., 2005).Code
Code
Landmarks from the lidar
Each lidar scan contains 360 ranges, one per degree, with 1 cm Gaussian range noise. The four circular obstacles serve as landmarks; the walls do not. Their radii range from 0.20 to 0.30 m, compared with the 0.10 m pillars used in the EKF SLAM chapter, so the detection front end needs two adjustments. A range jump larger than 15 cm separates adjacent clusters. A candidate landmark must curve toward the robot: its midpoint must lie at least 8 cm in front of the chord joining its endpoints. Flat wall segments and inward-facing corners fail this test. A geometric circle fit is then applied to the cluster. The detector accepts radii from 0.1 to 0.4 m and centers within 2.5 m, and reports the center’s range and bearing. Minimizing radial distances avoids the roughly 1 cm inward bias produced by an algebraic fit on these short arcs.Code
Code
Code
Code
EKF SLAM on the navigation run
The filter is the EKF SLAM section’s step, unchanged. The prediction moves the pose with and grows the covariance with and . Each landmark observation is then associated with the mapped landmark at the smallest Mahalanobis distance, or starts a new landmark withadd_landmark if no mapped landmark passes the 99.9% gate. The correspondences are unknown, as in that section.
Initialization uses the true start pose with zero pose covariance, aligning the map frame with the room and making the goal at known in filter coordinates. The filter processes the first scan before any motion. Those initial landmarks are placed from an exact pose, so the map orientation inherits only the bearing noise in that scan. Delaying the first correction until after motion would rotate the entire map by the first-step heading error, which later relative landmark measurements could not remove. Dead reckoning shares the prediction step but omits all corrections; its covariance records how quickly the encoder-noise model expects the pose to drift.
Code
Code
Policies on an estimated pose
The experiment reuses two policies without retraining. Go-to-goal turns toward the target and moves forward once aligned; it needs only goal distance and bearing computed from the supplied pose. The second policy is the finite model’s optimum , a table over pose cells and five steering commands. Rebuilding that table also preserves , denoted in the MDP chapter, for the later QMDP experiment. Both policies use certainty equivalence: they act as though the supplied pose were exact and ignore its covariance. Three pose sources are tested. Ground truth provides the ideal baseline; dead reckoning and the EKF SLAM mean provide estimates. Episode outcomes are always evaluated from the true pose, regardless of which pose drives the policy.Code
Code
Code
Code
Choosing the wheel radius error
A plausible wheel-radius error should reflect its physical source. The EKF localization example uses a wheel that is 1% smaller than the model assumes, representing tire wear or uneven loading. For the Waffle, 1% is 0.33 mm of the 33 mm nominal radius. The experiments therefore set the right wheel to . At full speed, this bias makes odometry overestimate the turn rate by about 0.5 degrees per second. The following sweep drives from dead reckoning across several values of , including zero, to show how quickly the bias matters.Code
Code
Results over 500 episodes
Both policies are evaluated on the same 500 seeded episodes with . Starts are sampled from free space at least 1.5 m from the goal, and every pose source receives the same starts and actuation noise. The final column reports the position error seen by the policy, averaged first over the steps in each episode and then across episodes.Code
Code
One episode in detail
The first episode in which dead reckoning causes to collide while EKF SLAM reaches the goal provides a representative comparison. Both runs begin from the same pose and use the same actuation noise.Code
Code
Acting on the belief with QMDP
Certainty equivalence discards the covariance . QMDP instead uses the Gaussian pose belief (Thrun et al., 2005). It averages the fully observed optimal action values under that belief and selects the largest: Here indexes cells in the finite model and comes from value iteration. Monte Carlo sampling projects the continuous belief onto those cells: draw poses from and average the action values of their cells, Samples inside obstacles are discarded because the robot knows it has not collided. With a narrow covariance, the samples occupy the same cell as and QMDP reduces to . Its action changes only when appreciable belief mass reaches cells with different optimal actions, such as cells on opposite sides of an obstacle boundary. With a full scan, roughly three landmarks are visible at every step and position uncertainty remains well within one 11 cm cell. QMDP therefore behaves almost exactly like . To create meaningful uncertainty without changing the dynamics, the next experiment blocks the rear half of the lidar, as a tall payload mounted behind the sensor might do. Only the forward half-plane remains visible. The detector also rejects an obstacle cut by the edge of the visible sector because the partial arc biases its circle fit. Encoder noise, wheel-radius bias, , and episode seeds remain unchanged. During gaps in landmark visibility, the filter propagates from odometry alone and its covariance expands.Code
Code
Code
Code
What the estimate costs
In this room, full-scan EKF SLAM introduces no measurable loss: go-to-goal and succeed as often from the filter mean as from the true pose because about three landmarks remain visible and mean error stays at 0.5 to 0.6 cm. Dead reckoning is much less forgiving. Random encoder noise alone reduces success by 28 percentage points; adding a 1% wheel-radius bias increases the loss to 37 points. With the rear half of the scan blocked, no landmark is visible during 29% of the run and uncertainty grows between sightings. Even so, still reaches the goal in 99% of episodes with a mean error of 1.8 cm, which leaves QMDP almost nothing to recover. QMDP helps where the belief is wide: on dead reckoning it raises success from 63% to 72%. QMDP accounts for uncertainty when comparing actions but does not seek observations. A policy that deliberately looks before committing must plan over beliefs. Key references: (Thrun et al., 2005)References
- Thrun, S., Burgard, W., Fox, D. (2005). Probabilistic Robotics. Link
Found an error on this page? Report an issue.

