当前位置:网站首页>Installation and operation of orb-slam2 under ROS

Installation and operation of orb-slam2 under ROS

2022-07-26 03:08:00 hong_ cy&

This blog has sorted out ROS install ,ORB-slam2 install ,ROS Of ORB-slam2 install


1.ROS install

http://www.autolabor.com.cn/book/ROSTutorials/chapter1/12-roskai-fa-gong-ju-an-zhuang.html

When installing ,sudo rosdep init and rosdep update Failure , You will encounter connection problems , Use the method provided by the following connection to install

https://blog.csdn.net/qq_35813104/article/details/117332670

thus ,ROS installation is complete , have access to roscore verification .


2.ORB-SLAM2 install

2.1 Installation tools

 sudo apt-get install cmake
 
 sudo apt-get install git
 
 sudo apt-get install gcc g++  

2.2 install Pangolin

Pangolin It's right OpenGL Lightweight to encapsulate OpenGL Input / Output and video display library . It can be used for 3D Visual and 3D Visual map of navigation , You can input all kinds of videos 、 And you can keep video and input data for debug.

Installation dependency

 sudo apt-get install libglew-dev
 
 sudo apt-get install libboost-dev libboost-thread-dev libboost-filesystem-dev
 
 sudo apt-get install libpython2.7-dev

install Pangolin

Pangolin Download link :

https://github.com/stevenlovegrove/Pangolin

The recommended version is V0.5, This can be avoided Eigen3 Report errors .

 2.3 install Eigeb

sudo apt-get install libeigen3-dev

2.4 install opencv

opencv Official download address :Releases - OpenCV

Choose the version 3.4.0, Download and unzip

cd opencv3.4.0
mkdir build
cd build
cmake ..
make -j2
sudo make install

2.5 install ORB-SLAM2

git clone https://github.com/raulmur/ORB_SLAM2.git ORB_SLAM2
cd ORB_SLAM2
chmod +x build.sh
./build.sh

An error will be reported here  

resolvent :

In all the wrong documents , Add header file :

#include <unistd.h>

There are many documents , You need to be patient and continue to report errors before adding .

Come here ORB-SLAM2 Just install it .

2.6 ROS Of ORB-SLAM2 install

2.6.1 Add environment variables

  export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:PATH/ORB_SLAM2/Examples/ROS

2.6.2 compile ROS file

  chmod +x build_ros.sh
  ./build_ros.sh

./build_ros.sh There will be many errors as follows :

 

Refer to this blog to solve

https://blog.csdn.net/qq_44725448/article/details/117107020?spm=1001.2101.3001.6661.1&utm_medium=distribute.pc_relevant_t0.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-1-117107020-blog-104906376.pc_relevant_multi_platform_whitelistv1&depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-1-117107020-blog-104906376.pc_relevant_multi_platform_whitelistv1&utm_relevant_index=1

2.6.3 Run camera

compile USB( Download address :GitHub - ros-drivers/usb_cam: A ROS Driver for V4L USB Cameras

Pay attention to revision src/usb_cam-develop/launch In the document launch, It needs to be modified to its own equipment number .

mkdir -p ./usb_cam_ws/src
catkin_init_workspace

// hold usb_cam Put it in usb_cam_ws/src Next 

cd usb_cam_ws/
catkin_make
source devel/setup.bash

Open a new terminal , function

roscore
// A new terminal 
roslaunch usb_cam usb_cam-test.launch

3 function ORB-SLAM2

3.1 Download datasets

Tum Data sets :Computer Vision Group - Dataset Download

Download and unzip , Finally put it in ORB-SLAM2 Under the path . It is recommended to use fr1/xyz Data sets

3.2 function

./Examples/Monocular/mono_tum Vocabulary/ORBvoc.txt Examples/Monocular/TUM1.yaml /home/hong/ORB_SLAM2/data/rgbd_dataset_freiburg1_xyz

3.3 Use ROS function ORB-SLAM2

Reference resources 2.6.3, Run camera

function rostopic list view message

gedit /home/hong/Desktop/ORB_SLAM2-master/ORB_SLAM2-master/Examples/ROS/ORB_SLAM2/src/ros_mono.cc

Change the subscribed topic to camera topic

function ORB-SLAM2( If there are no tracks and keyframes , You need to adjust your camera resolution or camera internal parameters , It may be that there is a big difference between the default values of your internal participation , It makes it impossible to solve )

// A new terminal 
source ~/.bashec
rosrun ORB_SLAM2 Mono /home/hong/Desktop/ORB_SLAM2-master/ORB_SLAM2-master/Vocabulary/ORBvoc.txt /home/hong/Desktop/ORB_SLAM2-master/ORB_SLAM2-master/Examples/Monocular/TUM1.yaml

 

原网站

版权声明
本文为[hong_ cy&]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/201/202207182327514664.html