欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

install ORB_SLAM2 for rtabmap

程序员文章站 2024-03-25 19:04:40
...

安装 Pangolin
https://github.com/stevenlovegrove/Pangolin.git

sudo apt install libglew-dev

mkdir build
cd build
cmake …
make –j4
sudo make install


安装ORB_SLAM2
https://github.com/raulmur/ORB_SLAM2
catkin_ws_vins-fusion/src/ORB_SLAM2/CMakeLists.txt 删除“-march=native”
catkin_ws_vins-fusion/src/ORB_SLAM2/Thirdparty/g2o/CMakeLists.txt 删除“-march=native”
catkin_ws_vins-fusion/src/ORB_SLAM2/Thirdparty/DBoW2/CMakeLists.txt 删除“-march=native”

‘_ZN5boost6system15system_categoryEv’
ORB_SLAM2/Examples/ROS/ORB_SLAM2/CMakeLists.txt
find_package(Boost REQUIRED system)
${Boost_SYSTEM_LIBRARY}

gedit ~/.bashrc
export ORB_SLAM2_ROOT_DIR=/home/q/packages/ORB_SLAM2

echo “export
ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:/home/q/packages/ORB_SLAM2/Examples/ROS/ORB_SLAM2” >> ~/.bashrc
source ~/.bashrc

重新启动

编译的时候要调整顺序 不知道为什么

将 make -j 改成 make -j4
./build.sh
./build_ros.h

include_directories("/home/q/Packages/gtsam/gtsam/3rdparty/Eigen")

error: ‘usleep’ was not declared in this scope

下面文件中添加头文件: #include <unistd.h>
gedit /home/q/Projects/catkin_ws_vins-fusion/src/ORB_SLAM2/src/System.cc
gedit /home/q/Projects/catkin_ws_vins-fusion/src/ORB_SLAM2/src/Tracking.cc
gedit /home/q/Projects/catkin_ws_vins-fusion/src/ORB_SLAM2/src/LoopClosing.cc
gedit /home/q/Projects/catkin_ws_vins-fusion/src/ORB_SLAM2/src/LocalMapping.cc:
gedit /home/q/Projects/catkin_ws_vins-fusion/src/ORB_SLAM2/src/LocalMapping.cc
gedit /home/q/Projects/catkin_ws_vins-fusion/src/ORB_SLAM2/src/LoopClosing.cc
gedit /home/q/Projects/catkin_ws_vins-fusion/src/ORB_SLAM2/src/LocalMapping.cc
gedit /home/q/Projects/catkin_ws_vins-fusion/src/ORB_SLAM2/src/Viewer.cc

gedit /home/q/Projects/catkin_ws_vins-fusion/src/ORB_SLAM2/Examples/RGB-D/rgbd_tum.cc
gedit /home/q/Projects/catkin_ws_vins-fusion/src/ORB_SLAM2/Examples/Stereo/stereo_kitti.cc
gedit /home/q/Projects/catkin_ws_vins-fusion/src/ORB_SLAM2/Examples/Stereo/stereo_euroc.cc
gedit /home/q/Projects/catkin_ws_vins-fusion/src/ORB_SLAM2/Examples/Monocular/mono_tum.cc
gedit /home/q/Projects/catkin_ws_vins-fusion/src/ORB_SLAM2/Examples/Monocular/mono_kitti.cc
gedit /home/q/Projects/catkin_ws_vins-fusion/src/ORB_SLAM2/Examples/Monocular/mono_euroc.cc

gedit /home/q/Projects/catkin_ws_vins-fusion/src/ORB_SLAM2/Examples/ROS/ORB_SLAM2/src/AR/ViewerAR.cc


测试ORB_SLAM2
ResourceNotFound: rgbd_launch
ROS path [0]=/opt/ros/kinetic/share/ros
ROS path [1]=/home/q/projects/catkin_ws-vins_fusion/src
ROS path [2]=/opt/ros/kinetic/share

sudo apt-get install ros-kinetic-rgbd-launch
sudo apt-get install ros-kinetic-ddynamic-reconfigure

Failed to open settings file at: Examples/RGB-D/TUM1.yaml
chmod 777 TUM1.yaml

[rospack] Error: package ‘ORB_SLAM2’ not found

RGBD:

  1. roslaunch realsense2_camera rs_rgbd.launch
    rostopic list
    /camera/color/image_raw
    /camera/depth/image_rect_raw

  2. gedit /home/q/Projects/catkin_ws_vins-fusion/src/ORB_SLAM2/Examples/ROS/ORB_SLAM2/src/ros_rgbd.cc
    message_filters::Subscriber<sensor_msgs::Image> rgb_sub(nh, “/camera/rgb/image_raw”, 1);
    message_filters::Subscriber<sensor_msgs::Image> depth_sub(nh, “camera/depth_registered/image_raw”, 1);

cd /ORB_SLAM2
rosrun ORB_SLAM2 RGBD Vocabulary/ORBvoc.txt Examples/RGB-D/TUM1.yaml /camera/rgb/image_raw:=/camera/color/image_raw camera/depth_registered/image_raw:=/camera/depth/image_rect_raw

[rospack] Error: package ‘ORB_SLAM2’ not found

source /opt/ros/kinetic/setup.bash
source /home/q/projects/catkin_ws-vins_fusion/devel/setup.bash
export ROS_PACKAGE_PATH=/opt/ros/kinetic/share:/home/q/packages/ORB_SLAM2/Examples/ROS/ORB_SLAM2

确保这个执行顺序 可以解决上面的问题

双目:

  1. roslaunch realsense2_camera rs_camera.launch
    rostopic list
    /camera/infra1/image_rect_raw
    /camera/infra2/image_rect_raw

  2. gedit /home/q/Projects/catkin_ws_vins-fusion/src/ORB_SLAM2/Examples/ROS/ORB_SLAM2/src/ros_stereo.cc
    message_filters::Subscriber<sensor_msgs::Image> left_sub(nh, “/camera/left/image_raw”, 1);
    message_filters::Subscriber<sensor_msgs::Image> right_sub(nh, “camera/right/image_raw”, 1);
    cd /home/q/Packages/ORB_SLAM2
    rosrun ORB_SLAM2 Stereo Vocabulary/ORBvoc.txt Examples/Stereo/EuRoC.yaml true /camera/left/image_raw:=/camera/infra1/image_rect_raw camera/right/image_raw:=/camera/infra2/image_rect_raw

单目:

  1. roslaunch realsense2_camera rs_camera.launch
    rostopic list
    /camera/color/image_raw

  2. gedit /home/q/Projects/catkin_ws_vins-fusion/src/ORB_SLAM2/Examples/ROS/ORB_SLAM2/src/ros_mono.cc
    ros::Subscriber sub = nodeHandler.subscribe("/camera/image_raw", 1, &ImageGrabber::GrabImage,&igb);
    ros::Subscriber sub = nodeHandler.subscribe("/camera/image_raw", 1, &ImageGrabber::GrabImage,&igb);

        cd /home/q/Projects/catkin_ws_vins-fusion/src/ORB_SLAM2
    
        rosrun ORB_SLAM2 Mono Vocabulary/ORBvoc.txt Examples/Stereo/EuRoC.yaml /camera/image_raw:=/camera/color/image_raw