Skip to content
Ishir Roongta edited this page Apr 21, 2020 · 1 revision

Welcome to the PETcat_localization wiki!

We'll be using the repo for openvslam here. The installation guide can be found here:

https://openvslam.readthedocs.io/en/master/installation.html#chapter-installation

Requirements for OpenVSLAM:

  • Eigen
  • g2o
  • DBoW2
  • OpenCV
  • cv_bridge

Scroll down to Installing for Linux section and install the dependencies with the step by step commands given


Eigen : Download and install

cd /path/to/working/dir
wget -q http://bitbucket.org/eigen/eigen/get/3.3.4.tar.bz2
tar xf 3.3.4.tar.bz2
rm -rf 3.3.4.tar.bz2
cd eigen-eigen-5a0156e40feb
mkdir -p build && cd build
cmake \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr/local \
    ..
make -j4
make install

**OpenCV ** : Download, build and install

cd /path/to/working/dir
wget -q https://github.com/opencv/opencv/archive/3.4.0.zip
unzip -q 3.4.0.zip
rm -rf 3.4.0.zip
cd opencv-3.4.0
mkdir -p build && cd build
cmake \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr/local \
    -DENABLE_CXX11=ON \
    -DBUILD_DOCS=OFF \
    -DBUILD_EXAMPLES=OFF \
    -DBUILD_JASPER=OFF \
    -DBUILD_OPENEXR=OFF \
    -DBUILD_PERF_TESTS=OFF \
    -DBUILD_TESTS=OFF \
    -DWITH_EIGEN=ON \
    -DWITH_FFMPEG=ON \
    -DWITH_OPENMP=ON \
    ..
make -j4
make install

BUILD INSTRUCTIONS :

As we are using Pangolin viewer, the PANGOLIN_VIEWER=ON and SOCKET_PUBLISHER=OFF

cd /path/to/openvslam
mkdir build && cd build
cmake \
    -DBUILD_WITH_MARCH_NATIVE=ON \
    -DUSE_PANGOLIN_VIEWER=ON \
    -DUSE_SOCKET_PUBLISHER=OFF \
    -DUSE_STACK_TRACE_LOGGER=ON \
    -DBOW_FRAMEWORK=DBoW2 \
    -DBUILD_TESTS=ON \
    ..
make -j4

Then go to https://openvslam.readthedocs.io/en/master/ros_package.html and clone the cv_bridge repo:

cd /path/to/openvslam/ros
git clone --branch ${ROS_DISTRO} --depth 1 https://github.com/ros-perception/vision_opencv.git
cp -r vision_opencv/cv_bridge src/
rm -rf vision_opencv

When building with support for PangolinViewer, please specify the following cmake options: -DUSE_PANGOLIN_VIEWER=ON and -DUSE_SOCKET_PUBLISHER=OFF

cd /path/to/openvslam/ros
catkin_make \
    -DBUILD_WITH_MARCH_NATIVE=ON \
    -DUSE_PANGOLIN_VIEWER=ON \
    -DUSE_SOCKET_PUBLISHER=OFF \
    -DUSE_STACK_TRACE_LOGGER=ON \
    -DBOW_FRAMEWORK=DBoW2

After building

Check by executing the command ./run_kitti_slam -h


Some important Points:

  • We are USING OpenCV 3.4 so some changes in the CmakeLists.txt were made in the openvslam repo (to help it find the correct location).
  • To make the repo work with gazebo, only remapping of the necessary topic is to be done in the run_slam.cpp for input.
  • The final map gets stored in the build folder as a map.msg file

Running the repo (with Gazebo):

  • Start up the launch file with a suitable camera model
  • Remap the topic in the run_slam.cpp file and do catkin build openvslam
  • Now in a new terminal we run the following snipet:
source /path/to/openvslam/ros/devel/setup.bash
rosrun openvslam run_slam \
    -v /path/to/orb_vocab.dbow2 \
    -c /path/to/config.yaml
  • For localization (map.msg file):
source /path/to/openvslam/ros/devel/setup.bash
rosrun openvslam run_localization \
    -v /path/to/orb_vocab.dbow2 \
    -c /path/to/config.yaml \
    --map-db /path/to/map.msg