Skip to main content

SLAM

The autonomous navigation of the rover is supported by the use of an Intel RealSense D435i depth camera. This sensor provides synchronized RGB, depth, and inertial measurements (IMU), which are essential for perception and mapping tasks.

The software interface for the camera is provided through the realsense-ros ROS2 wrapper package realsenseai/realsense-ros: ROS Wrapper for RealSense™ Cameras, which enables integration of the camera with the ROS 2 ecosystem. This repository has been cloned into the workspace and is included as a package. Additionally, the librealsense SDK realsenseai/librealsense: RealSense SDK, which provides the low-level drivers and APIs for the camera—is also included as a separate package.

The primary package responsible for SLAM (Simultaneous Localization and Mapping) and map generation is rtt_slam. Within this package, all required dependencies are declared in the package.xml file, ensuring proper integration with the rest of the ROS 2 system.


Launch File Documentation

The launch file defines and orchestrates all nodes and processes required for perception, SLAM, and data streaming. It ensures proper initialization order and parameter configuration.

Database Reset:

ExecuteProcess(
    cmd=['rm', '-r', os.path.expanduser('~/.ros/rtabmap.db')],
    output='screen',
)

Before starting SLAM, any previously stored map database is deleted. This ensures that mapping starts from a clean state and avoids conflicts with prior runs.

Realsense Camera Launch:

The launch file is included with specific parameters:

  • IMU enabled (enable_gyro, enable_accel)
  • IMU fusion (unite_imu_method=2)
  • Depth aligned to RGB (align_depth.enable=True)
  • RGB-D output enabled
  • Point cloud generation enabled
  • Synchronization enabled (enable_sync=True)
  • Matching RGB and depth resolutions (424×240 @ 30Hz)

This configuration ensures consistent and synchronized sensor data for downstream processing.

IMU Filtering:

Node(
    package='imu_filter_madgwick',
    executable='imu_filter_madgwick_node',
)

The imu_filter_madgwick ROS package node processes raw IMU data:

  • Converts raw IMU data into a filtered orientation estimate
  • Uses the Madgwick filter algorithm
  • Magnetometer is disabled (use_mag=False)
  • Outputs orientation in the ENU (East-North-Up) frame

Topic remapping ensures compatibility with RealSense IMU topics.

RTAB-MAP SLAM

The SLAM system is launched via:

  • rtabmap

Key configurations:

  • Subscribes to RGB, depth, camera info, and IMU topics
  • Uses approximate time synchronization (approx_sync=True)
  • Sets base_link as the robot reference frame
  • Enables occupancy grid generation from depth data

Important grid parameters:

  • Grid/RangeMax: 2.0 m (maximum sensing range)
  • Grid/RangeMin: 0.05 m (minimum sensing range)
  • Grid/CellSize: 0.02 m (map resolution)
  • Voxel filtering enabled

This setup enables real-time 3D mapping and localization.

Static Transform

Node(
    package='tf2_ros',
    executable='static_transform_publisher',
)

A static transform is published between:

This defines the spatial relationship between the robot and the sensor. This is necessary as the default TF-tree is not compatible with Nav2.

Video Streaming to Basestation

ExecuteProcess(
    cmd=['/bin/bash', os.path.expanduser('~/stream.sh')],
)

A separate script (stream.sh) is executed to stream camera data to the base station.


Streaming Script Documentation

This script uses GStreamer to transmit video over UDP.

Paragraph Breakdown:

rosimagesrc ros-topic="/camera/camera/color/image_raw"

Captures image directly from a ROS topic.


videoconvert ! video/x-raw,format=I420

Converts image format for encoder compatibility


x264enc tune=zerolatency speed-preset=superfast

Encodes video using H.264 with low-latency settings


rtph264pay pt=96

Packages encoded video into RTP packets


udpsink host=145.126.xx.XXX port=4500

Sends the stream to the base station via UDP


RViZ2

RViz2 is used as the primary visualization interface for the rover system. It allows real-time monitoring of sensor data such as RGB images, depth maps, point clouds, and TF frames. Additionally, it provides tools to visualize occupancy grids and SLAM outputs, aiding in debugging and system validation. It is used to test the implementation of the mapping and the working of the camera.