小觅双目摄像头MYNTEYE-S1030-IR和自制双目摄像头测试ORB-SLAM2和RTAB-Map的运行效果对比

文章目录

  • 小觅双目摄像头MYNTEYE-S1030-IR介绍
  • 安装MYNT-EYE-S-SDK
  • 测试 MYNTEYE-S1030-IR
  • 安装MYNT-EYE-ORB-SLAM2
  • 更新mynteye_stereo.yaml
  • MYNTEYE-S1030-IR测试ORB-SLAM2
  • 启动ORB_SLAM2
  • 安装 RTAB-Map
  • 测试 MYNTEYE-S1030-IR 和 RTAB-Map
  • 自制双目测试ORB-SLAM2
  • 编译安装 ORB-SLAM2
  • 启动双目
  • ROS的标定程序
  • my_EuRoC.yaml
  • 对应ORBS_SLAM2和启动文件发布的话题
  • 启动ROS版本的ORB-SLAM2
  • 自制双目测试rtabmap

小觅双目摄像头MYNTEYE-S1030-IR介绍

小觅双目摄像头MYNTEYE-S1030-IR和自制双目摄像头测试ORB-SLAM2和RTAB-Map的运行效果对比_第1张图片
小觅双目摄像头MYNTEYE-S1030-IR和自制双目摄像头测试ORB-SLAM2和RTAB-Map的运行效果对比_第2张图片
MYNTEYE-S1030 IMU 坐标系统为右手系,坐标轴方向如下:
小觅双目摄像头MYNTEYE-S1030-IR和自制双目摄像头测试ORB-SLAM2和RTAB-Map的运行效果对比_第3张图片

安装MYNT-EYE-S-SDK

mkdir -p ~/ROS_WORKSPACE/mynt_eye_sdk/src
cd ROS_WORKSPACE/mynt_eye_sdk/src
git clone https://github.com/slightech/MYNT-EYE-S-SDK.git
cd MYNT-EYE-S-SDK
make ros
catkin_make
echo "source ~/projects/MYNT-EYE-S-SDK-ros-ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc

测试 MYNTEYE-S1030-IR

启动相机
$ roslaunch mynt_eye_ros_wrapper mynteye.launch
查看相机参数
$ rostopic echo /camera/left/camera_info
height: 480
width: 752
D: [-0.024628360830842903, 0.011803068941211532, -0.01915949688970667, 0.007154406666452918]
K: [366.50918740609126, 0.0, 386.5093270920018, 0.0, 366.8379869560307, 232.08703316188272, 0.0, 0.0, 1.0]
R: [0.9999979595595172, 0.0009826702433837831, 0.0017650031146924814, -0.0009806185376207482, 0.9999988429934191, -0.0011629269567731038, -0.0017661438462879147, 0.0011611937891166445, 0.9999977661799543]
P: [366.5676620310404, 0.0, 471.52295684814453, 0.0, 0.0, 366.5676620310404, 211.0217742919922, 0.0, 0.0, 0.0, 1.0, 0.0]
$ rostopic echo /camera/right/camera_info
height: 480
width: 752
D: [-0.023285804571539344, 0.0006527815843054964, -0.003238094413862148, 0.0004478785504401846]
K: [366.08115463414265, 0.0, 386.37531305862893, 0.0, 366.2973371060502, 237.73957691930062, 0.0, 0.0, 1.0]
R: [0.999973740802912, -0.002021678314500715, 0.006959204079721251, 0.002013605610603252, 0.999997291963753, 0.0011668151548464621, -0.0069615441588399395, -0.0011527714228370784, 0.9999751037005729]
P: [366.5676620310404, 0.0, 471.52295684814453, -44016.89788354128, 0.0, 366.5676620310404, 211.0217742919922, 0.0, 0.0, 0.0, 1.0, 0.0]

安装MYNT-EYE-ORB-SLAM2

sudo apt-get install cmake
sudo apt-get install git
sudo apt-get install libgoogle-glog-dev
安装Pangolin、OPENCV、EIGEN3、
git https://github.com/slightech/MYNT-EYE-ORB-SLAM2-Sample.git
export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:~/projects/MYNT-EYE-ORB-SLAM2-Sample
chmod +x build.sh
./build.sh
chmod +x build_ros.sh
./build_ros.sh

更新mynteye_stereo.yaml

使用命令查看参数
rostopic echo /camera/left/camera_info
然后更新相机参数 ORB_SLAM2/config/mynteye_stereo.yaml 

MYNTEYE-S1030-IR测试ORB-SLAM2

启动ORB_SLAM2

启动相机
roslaunch mynt_eye_ros_wrapper mynteye.launch
启动ORB_SLAM2
$ rosrun ORB_SLAM2 mynteye_s_stereo ~/MYNT-EYE-ORB-SLAM2-Sample/Vocabulary/ORBvoc.txt ~/MYNT-EYE-ORB-SLAM2-Sample/config/mynteye_s_stereo.yaml false /camera/left_rect/image_rect  /camera/right_rect/image_rect

运行结果截图
获取运行结果视频:关注公众号"小秋SLAM笔记"回复"MYNT_ORB_Stereo"

安装 RTAB-Map

RTAB-Map | Real-Time Appearance-Based Mapping
RTAB-Map是具有实时约束的全局闭环检测的RGB-D SLAM方法,可用于生成环境的3D点云或创建用于导航的2D网格图。
代码库:

https://github.com/introlab/rtabmap_ros.git
http://introlab.github.io/rtabmap
安装步骤:
sudo apt-get install ros-kinetic-move-base-msgs
mkdir -p rtabmap_ros_ws/src
git clone https://github.com/introlab/rtabmap_ros.git src/rtabmap_ros
cd src
catkin_init_workspace
cd ~
git clone https://github.com/introlab/rtabmap.git rtabmap
cd rtabmap/build
cmake -DWITH_G2O=OFF -DWITH_GTSAM=OFF -DCMAKE_INSTALL_PREFIX=~/projects/rtabmap_ros_ws/devel ..
make -j4
make install
catkin_make -j4
echo "source ~/catkin_ws/devel/setup.bash " >> ~/.bashrc
source ~/.bashrc

测试 MYNTEYE-S1030-IR 和 RTAB-Map

启动相机
roslaunch mynt_eye_ros_wrapper mynteye.launch

坐标转换
rosrun tf static_transform_publisher 0 0 0 -1.5707963267948966 0 -1.5707963267948966 base_link camera_link 100

启动rtabmap_ros
roslaunch rtabmap_ros stereo_mapping.launch stereo_namespace:="/camera" rtabmap_args:="delete_db_on_start --Odom/Strategy 5 --OdomORBSLAM2/VocPath "/home/q/packages/ORB_SLAM2/Vocabulary/ORBvoc.txt"" left_image_topic:=/camera/left_rect/image_rect right_image_topic:=/camera/right_rect/image_rect left_camera_info_topic:=/camera/left/camera_info right_camera_info_topic:=/camera/right/camera_info /rtabmap/odom_info:=/camera/left/camera_info stereo:=true frame_id:=base_link approx_sync:=false

运行结果截图

获取运行结果视频:关注公众号"小秋SLAM笔记"回复"MYNT_RTAB_Stereo"

自制双目测试ORB-SLAM2

编译安装 ORB-SLAM2

git clone https://github.com/raulmur/ORB_SLAM2.git ORB_SLAM2

启动双目

https://github.com/2017qiuju/ROS_notes/blob/master/stereo_usb_cam_stream_publisher.launch
roslaunch stereo_usb_cam_stream_publisher.launch camera_info:=false

ROS的标定程序

自己制作的双目相机,需要标定

rosrun camera_calibration cameracalibrator.py --size 8x6 --square 0.0513 right:=/camera/right/image_raw left:=/camera/left/image_raw right_camera:=/camera/right left_camera:=/camera/left  --no-service-check --approximate=0.1
相机参数文件
ORB_SLAM2/Examples/Stereo/my_EuRoC.yaml
Camera.fx: 383.460032
Camera.fy: 308.387794
Camera.cx: 383.460032
Camera.cy: 248.258961

Camera.width: 640
Camera.height: 480

Camera.bf: 31.328746

LEFT.height: 480
LEFT.width: 640
   data:[374.603856, 0.000000, 313.137638, 0.000000, 373.870146, 237.189168, 0.000000, 0.000000, 1.000000]
   data: [-0.057598, 0.020583, 0.000629, -0.002240, 0.000000]
   data: [0.999870, -0.002801, 0.015848, 0.002829, 0.999994, -0.001789, -0.015842, 0.001833, 0.999873]
   data: [383.460032, 0.000000, 308.387794, 0.000000, 0.000000, 383.460032, 248.258961, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000]

RIGHT.height: 480
RIGHT.width: 640
   data:[-0.063938, 0.025151, 0.002822, -0.002164, 0.0]
   data: [376.15096, 0.0, 322.063066, 0.0, 375.808778, 257.144629, 0.0, 0.0, 1.0]
   data: [0.999942, 0.008355, 0.006758, -0.008368, 0.999963, 0.001783, -0.006743, -0.001839, 0.999976]
   data: [383.460032, 0.0, 308.387794, -31.328746, 0.0, 383.460032, 248.258961, 0.0, 0.0, 0.0, 1.0, 0.0]

my_EuRoC.yaml

摄像头参数写入这个文件/home/q/packages/ORB_SLAM2/Examples/Stereo/my_EuRoC.yaml

对应ORBS_SLAM2和启动文件发布的话题

ORB_SLAM2默认接收的话题和启动文件发布的话题对应,可以使用remap 或者改文件。
打开下面这个文件
ORB_SLAM2/Examples/ROS/ORB_SLAM2/src/ros_stereo.cc

修改对应的话题
message_filters::Subscriber<sensor_msgs::Image> left_sub(nh, "/camera/left/image_rect_color", 1);
message_filters::Subscriber<sensor_msgs::Image> right_sub(nh, "/camera/right/image_rect_color", 1);

启动ROS版本的ORB-SLAM2

roslaunch stereo_usb_cam_stream_publisher.launch camera_info:=true
ROS_NAMESPACE=camera rosrun stereo_image_proc stereo_image_proc _approximate_sync:=true
rosrun tf static_transform_publisher 0 0 0 -1.5707963267948966 0 -1.5707963267948966 base_link  camera_link 100
rosrun image_view stereo_view stereo:=camera image:=image_rect _approximate_sync:=True _queue_size:=10
rosrun ORB_SLAM2 Stereo /home/q/packages/ORB_SLAM2/Vocabulary/ORBvoc.txt /home/q/packages/ORB_SLAM2/Examples/Stereo/my_EuRoC.yaml false

运行结果视频获取方式:关注公众号"小秋SLAM笔记"回复"DIY_ORB"

自制双目测试rtabmap

roslaunch stereo_usb_cam_stream_publisher.launch camera_info:=true

ROS_NAMESPACE=camera rosrun stereo_image_proc stereo_image_proc _approximate_sync:=true

rosrun tf static_transform_publisher 0 0 0 -1.5707963267948966 0 -1.5707963267948966 base_link  camera_link 100

roslaunch rtabmap_ros stereo_mapping.launch stereo_namespace:="/camera" rtabmap_args:="--delete_db_on_start --Odom/Strategy 5 --OdomORBSLAM2/VocPath "/home/q/packages/ORB_SLAM2/Vocabulary/ORBvoc.txt"" left_image_topic:=/camera/left/image_rect_color right_image_topic:=/camera/right/image_rect_color left_camera_info_topic:=/camera/left/camera_info right_camera_info_topic:=/camera/right/camera_info /rtabmap/odom_info:=/camera/left/camera_info stereo:=true frame_id:=base_link approx_sync:=true

运行结果视频获取方式:关注公众号"小秋SLAM笔记"回复"DIY_RTAB"

你可能感兴趣的:(RTAB-Map)