Use your own index camera to run orbslam 2 mono, binocular, and depth modes (common to minimax and realsense)

Posted by GeXus on Tue, 09 Jun 2020 09:10:33 +0200

Process Overview

Configure ROS

ROS environment preparation (take 16.04 ROS Kinetic as an example)

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /
, → etc/apt/sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key␣
, → C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
sudo apt-get update
sudo apt-get install ros-kinetic-desktop-full
sudo rosdep init
rosdep update
echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
source ~/.bashrc

Create your own workspace:

mkdir -p ~/catkin_ws/src  //create folder
cd ~/catkin_ws/src        //Locate to src
catkin_init_workspace     //Initialize workspace

Configure orblam

You can use git directly. If the network speed is not good, you can directly compress the following packets:
Download address: https://webdiis.unizar.es/~raulmur/orbslam/:.

Compiling ORBSLAM2 ROS

After preparing the dependency library according to the steps on github, execute:

cd catkin_ws/src
git clone https://github.com/raulmur/ORB_SLAM2.git ORB_SLAM2
cd ORB_SLAM2
chmod +x build.sh
./build.sh
#We need to use their ros library, so execute
chmod +x build_ros.sh
./build_ros.sh

If the execution is successful, we can see the generated mono, mono AR, rgbd and stereo files under ROS/ORBSLAM2 of Examples

Common errors and Solutions

Run build-ros.sh Problem 1:

[rosbuild] rospack found package "ORB_SLAM2" at "", but the current   directory is "/home/angelo/ORB_SLAM2/Examples/ROS/ORB_SLAM2".  You should   double-check your ROS_PACKAGE_PATH to ensure that packages are found in the   correct precedence order.

Solution:

 sudo ln -s ~/ORB_SLAM2/Examples/ROS/ORB_SLAM2 /opt/ros/<ros Version name>/share/ORB_SLAM2

Run build-ros.sh Problem 2: the core of this problem is the problem with the link boost library

/usr/bin/ld: CMakeFiles/RGBD.dir/src/ros_rgbd.cc.o: undefined reference to symbol '_ZN5boost6system15system_categoryEv'
/usr/lib/x86_64-linux-gnu/libboost_system.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
CMakeFiles/RGBD.dir/build.make:217: recipe for target '../RGBD' failed
make[2]: *** [../RGBD] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/RGBD.dir/all' failed
make[1]: *** [CMakeFiles/RGBD.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
/usr/bin/ld: CMakeFiles/Stereo.dir/src/ros_stereo.cc.o: undefined reference to symbol '_ZN5boost6system15system_categoryEv'
/usr/lib/x86_64-linux-gnu/libboost_system.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
CMakeFiles/Stereo.dir/build.make:217: recipe for target '../Stereo' failed
make[2]: *** [../Stereo] Error 1
CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/Stereo.dir/all' failed
make[1]: *** [CMakeFiles/Stereo.dir/all] Error 2

Solution: open examples / ROS / orb_ Cmakelists of slam2, in

set(LIBS 
${OpenCV_LIBS} 
${EIGEN3_LIBS}
${Pangolin_LIBRARIES}
${PROJECT_SOURCE_DIR}/../../../Thirdparty/DBoW2/lib/libDBoW2.so
${PROJECT_SOURCE_DIR}/../../../Thirdparty/g2o/lib/libg2o.so
${PROJECT_SOURCE_DIR}/../../../lib/libORB_SLAM2.so
#There are many solutions to increase the bank, which is the easiest
-lboost_system 
)

Install and configure camera index camera SDK

Github address: https://github.com/INDEMIND/IMSEE-SDK.
Support platform
The SDK is built based on cmake and spans Ubuntu and w in10 platforms. Among them, Ubuntu supports x64/tx2/firefly rk series and other different architectures. At present, the platforms that have passed the test are:

Ubuntu 16.04 on x64
Ubuntu 16.04 on TX2
Ubuntu 16.04 on RK3328

Compiling ROS samples

The makefile file has been written, so it's very simple

cd <sdk>
make ros

function

cd <sdk>
sudo su # Enter permission mode
source ros/devel/setup.bash
roslaunch imsee_ros_wrapper start.launch # If you want to preview rviz, run roslaunch imsee_ ros_ wrapper  display.launch

View publishing node

rostopic list

We need the following Topic names:

/imsee/camera_info#Camera information
/imsee/depth#Depth map
/imsee/image/left#Left camera image
/imsee/image/right#Right camera image
/imsee/imu#imu information

In this way, we can directly change the topic of ORBSLAM2ROS to read the camera content

ORBSLAM2ROS reading camera content

cd ~/catkin_ws/src/ORB_SLAM2/Examples/ROS/ORB_SLAM2/src
 ros_mono.cc #Single directory ros source file
 ros_rgbd.cc #Deep camera ros source file
 ros_stereo.cc #Binocular ros source file

Take the binocular camera as an example, find the part of ros subscription topic, and change the content to the following:

ros::NodeHandle nh;
//The part of the topic is changed to the topic name subscribed by the ideandsdk topic. Here is the left camera and the right camera
message_filters::Subscriber<sensor_msgs::Image> left_sub(nh, "/imsee/image/left", 1);
message_filters::Subscriber<sensor_msgs::Image> right_sub(nh, "/imsee/image/right", 1);
typedef message_filters::sync_policies::ApproximateTime<sensor_msgs::Image, sensor_msgs::Image> sync_pol;
message_filters::Synchronizer<sync_pol> sync(sync_pol(10), left_sub,right_sub);
sync.registerCallback(boost::bind(&ImageGrabber::GrabStereo,&igb,_1,_2));

ros::spin();

Start camera and ORBSLAM2_ROS

Start camera

cd <sdk>
sudo su # Enter permission mode
source ros/devel/setup.bash
roslaunch imsee_ros_wrapper start.launch # If you want to preview rviz, run roslaunch imsee_ ros_ wrapper  display.launch

Start ORBSLAM2_ROS

cd ~/catkin_ws/src/ORB_SLAM2/Examples/ROS/ORB_SLAM2
#ORBvoc.txt For dictionary content, the Asus.yaml It is the internal parameter format of the camera, which can be changed according to its own calibration results. false is whether to correct the flag bit
rosrun ORB_SLAM2 Stereo  ../../../Vocabulary/ORBvoc.txt Asus.yaml false

If this error is reported, reopen a terminal and open roscore:

[ERROR] [1591685038.629400679]: [registerPublisher] Failed to contact master at [localhost:11311].  Retrying...
#Reopen a terminal and enter:
roscore

Usage of three nodes

Note that the last parameter of the Stereo node means whether to correct or not, which is generally set to false. For more details, you can view the document as required:

#Monocular
Usage: rosrun ORB_SLAM2 Mono path_to_vocabulary path_to_settings
#Depth camera
Usage: rosrun ORB_SLAM2 RGBD path_to_vocabulary path_to_settings
#Binocular camera
Usage: rosrun ORB_SLAM2 Stereo path_to_vocabulary path_to_settings do_rectify

Operation results

So far, it has been successfully run:

Topics: sudo SDK Ubuntu github