Skip to content
VAULT-LocalizationPublic

About

VAULT (Visual and Autonomous Localization Kit) for ROS 2

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

VAULT (Visual and Autonomous Localization Kit)

VAULT is a ROS 2 kit for outdoor localization. It fuses Visual SLAM (Intel RealSense T265), GNSS/RTK (u-blox), IMU, and visual odometry (Intel RealSense D435i) through an EKF to provide a robust pose estimate.

Table of Contents

  1. Prerequisites
  2. Installation
  3. Usage
  4. Using a Linux service
  5. Troubleshooting

Prerequisites

Hardware

  • Intel RealSense T265 (tracking camera, end-of-life)
  • Intel RealSense D435i (visual odometry)
  • u-blox GNSS receiver, such as the u-blox ZED-F9P (RTK)
  • HFI-A9 IMU

Software

  • Ubuntu 22.04
  • ROS 2 Humble, desktop install recommended
  • librealsense 2.50.0, built from source (T265 support was removed upstream in 2.54.1). Do not install the ROS apt ros-humble-librealsense2.
  • Build tools and librealsense dependencies:
sudo apt update
sudo apt install -y git cmake build-essential pkg-config python3-pip \
  libssl-dev libusb-1.0-0-dev libudev-dev \
  libgtk-3-dev libglfw3-dev libgl1-mesa-dev libglu1-mesa-dev

Source ROS 2 in every new terminal:

source /opt/ros/humble/setup.bash

Optionally, install Foxglove to visualize the output.

Installation

  1. Create the workspace:
mkdir -p ~/ros2_ws/src
  1. Clone VAULT and its dependencies:
cd ~/ros2_ws/src
git clone https://github.com/VAULT-Localization/VAULT.git
cd ~/ros2_ws
vcs import src < src/VAULT/dependencies.repos
rosdep install --from-paths src --ignore-src -r -y --skip-keys "librealsense2 catkin"

dependencies.repos pins librealsense 2.50.0, the last series that supports the T265. T265 support was removed upstream in librealsense 2.54.1, so do not replace it with a newer release. Do not install the ROS apt packages ros-humble-librealsense2, ros-humble-realsense2-camera, or ros-humble-realsense2-camera-msgs: they ship librealsense 2.59 without T265 support, and their headers conflict with the workspace 2.50 build. If they are already installed, remove them:

sudo apt remove -y ros-humble-librealsense2 ros-humble-realsense2-camera ros-humble-realsense2-camera-msgs
  1. Build librealsense 2.50.0 with T265 (TM2) support.

The upstream connectivity/firmware server librealsense.intel.com is retired. Its check fails even with internet access, and CMake/connectivity_check.cmake then silently disables TM2. Force the check to pass:

cat >> ~/ros2_ws/src/librealsense/CMake/connectivity_check.cmake <<'EOF'

# The upstream check server is retired; keep TM2 enabled.
set(INTERNET_CONNECTION ON)
EOF

The build also needs five firmware blobs, which are not stored in the git repository. If you have an existing librealsense 2.50.0 build, copy them from its build/common/fw directory; otherwise obtain the same versions from the RealSense archive. Create a local mirror:

mkdir -p ~/fwmirror/Releases/{RS4xx/FW,SR300/FW,L5xx/FW,TM2/FW/target/0.2.0.951}

# Adjust this source directory if your existing build is elsewhere.
cp ~/librealsense/build/common/fw/D4XX_FW_Image-5.13.0.50.bin ~/fwmirror/Releases/RS4xx/FW/
cp ~/librealsense/build/common/fw/SR3XX_FW_Image-3.26.1.0.bin ~/fwmirror/Releases/SR300/FW/
cp ~/librealsense/build/common/fw/L51X_FW_Image-1.5.8.1.bin ~/fwmirror/Releases/L5xx/FW/
cp ~/librealsense/build/common/fw/L53X_FW_Image-3.5.5.1.bin ~/fwmirror/Releases/L5xx/FW/
cp ~/librealsense/build/common/fw/target-0.2.0.951.mvcmd ~/fwmirror/Releases/TM2/FW/target/0.2.0.951/

