Overview
Sensor integration combines data from multiple sensors (LiDAR, IMU, wheel encoders, camera) into a unified perception system for robust autonomous navigation.Goal: Achieve reliable perception by fusing complementary sensor data using proper time synchronization and coordinate frame transforms.
Sensor Stack
Required Sensors (WP4)
Wheel Encoders
Purpose: Position estimation (odometry)
- Accuracy: Good short-term
- Drift: Accumulates over time
- Update Rate: 50 Hz
- Frame:
odom→base_link
IMU (ICM-20948)
Purpose: Orientation and angular velocity
- Accuracy: Excellent for rotation
- Drift: Minimal (gyro integration)
- Update Rate: 100 Hz
- Frame:
imu_link
LiDAR (RPLIDAR A1M8)
Purpose: Obstacle detection and mapping
- Range: 0.15m - 12m, 360°
- Accuracy: ±2cm
- Update Rate: 5.5 Hz
- Frame:
lidar_link
Camera (Optional)
Purpose: Visual feedback and monitoring
- Resolution: 640×480 (VGA)
- FPS: 30
- Use: Teleoperation, visual SLAM
- Frame:
camera_link
Coordinate Frame Tree
Complete TF tree for Mecanum robot:Frame Descriptions
Static Frames (fixed transforms):| Frame | Parent | Transform | Purpose |
|---|---|---|---|
base_footprint | odom | (0, 0, 0) | Ground projection |
base_link | base_footprint | (0, 0, 0.05) | Robot center, 5cm above ground |
lidar_link | base_link | (0, 0, 0.20) | LiDAR 20cm above base |
imu_link | base_link | (0, 0, 0.05) | IMU at robot center |
camera_link | base_link | (0.15, 0, 0.18), pitch=15° | Camera front, tilted down |
| Frame | Parent | Published By | Rate |
|---|---|---|---|
odom | map | ekf_filter_node or amcl | 50 Hz |
base_footprint | odom | ekf_filter_node | 50 Hz |
Sensor Fusion Architecture
Integration Points
-
Odometry + IMU → EKF:
- Fuses wheel odometry with IMU angular velocity
- Produces drift-corrected
/odometry/filtered - Publishes
odom→base_linktransform
-
LiDAR + Map → SLAM/AMCL:
- SLAM: Creates map, publishes
map→odom - AMCL: Localizes in map, publishes
map→odom
- SLAM: Creates map, publishes
-
Camera (Optional):
- Independent visual feedback
- Can be fused for visual SLAM (advanced)
Complete Launch File
File:launch/sensors_all.launch.py
/controller_manager/mecanum_drive_controller/joint_state_broadcaster/robot_state_publisher/imu_publisher/ekf_filter_node/rplidar_node/pi_camera
Time Synchronization
Critical: All sensor data must be timestamped correctly for fusion to work.ROS2 Time Sources
System time vs. ROS time:Timestamp Verification
Common Time Issues
Sensor Data Validation
Check All Topics Publishing
Verify Publishing Rates
- LiDAR: 4-6 Hz (target 5.5 Hz)
- IMU: 80-120 Hz (target 100 Hz)
- Odometry: 40-60 Hz (target 50 Hz)
- Camera: 25-30 Hz (target 30 Hz)
Verify TF Tree
- Complete path:
map→odom→base_link→ sensors - No missing transforms
- No transform warnings in logs
Validate Sensor Data Quality
LiDAR scan quality:Sensor Calibration
1. IMU Calibration
Calibrate magnetometer and accelerometer:2. LiDAR Alignment
Ensure LiDAR 0° points forward:3. Camera Calibration
Covered in camera-setup.mdx:4. Odometry Calibration
Tune wheel radius and base dimensions:- Command robot to move 1.0m forward
- Measure actual distance traveled
- Adjust
wheel_radiusif error > 5%:
Integration Testing
Test 1: Stationary Sensor Check
Robot should be stationary:- All topics publishing
- No TF errors
- Odometry velocity ≈ 0
- IMU angular velocity ≈ 0
Test 2: Motion Test
Move robot with teleoperation:- Forward 1m → check X position increases by ~1.0
- Strafe right 1m → check Y position decreases by ~1.0
- Rotate 90° → check orientation changes by ~π/2
- Odometry tracks motion accurately (±10%)
- LiDAR scan updates in real-time
- IMU detects rotation
Test 3: Sensor Fusion Validation
Compare raw odometry vs. fused odometry:- Raw odometry: May drift significantly
- Fused odometry: Should stay stable (IMU corrects rotation)
- Fused odometry more stable than raw
- Rotation matches IMU angular velocity
Test 4: LiDAR-Odometry Alignment
Check LiDAR scan matches robot motion:- Scan appears stationary relative to environment
- Robot TF moves correctly through scan
Troubleshooting
TF transform timeout errors
TF transform timeout errors
Error: “Could not transform from base_link to lidar_link”Causes:
- Missing static transform
- Robot state publisher not running
- Frame ID mismatch
EKF not publishing fused odometry
EKF not publishing fused odometry
Symptom: No Solutions:
/odometry/filtered topicDebug:- Verify
use_sim_time: falsein all configs - Check IMU and odometry topics publishing
- Verify frame IDs match between sensors and EKF config
Sensor data out of sync
Sensor data out of sync
Symptom: Jerky motion, oscillation, or poor localizationCause: Sensor timestamps misalignedDebug:Solutions:
- Sync system clocks (use NTP on Raspberry Pi)
- Check sensor node implementations use
node.now() - Reduce sensor publishing delays
High CPU usage
High CPU usage
Symptom: System slow, dropped sensor dataMonitor CPU:Solutions:
- Reduce camera resolution/framerate
- Lower LiDAR scan rate (if supported)
- Reduce EKF update frequency
- Disable camera if not needed
- Use compressed image transport
LiDAR scan doesn't match odometry
LiDAR scan doesn't match odometry
Symptom: Scan appears to drift or rotate incorrectlyCauses:
- LiDAR frame misaligned
- Odometry scaling incorrect
- TF tree broken
- Check LiDAR joint in URDF (yaw should be 0 or π/2)
- Calibrate odometry wheel radius
- Verify
lidar_link→base_linktransform correct - Test with stationary robot (scan should not move)
Performance Monitoring
Create Monitoring Script
Next Steps
SLAM Mapping
Use integrated sensors for SLAM mapping
Navigation Setup
Configure autonomous navigation with Nav2
System Integration
Complete robot system integration (WP5)
Localization Testing
Validate sensor fusion accuracy