← AI & Robotics Lab

RealSense D455 + RTAB-Map: Why You Need an IMU Filter for Visual Inertial Odometry (VIO)

Author: Daniel Jordan Viray

Solution to error when trying to run VIO and RTAB-Map

May 19, 2026 · Autonomy & Mapping · by Daniel Jordan Viray


Note: Written by AI, verified by me. Article written based on my back-and-forth conversation with AI during development.


The Intel RealSense D455 publishes a raw IMU. RTAB-Map’s odometry needs an orientation quaternion. The D455 doesn’t provide one, so RTAB-Map silently discards every IMU message. This post explains why, the fix (imu_filter_madgwick), and how to validate the resulting VIO without RViz.

Context: RTAB-Map running in Docker on a Jetson Orin Nano, consuming camera topics from a host-side realsense2_camera node. The IMU itself is already exposed at the kernel level (separate problem, separate post).


The problem

Launch the camera with IMU enabled:

bash

ros2 launch realsense2_camera rs_launch.py \
  depth_module.depth_profile:=424x240x30 \
  rgb_camera.color_profile:=424x240x30 \
  enable_gyro:=true enable_accel:=true \
  unite_imu_method:=2

unite_imu_method:=2 merges accel + gyro into one synchronized /camera/camera/imu topic (RTAB-Map expects a unified topic, not separate /accel and /gyro).

Launch RTAB-Map with imu_topic:=/camera/camera/imu. Odometry runs, but the log floods at ~200 Hz with:

CoreWrapper.cpp:2820::imuAsyncCallback() IMU received doesn't have orientation set, it is ignored.

Every IMU message is dropped. The pipeline is visual-only, not visual-inertial.


Why the IMU is rejected

A sensor_msgs/Imu message has three blocks:

  1. Angular velocity — raw gyroscope (rad/s)

  2. Linear acceleration — raw accelerometer (m/s², includes gravity)

  3. Orientation — absolute attitude quaternion

The D455 IMU is a raw sensor: it provides (1) and (2). Block (3) is all zeros — an invalid quaternion.

Orientation is not measured; it’s estimated by fusing the raw sensors:

Neither is sufficient alone. A fusion filter uses the gyro for short-term smoothness and the accelerometer’s gravity vector to bound gyro drift, producing a stable orientation quaternion. (Same complementary-filter principle as VIO itself — accurate-but-slow corrects fast-but-drifting — applied one level lower, inside IMU processing.)

RTAB-Map’s odometry is visual; it uses the IMU only for a gravity/orientation constraint (knowing “down” corrects visual drift, particularly under rotation where visual odometry is weakest due to low parallax). It requires block (3). Receiving zeros, it correctly rejects every message.

Fix: insert an orientation estimator between the raw IMU and RTAB-Map.

/camera/camera/imu  →  imu_filter_madgwick  →  /imu/data  →  RTAB-Map
(raw, no orientation)   (fuses → quaternion)    (complete)

The Madgwick filter is a low-cost orientation estimator (relevant on a CPU-constrained Orin Nano). This is the standard RealSense + RTAB-Map architecture.


The fix

Check the package (else apt install ros-humble-imu-filter-madgwick):

bash

ros2 pkg executables imu_filter_madgwick

Run it:

bash

ros2 run imu_filter_madgwick imu_filter_madgwick_node \
  --ros-args \
  -r imu/data_raw:=/camera/camera/imu \
  -r imu/data:=/imu/data \
  -p use_mag:=false \
  -p publish_tf:=false

Parameters:

Startup prints First IMU message received. then goes quiet (no per-message logging).

Verify filter output before wiring RTAB-Map

bash

ros2 topic echo /imu/data --once

Check the orientation block is non-zero, and validate:

Non-zero orientation + correct gravity magnitude confirms real fusion, not noise.

Re-point RTAB-Map

Only change imu_topic to the filtered topic:

bash

ros2 launch rtabmap_launch rtabmap.launch.py \
  rgb_topic:=/camera/camera/color/image_raw \
  depth_topic:=/camera/camera/depth/image_rect_raw \
  camera_info_topic:=/camera/camera/color/camera_info \
  imu_topic:=/imu/data \
  frame_id:=camera_link approx_sync:=true \
  visual_odometry:=true odom_frame_id:=odom \
  database_path:=/root/maps/rtabmap.db delete_db_on_start:=true

Success: the imuAsyncCallback ... doesn't have orientation set flood is gone.


Database gotcha

Remember to delete any prior/stale databases. I ran into errors loading a stale DB from a differently-configured session, which triggers a vocabulary-mismatch flood:

VWDictionary.cpp:741::addWordRef() Not found word 178034 (dict size=4486)

Validating VIO without RViz

A publishing pose topic only proves data flow, not correctness. Validate physically with two terminals: one on RTAB-Map’s log (the Odom: quality=N field is a live feature-tracking health metric), one echoing the pose field under test.

Stationary stability:

bash

ros2 topic echo /rtabmap/odom --field pose.pose.position

Camera still, pointed at a textured scene. Expect mm-level position jitter (~±3 mm/axis observed). Confirms it correctly resolves “not moving.”

Translation (metric scale): glide the camera ~30 cm along one axis over 2–3 s. The corresponding position component should change by ~0.30 m, then hold stable when stopped. Metric scale comes from the depth camera — not arbitrary drift.

Rotation (symmetry test):

bash

ros2 topic echo /rtabmap/odom --field pose.pose.orientation

Don’t read absolute quaternion values; test reversibility. Note resting quaternion, rotate ~90° yaw slowly (4–5 s; pure rotation is the hardest case for visual odometry — fast feature sweep, low parallax), rotate back. The quaternion should trace a smooth monotonic arc out and return near the start value. Example (dominant components): start z=−0.395, w=0.889 → peak z=−0.81, w=0.56 → return z=−0.378, w=0.924. Close return + smooth path (no jumps/NaNs/zero-resets) = pass.


Failure mode: featureless environments

Initial translation test failed:

OdometryF2M.cpp:622 Registration failed: "Not enough inliers 0/20 (matches=6)"
Odom: quality=0

Pose output went to all-zeros. Cause: visual odometry matches features between frames; a low-texture surface (blank wall, bare floor) collapses match count to single digits, zero pass geometric validation, odometry resets. Reporting zeros is correct behavior, just not useful.

Aggravating factor: camera mounted ~10° down → when placed low it views a near-featureless floor. quality cratered 271 → 113 → 34 as the view degraded, with Memory.cpp:3217 Missing visual features.

Mitigations:


State

Working pipeline:

D455 → host realsense2_camera → /camera/camera/imu (raw, 200 Hz)
     → imu_filter_madgwick → /imu/data (with orientation)
     → RTAB-Map (SLAM + VIO, Docker) → /rtabmap/odom

Validated: stationary stability, metric translation, reversible rotation.

Open item: odometry ~10 Hz; 20+ Hz wanted for flight control. Higher rate also improves motion-tracking robustness (the featureless-environment failure is partly a low-rate problem). Optimization (feature count, odometry strategy, full-SLAM vs odometry-only cost on the Orin Nano) is next.


Reproduction checklist

  1. Camera: enable_gyro:=true enable_accel:=true unite_imu_method:=2

  2. D455 IMU has no orientation → RTAB-Map rejects it (expected, not a bug)

  3. imu_filter_madgwick, use_mag:=false (mandatory — no magnetometer; silent no-op without it), input ← raw IMU, output → /imu/data

  4. Verify /imu/data: unit quaternion, ~9.8 m/s² accel magnitude

  5. RTAB-Map imu_topic:=/imu/data; confirm rejection flood gone

  6. Vocabulary-mismatch errors → rm -f the DB file (launch param unreliable)

  7. Validate physically (stationary mm jitter / 30 cm → 0.3 m / 90° rotation reversible). Requires a feature-rich scene.