我也是根据其他人的教程来的
首先是下载,编译非ROS的ORBSLAM3
这篇文章我完整地走了一边流程,除了编译内存占用我最大为16G,其他一样。
然后是安装D435驱动
这篇文章我只参考了安装D435驱动部分及修改SLAM-ROS部分的订阅话题名。修改ORB_SLAM2_modified/Examples/ROS/ORB_SLAM2/src/ros_rgbd.cc文件,把rgb_topic和depth_topic订阅话题修改为:
"/camera/color/image_raw";
"/camera/aligned_depth_to_color/image_raw";
这篇文章也没有遇到啥问题,只是环境参数那边要注意一下。我出现了这种问题
[rosbuild] rospack found package "XXX" at "", but the current directory
is "/home/fb/XXX/YYY/ZZZ/×××". You should double-check your
ROS_PACKAGE_PATH to ensure that packages are found in the correct
precedence order.
一般需要添加或更改~/.bashrc
gedit ~/.bashrc
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:/home/fb/XXX/YYY/ZZZ/×××
source ~/.bashrc^C
我最后的~/.bashrc为,注意,source ~/.bashrc命令只更新文本中末尾的改动,末尾没改动中间文本改动他认不出来。
安装完后多出来的部分
source /opt/ros/kinetic/setup.bash
source ~/ORBSLAM/realsenseD435ROS/devel/setup.bash
export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:/home/kobosp/ORBSLAM/ORB_SLAM3/Examples/ROS/ORB_SLAM3
编译核心及非ROS部分
chmod +x build.sh
./build.sh
编译ROS部分
chmod +x build_ros.sh
./build_ros.sh
其实我应该搞错了顺序,按道理是先D435驱动,再安装ROS,再下载ORBSLAM3,再编译SLAM3的非ROS,再编译SLAM3的ROS。但是这个顺序能运行,也就算了。
查看是否成功的三个运行命令,roscore,启动相机,启动slam
roscore
roslaunch realsense2_camera rs_rgbd.launch
rosrun ORB_SLAM3 RGBD Vocabulary/ORBvoc.txt Examples/RGB-D/TUM1.yaml
下图是我安装下载过的文件,大部分都是apt-get,一部分是源码编译没安装,有需要的可以从这边下载。没有Datasets和opencv3.2,因为太大,但是ippcv放进去了。
汇报下各版本吧
kobosp@gl62u:~/ORBSLAM/ORB_SLAM3$ cmake --version
cmake version 3.5.1
kobosp@gl62u:~/ORBSLAM/ORB_SLAM3$ python --version
Python 2.7.12
eigen:3.3.90// /home/kobosp/ORBSLAM/eigen-git-mirror/Eigen/src/Core/util/Macros.h
kobosp@gl62u:~/ORBSLAM/ORB_SLAM3$ python
Python 2.7.12 (default, Oct 5 2020, 13:56:01)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> print(cv2.__version__)
3.3.1-dev
>>>
运行命令记录
kobosp@gl62u:~/ORBSLAM/ORB_SLAM3$ roscore
... logging to /home/kobosp/.ros/log/d04d2148-6adf-11eb-9217-2e2f4a56b392/roslaunch-gl62u-18233.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
started roslaunch server http://gl62u:33711/
ros_comm version 1.12.17
SUMMARY
========
PARAMETERS
* /rosdistro: kinetic
* /rosversion: 1.12.17
NODES
auto-starting new master
process[master]: started with pid [18252]
ROS_MASTER_URI=http://gl62u:11311/
setting /run_id to d04d2148-6adf-11eb-9217-2e2f4a56b392
process[rosout-1]: started with pid [18265]
started core service [/rosout]
^C[rosout-1] killing on exit
[master] killing on exit
shutting down processing monitor...
... shutting down processing monitor complete
done
kobosp@gl62u:~/ORBSLAM/ORB_SLAM3$ roslaunch realsense2_camera rs_rgbd.launch
... logging to /home/kobosp/.ros/log/d04d2148-6adf-11eb-9217-2e2f4a56b392/roslaunch-gl62u-18382.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
started roslaunch server http://gl62u:42515/
SUMMARY
========
PARAMETERS
* /camera/realsense2_camera/accel_fps: 250
* /camera/realsense2_camera/accel_frame_id: camera_accel_frame
* /camera/realsense2_camera/accel_optical_frame_id: camera_accel_opti...
* /camera/realsense2_camera/align_depth: True
* /camera/realsense2_camera/aligned_depth_to_color_frame_id: camera_aligned_de...
* /camera/realsense2_camera/aligned_depth_to_fisheye1_frame_id: camera_aligned_de...
* /camera/realsense2_camera/aligned_depth_to_fisheye2_frame_id: camera_aligned_de...
* /camera/realsense2_camera/aligned_depth_to_fisheye_frame_id: camera_aligned_de...
* /camera/realsense2_camera/aligned_depth_to_infra1_frame_id: camera_aligned_de...
* /camera/realsense2_camera/aligned_depth_to_infra2_frame_id: camera_aligned_de...
* /camera/realsense2_camera/allow_no_texture_points: False
* /camera/realsense2_camera/base_frame_id: camera_link
* /camera/realsense2_camera/calib_odom_file:
* /camera/realsense2_camera/clip_distance: -1.0
* /camera/realsense2_camera/color_fps: 30
* /camera/realsense2_camera/color_frame_id: camera_color_frame
* /camera/realsense2_camera/color_height: 480
* /camera/realsense2_camera/color_optical_frame_id: camera_color_opti...
* /camera/realsense2_camera/color_width: 640
* /camera/realsense2_camera/depth_fps: 30
* /camera/realsense2_camera/depth_frame_id: camera_depth_frame
* /camera/realsense2_camera/depth_height: 480
* /camera/realsense2_camera/depth_optical_frame_id: camera_depth_opti...
* /camera/realsense2_camera/depth_width: 640
* /camera/realsense2_camera/device_type:
* /camera/realsense2_camera/enable_accel: False
* /camera/realsense2_camera/enable_color: True
* /camera/realsense2_camera/enable_depth: True
* /camera/realsense2_camera/enable_fisheye1: False
* /camera/realsense2_camera/enable_fisheye2: False
* /camera/realsense2_camera/enable_fisheye: False
* /camera/realsense2_camera/enable_gyro: False
* /camera/realsense2_camera/enable_infra1: False
* /camera/realsense2_camera/enable_infra2: False
* /camera/realsense2_camera/enable_infra: False
* /camera/realsense2_camera/enable_pointcloud: False
* /camera/realsense2_camera/enable_pose: False
* /camera/realsense2_camera/enable_sync: True
* /camera/realsense2_camera/filters:
* /camera/realsense2_camera/fisheye1_frame_id: camera_fisheye1_f...
* /camera/realsense2_camera/fisheye1_optical_frame_id: camera_fisheye1_o...
* /camera/realsense2_camera/fisheye2_frame_id: camera_fisheye2_f...
* /camera/realsense2_camera/fisheye2_optical_frame_id: camera_fisheye2_o...
* /camera/realsense2_camera/fisheye_fps: 30
* /camera/realsense2_camera/fisheye_frame_id: camera_fisheye_frame
* /camera/realsense2_camera/fisheye_height: 480
* /camera/realsense2_camera/fisheye_optical_frame_id: camera_fisheye_op...
* /camera/realsense2_camera/fisheye_width: 640
* /camera/realsense2_camera/gyro_fps: 400
* /camera/realsense2_camera/gyro_frame_id: camera_gyro_frame
* /camera/realsense2_camera/gyro_optical_frame_id: camera_gyro_optic...
* /camera/realsense2_camera/imu_optical_frame_id: camera_imu_optica...
* /camera/realsense2_camera/infra1_frame_id: camera_infra1_frame
* /camera/realsense2_camera/infra1_optical_frame_id: camera_infra1_opt...
* /camera/realsense2_camera/infra2_frame_id: camera_infra2_frame
* /camera/realsense2_camera/infra2_optical_frame_id: camera_infra2_opt...
* /camera/realsense2_camera/infra_fps: 30
* /camera/realsense2_camera/infra_height: 480
* /camera/realsense2_camera/infra_width: 640
* /camera/realsense2_camera/initial_reset: False
* /camera/realsense2_camera/json_file_path:
* /camera/realsense2_camera/linear_accel_cov: 0.01
* /camera/realsense2_camera/odom_frame_id: camera_odom_frame
* /camera/realsense2_camera/pointcloud_texture_index: 0
* /camera/realsense2_camera/pointcloud_texture_stream: RS2_STREAM_COLOR
* /camera/realsense2_camera/pose_frame_id: camera_pose_frame
* /camera/realsense2_camera/pose_optical_frame_id: camera_pose_optic...
* /camera/realsense2_camera/publish_odom_tf: True
* /camera/realsense2_camera/publish_tf: True
* /camera/realsense2_camera/rosbag_filename:
* /camera/realsense2_camera/serial_no:
* /camera/realsense2_camera/tf_publish_rate: 0.0
* /camera/realsense2_camera/topic_odom_in: camera/odom_in
* /camera/realsense2_camera/unite_imu_method: none
* /camera/realsense2_camera/usb_port_id:
* /rosdistro: kinetic
* /rosversion: 1.12.17
NODES
/camera/
color_rectify_color (nodelet/nodelet)
points_xyzrgb_hw_registered (nodelet/nodelet)
realsense2_camera (nodelet/nodelet)
realsense2_camera_manager (nodelet/nodelet)
ROS_MASTER_URI=http://localhost:11311
process[camera/realsense2_camera_manager-1]: started with pid [18399]
process[camera/realsense2_camera-2]: started with pid [18400]
process[camera/color_rectify_color-3]: started with pid [18401]
process[camera/points_xyzrgb_hw_registered-4]: started with pid [18403]
[ INFO] [1612879518.827348843]: Initializing nodelet with 8 worker threads.
[ INFO] [1612879519.012247948]: RealSense ROS v2.2.15
[ INFO] [1612879519.012329406]: Built with LibRealSense v2.36.0
[ INFO] [1612879519.012375359]: Running with LibRealSense v2.36.0
[ INFO] [1612879519.054005634]:
[ INFO] [1612879519.074595826]: Device with serial number 933322073616 was found.
[ INFO] [1612879519.074660480]: Device with physical ID /sys/devices/pci0000:00/0000:00:14.0/usb2/2-3/2-3:1.0/video4linux/video0 was found.
[ INFO] [1612879519.074688173]: Device with name Intel RealSense D435 was found.
[ INFO] [1612879519.075320331]: Device with port number 2-3 was found.
[ INFO] [1612879519.083686748]: getParameters...
[ INFO] [1612879519.152006800]: setupDevice...
[ INFO] [1612879519.152035571]: JSON file is not provided
[ INFO] [1612879519.152054402]: ROS Node Namespace: camera
[ INFO] [1612879519.152085073]: Device Name: Intel RealSense D435
[ INFO] [1612879519.152099279]: Device Serial No: 933322073616
[ INFO] [1612879519.152120438]: Device physical port: /sys/devices/pci0000:00/0000:00:14.0/usb2/2-3/2-3:1.0/video4linux/video0
[ INFO] [1612879519.152138335]: Device FW version: 05.12.06.00
[ INFO] [1612879519.152155644]: Device Product ID: 0x0B07
[ INFO] [1612879519.152170969]: Enable PointCloud: Off
[ INFO] [1612879519.152185837]: Align Depth: On
[ INFO] [1612879519.152200913]: Sync Mode: On
[ INFO] [1612879519.152351390]: Device Sensors:
[ INFO] [1612879519.167181755]: Stereo Module was found.
09/02 22:05:19,167 WARNING [139669354628864] (backend-v4l2.cpp:1223) Pixel format 36315752-1a66-a242-9065-d01814a likely requires patch for fourcc code RW16!
[ INFO] [1612879519.195368918]: RGB Camera was found.
[ INFO] [1612879519.195442426]: num_filters: 0
[ INFO] [1612879519.195485336]: Setting Dynamic reconfig parameters.
[ INFO] [1612879519.305220336]: Done Setting Dynamic reconfig parameters.
[ INFO] [1612879519.306306208]: depth stream is enabled - width: 640, height: 480, fps: 30, Format: Z16
[ INFO] [1612879519.307091465]: color stream is enabled - width: 640, height: 480, fps: 30, Format: RGB8
[ INFO] [1612879519.308739284]: setupPublishers...
[ INFO] [1612879519.313082240]: Expected frequency for depth = 30.00000
[ INFO] [1612879519.355982389]: Expected frequency for color = 30.00000
[ INFO] [1612879519.397358837]: Expected frequency for aligned_depth_to_color = 30.00000
[ INFO] [1612879519.432213135]: setupStreams...
[ INFO] [1612879519.433293440]: insert Depth to Stereo Module
[ INFO] [1612879519.433333544]: insert Color to RGB Camera
[ INFO] [1612879519.450828066]: SELECTED BASE:Depth, 0
[ INFO] [1612879519.463781146]: RealSense Node Is Up!
09/02 22:05:19,573 WARNING [139669106845440] (ds5-timestamp.cpp:73) UVC metadata payloads not available. Please refer to the installation chapter for details.
[ WARN] [1612879519.584285330]: Frame metadata isn't available! (frame_timestamp_domain = RS2_TIMESTAMP_DOMAIN_SYSTEM_TIME)
09/02 22:05:19,884 WARNING [139669115238144] (ds5-timestamp.cpp:73) UVC metadata payloads not available. Please refer to the installation chapter for details.
^C[camera/points_xyzrgb_hw_registered-4] killing on exit
[camera/color_rectify_color-3] killing on exit
[camera/realsense2_camera-2] killing on exit
[camera/realsense2_camera_manager-1] killing on exit
shutting down processing monitor...
... shutting down processing monitor complete
done
kobosp@gl62u:~/ORBSLAM/ORB_SLAM3$
kobosp@gl62u:~/ORBSLAM/ORB_SLAM3$ rosrun ORB_SLAM3 RGBD Vocabulary/ORBvoc.txt Examples/RGB-D/TUM1.yaml
ORB-SLAM3 Copyright (C) 2017-2020 Carlos Campos, Richard Elvira, Juan J. Gómez, José M.M. Montiel and Juan D. Tardós, University of Zaragoza.
ORB-SLAM2 Copyright (C) 2014-2016 Raúl Mur-Artal, José M.M. Montiel and Juan D. Tardós, University of Zaragoza.
This program comes with ABSOLUTELY NO WARRANTY;
This is free software, and you are welcome to redistribute it
under certain conditions. See LICENSE.txt.
Input sensor was set to: RGB-D
Loading ORB Vocabulary. This could take a while...
Vocabulary loaded!
Creation of new map with id: 0
Creation of new map with last KF id: 0
Seq. Name:
Camera Parameters:
- Camera: Pinhole
- fx: 517.306
- fy: 516.469
- cx: 318.643
- cy: 255.314
- k1: 0.262383
- k2: -0.953104
- p1: -0.005358
- p2: 0.002628
- k3: 1.16331
- fps: 30
- color order: RGB (ignored if grayscale)
Depth Threshold (Close/Far Points): 0
ORB Extractor Parameters:
- Number of Features: 1000
- Scale Levels: 8
- Scale Factor: 1.2
- Initial Fast Threshold: 20
- Minimum Fast Threshold: 7
First KF:0; Map init KF:0
New Map created with 929 points
Fail to track local map!
LM: Active map reset recieved
LM: Active map reset, waiting...
LM: Reseting current map in Local Mapping...
LM: End reseting Local Mapping...
LM: Reset free the mutex
LM: Active map reset, Done!!!
mnFirstFrameId = 0
mnInitialFrameId = 0
22 Frames set to lost
First KF:5; Map init KF:0
New Map created with 991 points
TRACK_REF_KF: Less than 15 matches!!
KF in map: 15
Fail to track local map!
Fail to track local map!
Creation of new map with id: 1
Exits current map
Saved map with ID: 0
Creation of new map with last KF id: 20
First KF:20; Map init KF:20
New Map created with 1033 points
Fail to track local map!
Creation of new map with id: 2
Exits current map
Saved map with ID: 1
Creation of new map with last KF id: 27
First KF:27; Map init KF:27
New Map created with 603 points
TRACK_REF_KF: Less than 15 matches!!
KF in map: 32
Fail to track local map!
Fail to track local map!
Creation of new map with id: 3
Exits current map
Saved map with ID: 2
Creation of new map with last KF id: 59
First KF:59; Map init KF:59
New Map created with 600 points
TRACK_REF_KF: Less than 15 matches!!
Fail to track local map!
LM: Active map reset recieved
LM: Active map reset, waiting...
LM: Reseting current map in Local Mapping...
LM: End reseting Local Mapping...
LM: Reset free the mutex
LM: Active map reset, Done!!!
mnFirstFrameId = 23
mnInitialFrameId = 130
0 Frames set to lost
First KF:60; Map init KF:59
New Map created with 664 points
TRACK_REF_KF: Less than 15 matches!!
Fail to track local map!
LM: Active map reset recieved
LM: Active map reset, waiting...
LM: Reseting current map in Local Mapping...
LM: End reseting Local Mapping...
LM: Reset free the mutex
LM: Active map reset, Done!!!
mnFirstFrameId = 23
mnInitialFrameId = 131
0 Frames set to lost
First KF:61; Map init KF:60
New Map created with 570 points
TRACK_REF_KF: Less than 15 matches!!
Fail to track local map!
LM: Active map reset recieved
LM: Active map reset, waiting...
LM: Reseting current map in Local Mapping...
LM: End reseting Local Mapping...
LM: Reset free the mutex
LM: Active map reset, Done!!!
mnFirstFrameId = 23
mnInitialFrameId = 133
0 Frames set to lost
First KF:62; Map init KF:61
New Map created with 585 points
TRACK_REF_KF: Less than 15 matches!!
Fail to track local map!
LM: Active map reset recieved
LM: Active map reset, waiting...
LM: Reseting current map in Local Mapping...
LM: End reseting Local Mapping...
LM: Reset free the mutex
LM: Active map reset, Done!!!
mnFirstFrameId = 23
mnInitialFrameId = 135
0 Frames set to lost
First KF:63; Map init KF:62
New Map created with 964 points
Fail to track local map!
LM: Active map reset recieved
LM: Active map reset, waiting...
LM: Reseting current map in Local Mapping...
LM: End reseting Local Mapping...
LM: Reset free the mutex
LM: Active map reset, Done!!!
mnFirstFrameId = 23
mnInitialFrameId = 137
0 Frames set to lost
First KF:64; Map init KF:63
New Map created with 656 points
^CmpLocalMapper is not finished
mpLocalMapper is not finished
mpLocalMapper is not finished
Saving keyframe trajectory to KeyFrameTrajectory.txt ...
QObject::~QObject: Timers cannot be stopped from another thread
kobosp@gl62u:~/ORBSLAM/ORB_SLAM3$