Build it and source the result:

cd ~/ros2_ws
source /opt/ros/humble/setup.bash
colcon build --packages-select librealsense2 --cmake-clean-cache \
  --cmake-args -DBUILD_WITH_TM2=ON \
               -DIMPORT_DEPTH_CAM_FW=ON \
               -DREALSENSE_FIRMWARE_URL=file://$HOME/fwmirror
source install/setup.bash

Verify that TM2 is really present before continuing. The first command must print a number greater than zero, and the second must list the T265 as well as the D435i:

strings install/librealsense2/lib/librealsense2.so.2.50.0 | grep -c -i t265
install/librealsense2/bin/rs-enumerate-devices -s
  1. Install the udev rules:
sudo cp ~/ros2_ws/src/librealsense/config/99-realsense-libusb.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules
sudo udevadm trigger

If your user is not in the plugdev group:

sudo usermod -aG plugdev $USER
  1. Build the rest of the workspace:
cd ~/ros2_ws
source /opt/ros/humble/setup.bash
source install/setup.bash
colcon build --symlink-install --packages-skip librealsense2
source install/setup.bash

The camera node must link the workspace librealsense, not the ROS apt one. Check:

ldd install/realsense2_camera/lib/librealsense2_camera.so | grep realsense
# expected: librealsense2.so.2.50 => ~/ros2_ws/install/librealsense2/lib/...

nm -D install/realsense2_camera/lib/librealsense2_camera.so | grep rs2_create_context
# expected: U rs2_create_context   (no rs2_create_context_ex)

If the second command shows rs2_create_context_ex, the camera was compiled against 2.59 headers. Remove the apt packages listed in step 2 and rebuild realsense2_camera with --cmake-clean-cache.

  1. Verify the installation:
rs-enumerate-devices -s
ros2 pkg list | grep vault

Camera notes

  • The T265 must appear in rs-enumerate-devices -s before launching; otherwise the node reports device name containing t265 is NOT found.
  • In the current setup the T265 is behind a USB 2.0 hub and enumerates as USB 2.1. Pose and IMU streams are reliable at this speed (200 Hz); fisheye video is not, so keep enable_fisheye:=False, which is the default in t265.launch.py. For fisheye, connect the T265 directly to a USB 3 port.
  • The D435i must be connected to a USB 3 port. Do not share its controller/hub with the T265.
  • Run the two sensor launches in separate terminals:
source /opt/ros/humble/setup.bash
source ~/ros2_ws/install/setup.bash
export ROS_DOMAIN_ID=13

ros2 launch vault_sensors d435i.launch.py
ros2 launch vault_sensors t265.launch.py

Check that both nodes and streams are alive:

ros2 node list
ros2 topic hz /vault/d435i/color/image_raw   # ~30 Hz
ros2 topic hz /vault/t265/odom/sample        # ~200 Hz

This realsense-ros version publishes the T265 pose as /vault/t265/odom/sample, not pose/sample.

Assigning ttyUSB

Serial devices can get different names on every boot. Assign a stable symlink to each one by matching its serial number.

  1. Get the serial number of each device:
sudo udevadm info --query=property --name=/dev/ttyUSB0 | grep SERIAL
# ID_SERIAL=Silicon_Labs_HandsFree_IMU_USB_to_UART_Bridge_Controller_0001
# ID_SERIAL_SHORT=0001

sudo udevadm info --query=property --name=/dev/ttyACM0 | grep SERIAL
# ID_SERIAL=u-bloxAG-_www.u-blox.com_u-blox_GNSS_receiver
  1. Create the udev rules file:
sudo nano /etc/udev/rules.d/99-usbserial.rules

Add the following lines, replacing the ID_SERIAL values with the ones from your devices:

ACTION=="add",ENV{ID_BUS}=="usb",ENV{ID_SERIAL}=="Silicon_Labs_HandsFree_IMU_USB_to_UART_Bridge_Controller_0001",SYMLINK+="ttyUSB0"
ACTION=="add",ENV{ID_BUS}=="usb",ENV{ID_SERIAL}=="u-bloxAG-_www.u-blox.com_u-blox_GNSS_receiver",SYMLINK+="ttyACM0"
  1. Reload the udev rules:
sudo udevadm control --reload-rules
sudo udevadm trigger

Usage

Define the following environment variables. They select which sensors and estimators are launched; anything disabled is skipped:

# Ntrip
export NTRIP_HOST=YOUR_HOST
export NTRIP_PORT=YOUR_PORT
export NTRIP_MOUNTPOINT=YOUR_POINT
export NTRIP_USER=YOUR_USER
export NTRIP_PASSWORD=YOUR_PASSWORD

# ROS 2
export ROS_DOMAIN_ID=13
export RMW_IMPLEMENTATION=rmw_fastrtps_cpp

# Sensors
export FIX_T265_ODOM=True
export PUBLISH_T265_ODOM_TF=False
export FIX_D435i_IMU=False

# Visual SLAM
export PUBLISH_VISUAL_SLAM_TF=True
export USE_T265=False
export USE_GPS=False

# EKF
export RUN_EKF=True
export RUN_DUAL_EKF=False

# Visual odometry
export RUN_RDGD_ODOMETRY=False
export RUN_STEREO_ODOMETRY=False
export RUN_ICP_ODOMETRY=False

Launch VAULT:

ros2 launch vault_bringup vault.launch.py

Using a Linux service

See vault_service README.

Troubleshooting

Only the D435i is detected (T265 not found)

Check that TM2 is really compiled into the workspace library:

strings ~/ros2_ws/install/librealsense2/lib/librealsense2.so.2.50.0 | grep -c -i t265

A result of 0 means the build disabled TM2. Look for this line:

No internet connection, disabling BUILD_WITH_TM2

in ~/ros2_ws/log/latest_build/librealsense2/stderr.log. BUILD_WITH_TM2=ON in CMakeCache.txt is not enough: CMake/connectivity_check.cmake overrides it. Apply the patch and rebuild as described in Installation.

fix_odom_frame_node: "vaultt265_pose_frame" ... does not exist

The T265 node creates frame IDs from its ROS namespace, so /vault/t265 becomes vaultt265_pose_frame, while the URDF defines vault_t265_pose_frame. t265.launch.py now passes pose_frame_id:=<namespace>_t265_pose_frame through rs.launch.py, so the odometry uses the URDF frame.

Verify:

ros2 topic echo --once /vault/t265/odom/sample | grep -E "frame_id|child_frame_id"
# frame_id: vaultt265_odom_frame
# child_frame_id: vault_t265_pose_frame

ros2 topic echo --once /vault/t265/odom | grep -E "frame_id|child_frame_id"
# frame_id: odom
# child_frame_id: base_link

If you have an older workspace, forward pose_frame_id in vault_sensors/launch/rs.launch.py and pass it from t265.launch.py.

undefined symbol: rs2_create_context_ex

The camera node was compiled against the ROS apt librealsense 2.59 headers but loads the 2.50 library. Remove ros-humble-librealsense2 (and the apt camera packages) and rebuild realsense2_camera with a clean cache. Verify:

nm -D ~/ros2_ws/install/realsense2_camera/lib/librealsense2_camera.so | grep rs2_create_context
# must show U rs2_create_context, not U rs2_create_context_ex

ldconfig: Can't create temporary cache file /etc/ld.so.cache~: Permission denied

Harmless. librealsense runs ldconfig during installation as the normal user, so it cannot update the system loader cache. The workspace uses LD_LIBRARY_PATH from install/setup.bash, so the cameras work without it. If you want to refresh the system cache, run sudo ldconfig; the workspace prefix is not in /etc/ld.so.conf.d, so this is not required.

T265 connected over USB 2.1

tm-device.cpp logs:

Streaming T265 video over USB 2.1 is unreliable, please use USB 3 or only stream poses

Pose and IMU are fine at 200 Hz with enable_fisheye:=False, which is the default in t265.launch.py. For fisheye streams, connect the T265 directly to a USB 3 port, preferably on a controller not shared with the D435i.

About

VAULT (Visual and Autonomous Localization Kit) for ROS 2

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages