FixTheRobot Explore Robotics / Localization & SLAM / Sensor Fusion Lab

Localization · Simulation game

Sensor Fusion Lab

Combine sensor measurements. Estimate robot motion. Understand sensor fusion.

Paused0.0 s

Loading…

Press Start, then drive with W A S D (or the joystick), or run a manoeuvre. The thin dashed white path is the ground truth, shown for reference only.

Missions

Robot and estimates

Added obstacles are not in the map the LiDAR matcher uses.
Wrong initial pose experiment:

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.

Replay results
RunEstimatorPosition RMSEHeading RMSEWorst position errorNotesSamples

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 components and their ROS 2 equivalents
Sensor Fusion LabROS 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 headingsensor_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 covarianceprocess_noise_covariance and initial_estimate_covariance
Outlier gate (Mahalanobis, chi-square)*_rejection_threshold parameters
Replay of late messages by timestampThe 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 messagesheader.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 armA static transform from base_link to the GNSS antenna frame, published by robot_state_publisher or a static transform publisher
A robot_localization style architectureWheel odometry, IMU, LiDAR pose and GNSS (through navsat_transform_node) feed an ekf_node, which publishes the filtered odometry and the TF tree. /odomwheel odometry /imu/datagyro + accelerometer /scan → scan matcherpose observation /gps/fixNavSatFix navsat_transform_node/odometry/gps ekf_node / ukf_nodepredict, update,covariance, gating /odometry/filteredfused pose + twist /tfmap → odom → base_link header.stamp + QoStime alignment
A simplified robot_localization style architecture. In this lab the same ideas run in one JavaScript session, with no ROS 2.

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

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).