Implement binocular ORB_SLAM2 under ROS with your own binocular camera

Implement binocular ORB_SLAM2 under ROS  with your own binocular camera

Reference blog

Monocular SLAM under ROS

https://blog.csdn.net/goding_learning/article/details/52950993

 

Configure ORB_SLAM2 under ROS

The first step is to prepare the basic dependencies

   1.1 Install pangolin

1. $ sudo apt-get install libglew-dev   #安装Glew  

2. $ sudo apt-get install cmake         #安装CMake  

3. #Install Boost  

4. $ sudo apt-get install libboost-dev libboost-thread-dev libboost-filesystem-dev  

5. $ sudo apt-get install libpython2.7-dev  #安装Python2 / Python3  

6. #Download , compile, install Pangolin:  

7. $ git clone https://github.com/stevenlovegrove/Pangolin.git  

8. $ cd Pangolin  

9. $ mkdir build  

10. $ cd build  

11. $ cmake -DCPP11_NO_BOOST=1 ..  

12. $ make  

13. $ sudo make install  

 1.2 Install opencv2.4.13

 1.3  Install eigen3.1.0

sudo apt-get install libeigen3-dev  

1.4BLAS and LAPACK

$ sudo apt-get install libblas-dev  

$ sudo apt-get install liblapack-dev 

1.4DBoW2 and g2o (Included in Thirdparty folder)

   ORB_SLAM2 uses a modified version of the DBoW2 library for location recognition and the g2o library for nonlinear optimization. The two modified versions of the library are placed in a third-party folder

 

The second step is to create a ROS workspace, download the ORB_SLAM2 code to the catkin_ws/src directory, and compile it

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

2. $ cd ORB_SLAM2  

3. $ chmod +x build.sh  

4. $ ./build.sh  

The third step, compile the ORB_SLAM2 package under ROS

1. Enter Examples/ROS/ORB_SLAM2

2、mkdir build

3、cmake .. -DROS_BUILD_TYPE=Release

4、source ~/catkin_ws/devel/setup.bash

The fourth step, monocular experiment

1. Start roscore

2. Start the camera node, depending on the specific startup file

Make sure that sudo /etc/init.d/ueyeusbdrc start has been run [How to join auto-start at boot]

Add boot, reference link:

http://www.jb51.net/os/Ubuntu/181138.html

roslaunch ueye_cam rgb8.launch (launch monocular camera)

or rosrun ueye stereo (boot dual

rosrun ueye stereo _zoom:=2

3. Start the Mono node of ORB_SLAM2

rosrun ORB_SLAM2 Mono PATH_TO_VOCABULARY ( word bag location ) PATH_TO_YMAL_FILE ( ymal camera calibration file location)

 rosrun ORB_SLAM2 Mono src/ORB_SLAM2/Vocabulary/ORBvoc.txt src/ORB_SLAM2/Examples/ROS/ORB_SLAM2/Asus.yaml 

The fifth step, binocular experiment

cd catkin_ws

 rosrun ORB_SLAM2 stereo src/ORB_SLAM2/Vocabulary/ORBvoc.txt src/ORB_SLAM2/Examples/ROS/ORB_SLAM2/Asus.yaml 

l Error report: (Search this, many related experiments, you can learn and learn)

rosrun ORB_SLAM2 Stereo path_to_vocabulary path_to_settings do_rectify

Solution:

https://blog.csdn.net/u013019296/article/details/70051908

https://blog.csdn.net/wangshuailpp/article/details/70231074

rosrun ORB_SLAM2 stereo src/ORB_SLAM2/Vocabulary/ORBvoc.txt src/ORB_SLAM2/Examples/ROS/ORB_SLAM2/Asus.yaml  true

l error again

ERROR: Calibration parameters to rectify stereo are missing!

 Emmmm.... suddenly remembered, the eyes have not been calibrated~~

 

***** Okay, that's it, let's calibrate the camera tomorrow, or bring the documents that have been ordered by the seniors for use ******

rosrun ORB_SLAM2 Stereo src/ORB_SLAM2/Vocabulary/ORBvoc.txt src/ORB_SLAM2/Examples/ROS/ORB_SLAM2/Asus.yaml  false

do_rectify (correction setting, true false ) can be set to false , but there is no binocular image at this time

 

 

At this time, you should check the two nodes from which Stereo under ROS obtains the binocular image, and then correspondingly change the topic name of the image message published after ueye starts the binocular camera.

The topic name where the ORBSLAM2 binocular image is located is

/camera/left/image_raw

/camera/right/image_raw

The topic name of the binocular camera released under ROS is

/left/image_raw

/right/image_raw

Modify the source code under ORBSLAM2 to make the topic name consistent! ! ! Then compile.

 

   catkin_ws/src/ORB_SLAM2/Examples/ROS/ORB_SLAM2/src/ros_stereo.cc file

    message_filters::Subscriber<sensor_msgs::Image> left_sub(nh, "/left/image_raw", 1);//default is /camera/left/image_raw

    message_filters::Subscriber<sensor_msgs::Image> right_sub(nh, "right/image_raw", 1);

Recompile Example

cd ~/catkin_ws/src/ORB_SLAM2/Example/ROS/ORB_SLAM2

mkdir buildcd build

cmake ..

make 

Command again:

rosrun ORB_SLAM2 stereo src/ORB_SLAM2/Vocabulary/ORBvoc.txt src/ORB_SLAM2/Examples/ROS/ORB_SLAM2/Asus.yaml false 

 

*****The problem is that the camera has been in the state of trying to initialize************

****The grayscale image of a camera is displayed under the ccurrent frame window, is there any problem?****

********************The above was recorded on 2018.3.26.00:21****************

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324476060&siteId=291194637