Compile RTAB-Map with additional libraries

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Compile RTAB-Map with additional libraries

g.bartoli
This post was updated on .
Hi Mathieu,
I would like to compile RTAB-Map 0.10.6 with SURF/SIFT, Vertigo and OpenNI2 to perform some tests with ASUS Xtion Pro.
I'm starting from a clean Ubuntu 14.04 with ROS Indigo and OpenCV 2.4.11 compiled and installed, I already downloaded and configured RTAB-Map from GIT sources like you explained here.

This is the output of cmake:
-- Found Pthreads
-- --------------------------------------------
-- Info :
--   CMAKE_INSTALL_PREFIX = /home/vision/catkin_ws/devel
--   CMAKE_BUILD_TYPE = Release
--   BUILD_SHARED_LIBS = ON
--   With OpenCV 2 nonfree module (SIFT/SURF) = YES
--   With Freenect             = NO (libfreenect not found)
--   With OpenNI2              = NO (OpenNI2 not found)
--   With Freenect2            = NO (libfreenect2 not found)
--   With dc1394               = YES
--   With FlyCapture2/Triclops = NO (Point Grey SDK not found)
--   With g2o                  = NO (g2o not found)
--   With GTSAM                = NO (GTSAM not found)
--   With cvsba                = NO (cvsba not found)
--   With Qt                   = YES (version 4)
-- --------------------------------------------
-- Configuring done
-- Generating done
-- Build files have been written to: /home/vision/rtabmap/build
The SURF/SIFT are recognized and I'm planning to use rtabmap node like I did with the previous "rtabmap_ros" package installed via "apt-get install ros-indigo-rtabmap-ros", so I have some questions:
1) Do I need to manually install OpenNI2 to use the ASUS Xtion Pro? (rtabmap_ros worked fine without any additional driver)
2) What libraries I have to install to enable g2o, GTSAM and cvsba? Do I need to compile them or can I install them with apt-get?
3) Are all these libraries all needed to use Robust Graph Optimization?

Thanks
~Guido
Reply | Threaded
Open this post in threaded view
|

UPDATE: Compile RTAB-Map with additional libraries

g.bartoli
I found the GTSAM page to download and compile code from here, I successfully installed it and now this is the output of RTAB-Map cmake:
-- Found Pthreads
-- --------------------------------------------
-- Info :
--   CMAKE_INSTALL_PREFIX = /home/vision/catkin_ws/devel
--   CMAKE_BUILD_TYPE = Release
--   BUILD_SHARED_LIBS = ON
--   With OpenCV 2 nonfree module (SIFT/SURF) = YES
--   With Freenect             = NO (libfreenect not found)
--   With OpenNI2              = NO (OpenNI2 not found)
--   With Freenect2            = NO (libfreenect2 not found)
--   With dc1394               = YES
--   With FlyCapture2/Triclops = NO (Point Grey SDK not found)
--   With g2o                  = NO (g2o not found)
--   With GTSAM                = YES
--   With cvsba                = NO (cvsba not found)
--   With Qt                   = YES (version 4)
-- --------------------------------------------
-- Configuring done
-- Generating done
-- Build files have been written to: /home/vision/Libraries/rtabmap/build
So, GTSAM is ok, can you still answer to the other questions? :)
~Guido
Reply | Threaded
Open this post in threaded view
|

Re: Compile RTAB-Map with additional libraries

matlabbe
Administrator
In reply to this post by g.bartoli
Hi,

1) While you are using ROS, you can install ROS related packages to have the sensor drivers:
$ sudo apt-get install ros-indigo-openni2-launch ros-indigo-openni-launch ros-indigo-freenect-launch
With rtabmap_ros, the rtabmap library doesn't need to be built with OpenNI2 or other drivers. But by installing the ROS packages, rtabmap will detect them anyway.

2) For g2o, there is already a ROS package:
$ sudo apt-get install ros-indigo-libg2o
However, I've found that the latest g2o version from GitHub is faster. For GTSAM and cvsba, they should be built from source.

3) Vertigo can only be used with g2o or GTSAM. However, with or without Vertigo, the example "Without Vertigo" can be used with TORO, g2o and GTSAM.

cheers
Reply | Threaded
Open this post in threaded view
|

Re: Compile RTAB-Map with additional libraries

g.bartoli
1) Ok, I'm planning to use the compiled RTAB-Map library via a ROS node with rtabmap_ros, so OpenNI2 should be ok with it. After I compiled RTAB-Map library, I will compile rtabmap_ros, too.

2) I compiled g2o from source and now RTAB-Map cmake finds it, thanks!

3) Thanks, I will take a look at that link!

4*) Is cvsba also needed for Vertigo? I also compiled and installed the cvsba library, but RTAB-Map cmake still cannot find it, so I ignored it for now.

