环境

源码下载

1
2
3
mkdir -p ~/ros2_ws/src
cd ~/ros2_ws/src
git clone https://github.com/dreamer198/open_vins.git

依赖安装

1
2
3
4
5
6
7
8
9
10
source /opt/ros/humble/setup.bash

sudo apt-get update
sudo apt-get install -y \
libeigen3-dev \
libboost-all-dev \
libceres-dev \
python3-colcon-common-extensions \
ros-humble-ros2bag \
ros-humble-rosbag2*

编译

进入工作空间根目录:

1
cd ~/ros2_ws

直接使用 colcon build 可能会因为并行编译占用内存过高而卡死,建议限制并行度:

1
2
MAKEFLAGS="-j8" CMAKE_BUILD_PARALLEL_LEVEL=1 \
colcon build --executor sequential --packages-select ov_core ov_init ov_msckf

如果在 Jetson Orin NX 上遇到 OpenCV 缺少 aruco 模块的问题,可以关闭 ArUco Tag 支持后重新编译:

1
2
3
MAKEFLAGS="-j8" CMAKE_BUILD_PARALLEL_LEVEL=1 \
colcon build --executor sequential --packages-select ov_core ov_init ov_msckf \
--cmake-args -DENABLE_ARUCO_TAGS=OFF

编译完成后加载环境:

1
source ~/ros2_ws/install/setup.bash

公开数据集测试

下载数据集

数据集下载地址:OpenVINS EuRoC 数据集说明

推荐先下载 Vicon Room 1 01,也就是 V1_01_easy

运行测试

终端 1:启动 OpenVINS。

1
2
3
cd ~/ros2_ws
source install/setup.bash
ros2 launch ov_msckf subscribe.launch.py config:=euroc_mav

终端 2:播放数据集。

1
ros2 bag play V1_01_easy

终端 3:打开 RViz2 可视化。

1
rviz2 -d ~/ros2_ws/src/open_vins/ov_msckf/launch/display_ros2.rviz

RealSense D455测试

启动相机

终端 1:发布双目红外图像和 IMU 数据。

1
2
3
4
5
6
7
8
9
10
11
ros2 launch realsense2_camera rs_launch.py \
enable_color:=false \
enable_depth:=false \
enable_infra1:=true \
enable_infra2:=true \
enable_gyro:=true \
enable_accel:=true \
unite_imu_method:=1 \
depth_module.infra_profile:=640,480,30 \
gyro_fps:=200 \
accel_fps:=200

可以通过 rqt 查看红外图像中是否有红外斑点。如果有,关闭相机发射器:

1
ros2 param set /camera/camera depth_module.emitter_enabled 0

启动 OpenVINS

终端 2:运行 D455 配置。

1
2
3
cd ~/ros2_ws
source install/setup.bash
ros2 launch ov_msckf d455.launch.py enable_rviz:=true enable_mavros:=true

常见问题

  • 编译卡死:降低 MAKEFLAGSCMAKE_BUILD_PARALLEL_LEVEL
  • Jetson 缺少 aruco:编译时添加 --cmake-args -DENABLE_ARUCO_TAGS=OFF
  • 红外图像有斑点:关闭 depth_module.emitter_enabled