Localization · Simulation game
Sensor Fusion Lab
Combine sensor measurements. Estimate robot motion. Understand sensor fusion.
Loading…
Missions
Robot and estimates
Sensors
Every control changes the running simulation: the physical sensor, not the estimator. The line under each says what it does. A control marked with a fault is overridden by an active fault (below).
Sensor experiments
One experiment per sensor. Each button resets the world to a clean state with exactly one change, runs a manoeuvre, and the readouts below it are computed from the running simulation. Afterwards change any control and see what it does.
Filter configuration
What the estimators believe about the sensors. The wheel odometry, IMU, complementary filter, EKF and UKF all receive the same messages; the EKF and UKF share these settings, so the comparison is fair. Changing a setting does not reset a filter that has already diverged: use "Re-initialise estimators" above.
Fault injection
Each fault changes the physical sensor in the running simulation. Switch it on, find the symptom in the charts and health indicators, then fix it in the Filter configuration (the "Where to look" line says where). "Check my fix" uses the settings and the measured error. Switching the fault off repairs the hardware.
Challenge: find a hidden fault
Press the button to inject a fault whose name is hidden.
Synchronization experiment
Set latency, timestamp offset, jitter, rate and drop probability for each sensor in Sensors, choose replay or naive handling of late messages in Filter configuration, run "Fast turns" (a robot that turns quickly is the sensitive test), and watch the timing diagram and the NEES. The offset estimator below uses only the messages.
Needs a recent turning run.
Compare estimators on the same recording
Replays the messages you just recorded through fresh estimators in a Web Worker: same inputs, same noise, so the comparison is fair. The optional second run changes one thing, so you can see what it was worth.
| Run | Estimator | Position RMSE | Heading RMSE | Worst position error | Notes | Samples |
|---|
Debug and engineering mode
The inside of the filter: predicted state and covariance, the state transition Jacobian, every sensor's innovation, innovation covariance and Kalman gain, update rates, timestamp differences, execution time, errors, and plain-language diagnostics.
How it works
How This Maps to ROS 2
Sensor Fusion Lab is a teaching model with the same shape as a ROS 2 localization stack. It is not ROS 2, it does not execute ROS 2 nodes, and its filters are simpler than the production robot_localization package. This table says what corresponds to what.
| Sensor Fusion Lab | ROS 2 equivalent |
|---|---|
| Wheel encoder tick messages, integrated to odometry | /odom or /wheel/odometry (nav_msgs/Odometry with pose, twist and covariances) |
| IMU message (gyro z, accelerometer, gravity on z) | /imu/data (sensor_msgs/Imu: angular velocity, linear acceleration, covariances) |
| LiDAR scan matched against the map to a pose observation | /scan (sensor_msgs/LaserScan) into a scan matcher or AMCL, whose pose can be fed to the filter as a pose message |
| GNSS fix with HDOP and satellite count, position in the map frame | /gps/fix (sensor_msgs/NavSatFix with status and position covariance), converted by navsat_transform_node to an odometry message in the map frame (/odometry/gps) |
| Magnetometer heading | sensor_msgs/MagneticField, usually turned into a yaw inside the IMU message |
| EKF and UKF (state x, y, yaw, v, w, biases) | robot_localization: ekf_node and ukf_node (a 15-state 3D model, constrained to the plane with two_d_mode) |
| "Which measurements the filters use" (the switches) | The odom0_config, imu0_config, pose0_config boolean matrices: which state components each sensor updates |
| Process noise Q and initial covariance | process_noise_covariance and initial_estimate_covariance |
| Outlier gate (Mahalanobis, chi-square) | *_rejection_threshold parameters |
| Replay of late messages by timestamp | The history_length parameter lets robot_localization process delayed measurements; in general header.stamp and the TF buffer are how ROS 2 aligns data in time |
| Measurement timestamps, latency, dropped messages | header.stamp on every message, QoS profiles (sensor data is usually best effort with a small queue, so messages can be dropped), and sensor_timeout |
| Fused pose and the frame chain | /odometry/filtered and the TF2 tree map → odom → base_link (one ekf_node for odom to base_link, a second one with GNSS or LiDAR for map to odom) |
| Antenna lever arm | A static transform from base_link to the GNSS antenna frame, published by robot_state_publisher or a static transform publisher |
How robot_localization can fuse odometry, IMU and GNSS
Run an ekf_node (or ukf_node) for each frame: one fuses wheel odometry and the IMU to publish odom → base_link (smooth, drifts), a second adds GNSS (through navsat_transform_node) or a map-based pose to publish map → odom (bounded error, may jump slightly). Each sensor has a boolean configuration matrix saying which state variables it updates (for example, wheel odometry updates velocities, the IMU updates yaw rate and acceleration, GNSS updates x and y), a covariance from the message or a configured one, and a rejection threshold.
Differences from the production package
robot_localizationuses a 15-dimensional state (position, orientation, linear and angular velocity, linear acceleration) in 3D; this lab uses 7 states in the plane, with the accelerometer as an input and two bias states.- The production nodes run asynchronously on real transport (DDS) with QoS, lifecycle management and TF lookups; here a deterministic bus with a fixed latency per sensor stands in for all of that.
- The LiDAR pose here comes from a single likelihood-field scan matcher with a covariance from its Hessian; in ROS 2 you would use a SLAM or localization node (AMCL, slam_toolbox) and fuse its pose.
- The magnetometer, GNSS availability and IMU error models are simplified (no temperature, vibration, scale-factor or cross-axis errors; GNSS availability is by region, not by satellite geometry).
Keep learning
The Localization and SLAM track, SLAM Explorer (mapping and loop closure), LiDAR Explorer (the sensor behind the pose), and Navigation Arena (what to do with the pose).