So, now that OpenCV, g2o, GTSAM and Qt are successfully built and recognized by RTAB-Map, I tried to compile it with make, but I receive a lot of GTSAM-related errors like the following ones:
In file included from /usr/local/include/gtsam/geometry/Pose2.h:24:0,
                 from /home/vision/Libraries/rtabmap/corelib/src/Graph.cpp:71:
/usr/local/include/gtsam/base/Matrix.h: In function ‘void gtsam::inplace_QR(MATRIX&)’:
/usr/local/include/gtsam/base/Matrix.h:316:71: error: expected ‘;’ before ‘::’ token
   Eigen::internal::householder_qr_inplace_blocked<MATRIX, HCoeffsType>::run(A, hCoeffs, 48, temp.data());
[...]
In file included from /usr/local/include/gtsam/geometry/Pose3.h:30:0,
                 from /home/vision/Libraries/rtabmap/corelib/src/Graph.cpp:72:
/usr/local/include/gtsam/geometry/Rot3.h: In static member function ‘static gtsam::Rot3 gtsam::Rot3::rodriguez(double, double, double)’:
/usr/local/include/gtsam/geometry/Rot3.h:197:51: error: no matching function for call to ‘gtsam::Rot3::rodriguez(Eigen::CommaInitializer<Eigen::Matrix<double, -1, 1> >&)’
       { return rodriguez((Vector(3) << wx, wy, wz));}
                                                   ^
/usr/local/include/gtsam/geometry/Rot3.h:197:51: note: candidates are:
/usr/local/include/gtsam/geometry/Rot3.h:164:17: note: static gtsam::Rot3 gtsam::Rot3::rodriguez(const Vector&, double)
     static Rot3 rodriguez(const Vector& w, double theta);
[...]
/home/vision/Libraries/rtabmap/corelib/src/Graph.cpp:1345:35: error: ‘const class gtsam::Value’ has no member named ‘cast’
      gtsam::Pose3 p = iter->value.cast<gtsam::Pose3>();
Maybe RTAB-Map does not compile with the latest GTSAM 3.2.1?

Thanks
~Guido
Reply | Threaded
Open this post in threaded view
|

Re: Compile RTAB-Map with additional libraries

matlabbe
Administrator
4) No, cvsba is not needed for Vertigo. For info, to make RTAB-Map finds cvsba, we should do this after installing cvsba:
$ mkdir /usr/local/lib/cmake/cvsba 
$ mv /usr/local/lib/cmake/Findcvsba.cmake /usr/local/lib/cmake/cvsba/cvsbaConfig.cmake
 
RTAB-Map builds with the latest GTSAM version of the main "develop" branch on bitbucket:
$ git clone https://bitbucket.org/gtborg/gtsam.git

cheers
Reply | Threaded
Open this post in threaded view
|

Re: Compile RTAB-Map with additional libraries

g.bartoli
4) Perfect, it worked, now RTAB-Map cmake finds cvsba, too!
Furthermore, I used the GTSAM git code you suggested and now RTAB-Map library compiles successfully. :)

I proceeded on compiling rtabmap_ros inside catkin_ws, it needed some dependencies like octomap and move_base, I installed them and it went fine except for this error:
CMake Error at rtabmap_ros/CMakeLists.txt:20 (find_package):
  By not providing "FindRTABMap.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "RTABMap", but
  CMake did not find one.

  Could not find a package configuration file provided by "RTABMap"
  (requested version 0.10.9) with any of the following names:

    RTABMapConfig.cmake
    rtabmap-config.cmake

  Add the installation prefix of "RTABMap" to CMAKE_PREFIX_PATH or set
  "RTABMap_DIR" to a directory containing one of the above files.  If
  "RTABMap" provides a separate development package or SDK, be sure it has
  been installed.
Do I have to change something inside CMakeLists to make it find the compiled rtabmap library?

Many thanks

PS: At the end of this, if you need, I can prepare you a walkthrough of what is needed for a complete compilation to may be included in your page, since there I didn't find all these steps for external libraries you kindly provided to me.
~Guido
Reply | Threaded
Open this post in threaded view
|

Re: Compile RTAB-Map with additional libraries

matlabbe
Administrator

Hi,

If you installed RTAB-Map libraries in ~/catkin_ws/devel as in the instructions here, the ros package should find it.

I've updated the installation instructions with optional section (from what we've discussed in this thread). If you have other steps required, tell me and I will add them.

cheers
Reply | Threaded
Open this post in threaded view
|

Re: Compile RTAB-Map with additional libraries

g.bartoli
Yes, you're right I made a mistake in specifying the catkin workspace, rtabmap_ros compiled successfully, everything is fine now.

Wow, you made a great work in gathering all the information in the wiki, I will take a look at the steps I made and check if something is missing!

Many many thanks
~Guido