Error while compiling RTAB-Map with g2o support

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

Error while compiling RTAB-Map with g2o support

g.bartoli
Hi,
yesterday I cloned the GIT repository and correctly compiled RTAB-Map standalone on Linux Mint 17.1 (Ubuntu 14.04), this was my configuration with cmake:
-- Info :
--   CMAKE_INSTALL_PREFIX = /usr/local
--   CMAKE_BUILD_TYPE = Release
--   BUILD_SHARED_LIBS = ON
--   With OpenCV nonfree module (SIFT/SURF) = NO (not found)
--   With Freenect = YES
--   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
--   With Qt  = YES (version 4)
-- --------------------------------------------
-- Configuring done
-- Generating done
-- Build files have been written to: /home/bartoli/Projects/rtabmap/build
This morning I wanted to add the g2o support, so I installed the library using the apt-get (ros-indigo-libg2o), so I updated the code with "git pull origin master" and ran cmake again. This time it correctly showed "With g2o = YES", but now I'm unable to recompile the project with cmake, many errors appears, this is just one of them:
In file included from /usr/local/include/g2o/core/optimizable_graph.h:38:0,
                 from /usr/local/include/g2o/core/sparse_optimizer.h:32,
                 from /home/bartoli/Projects/rtabmap/corelib/src/Graph.cpp:42:
/usr/local/include/g2o/core/hyper_graph.h: At global scope:
/usr/local/include/g2o/core/hyper_graph.h:138:15: error: ‘unordered_map’ in namespace ‘std’ does not name a type
       typedef std::unordered_map<int, Vertex*>     VertexIDMap;
               ^
/usr/local/include/g2o/core/hyper_graph.h:225:13: error: ‘VertexIDMap’ does not name a type
       const VertexIDMap& vertices() const {return _vertices;}
             ^
/usr/local/include/g2o/core/hyper_graph.h:227:7: error: ‘VertexIDMap’ does not name a type
       VertexIDMap& vertices() {return _vertices;}
       ^
/usr/local/include/g2o/core/hyper_graph.h:274:7: error: ‘VertexIDMap’ does not name a type
       VertexIDMap _vertices;
       ^
I also uploaded the full log file... do you have an idea why it does not work with g2o?
log.txt
~Guido
Reply | Threaded
Open this post in threaded view
|

Re: Error while compiling RTAB-Map with g2o support

matlabbe
Administrator
Hello,

Here on Ubuntu 14.04 Indigo with g2o (ros-indigo-libg2o), I have only this warning when building Graph.cpp:
[  8%] Building CXX object corelib/src/CMakeFiles/rtabmap_core.dir/Graph.cpp.o
In file included from /home/mathieu/workspace/rtabmap/corelib/src/toro3d/posegraph2.hh:47:0,
                 from /home/mathieu/workspace/rtabmap/corelib/src/toro3d/treeoptimizer2.hh:47,
                 from /home/mathieu/workspace/rtabmap/corelib/src/Graph.cpp:39:
/home/mathieu/workspace/rtabmap/corelib/src/toro3d/transformation2.hh: In constructor ‘AISNavigation::Transformation2<T>::Transformation2(const T&, const AISNavigation::Vector2<T>&)’:
/home/mathieu/workspace/rtabmap/corelib/src/toro3d/transformation2.hh:191:49: warning: delegating constructors only available with -std=c++11 or -std=gnu++11 [enabled by default]
     Transformation2(trans.x(), trans.y(), _theta){}
                                                 ^

You have errors about "std" namespace not found. What s your GCC version? Here mine:
$ gcc --version
gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2

cheers
Reply | Threaded
Open this post in threaded view
|

Re: Error while compiling RTAB-Map with g2o support

g.bartoli
I have the same version:
bartoli@Calliope ~/Projects/rtabmap/bin $ gcc --version
gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2
In the meanwhile, there were some evolutions... ;)
The first one is that uninstalling ros-indigo-libg2o, RTAB correctly compiles, so the problem is obviously related to g2o.
The second one is that now I remembered that some weeks ago I compiled the source code of the standalone g2o library and installed it with "sudo make install", in fact the library and header files where in /usr/local. So, when I installed the ROS g2o package, there were TWO g2o installed, that was my fault... :(

To solve this, I manually deleted g2o from /usr/local, then I reinstalled ros-indigo-libg2o with apt-get and now I have g2o in ROS paths:
$ sudo find / -name *g2o*
..............
/opt/ros/indigo/lib/libg2o_types_slam2d.so
/opt/ros/indigo/lib/libg2o_solver_cholmod.so
/opt/ros/indigo/lib/libg2o_cli.so
/opt/ros/indigo/lib/libg2o_solver_eigen.so
/opt/ros/indigo/lib/libg2o_interface.so
/opt/ros/indigo/lib/libg2o_types_data.so
/opt/ros/indigo/lib/libg2o_solver_pcg.so
/opt/ros/indigo/lib/libg2o_solver_slam2d_linear.so
/opt/ros/indigo/lib/libg2o_incremental.so
/opt/ros/indigo/lib/libg2o_ext_freeglut_minimal.so
/opt/ros/indigo/lib/libg2o_types_slam3d.so
/opt/ros/indigo/lib/libg2o_types_sba.so
/opt/ros/indigo/lib/libg2o_parser.so
/opt/ros/indigo/lib/libg2o_types_sclam2d.so
/opt/ros/indigo/lib/libg2o_types_icp.so
/opt/ros/indigo/lib/libg2o_solver_dense.so
/opt/ros/indigo/lib/libg2o_opengl_helper.so
/opt/ros/indigo/lib/libg2o_simulator.so
/opt/ros/indigo/lib/libg2o_stuff.so
/opt/ros/indigo/lib/libg2o_core.so
/opt/ros/indigo/lib/libg2o_interactive.so
/opt/ros/indigo/lib/libg2o_solver_csparse.so
/opt/ros/indigo/lib/libg2o_types_sim3.so
/opt/ros/indigo/lib/libg2o_csparse_extension.so
/opt/ros/indigo/lib/libg2o_solver_structure_only.so
/opt/ros/indigo/include/g2o
/opt/ros/indigo/include/g2o/examples/interactive_slam/g2o_interactive
/opt/ros/indigo/include/g2o/examples/interactive_slam/g2o_interactive/g2o_interactive_api.h
/opt/ros/indigo/include/g2o/examples/interactive_slam/g2o_interactive/g2o_slam_interface.h
/opt/ros/indigo/include/g2o/examples/interactive_slam/g2o_incremental
/opt/ros/indigo/include/g2o/examples/interactive_slam/g2o_incremental/g2o_incremental_api.h
/opt/ros/indigo/include/g2o/apps/g2o_cli
/opt/ros/indigo/include/g2o/apps/g2o_cli/g2o_common.h
/opt/ros/indigo/include/g2o/apps/g2o_cli/g2o_cli_api.h
/opt/ros/indigo/include/g2o/apps/g2o_simulator
/opt/ros/indigo/include/g2o/apps/g2o_simulator/g2o_simulator_api.h
/opt/ros/indigo/include/g2o/stuff/g2o_stuff_api.h
/opt/ros/indigo/include/g2o/types/sba/g2o_types_sba_api.h
/opt/ros/indigo/include/g2o/types/sclam2d/g2o_types_sclam2d_api.h
/opt/ros/indigo/include/g2o/types/slam3d/g2o_types_slam3d_api.h
/opt/ros/indigo/include/g2o/types/icp/g2o_types_icp_api.h
/opt/ros/indigo/include/g2o/types/data/g2o_types_data_api.h
/opt/ros/indigo/include/g2o/types/slam2d/g2o_types_slam2d_api.h
/opt/ros/indigo/include/g2o/solvers/slam2d_linear/g2o_slam2d_linear_api.h
/opt/ros/indigo/include/g2o/solvers/csparse/g2o_csparse_extension_api.h
/opt/ros/indigo/include/g2o/solvers/csparse/g2o_csparse_api.h
/opt/ros/indigo/include/g2o/core/g2o_core_api.h
/opt/ros/indigo/bin/g2o
/opt/ros/indigo/bin/g2o_simulator2d
/opt/ros/indigo/bin/g2o_simulator3d
/opt/ros/indigo/bin/g2o_online
/opt/ros/indigo/bin/g2o_incremental
/opt/ros/indigo/share/libg2o
..............
So, I executed cmake again on RTAB source and it correctly finds g2o now:
-- Info :
--   CMAKE_INSTALL_PREFIX = /usr/local
--   CMAKE_BUILD_TYPE = Release
--   BUILD_SHARED_LIBS = ON
--   With OpenCV nonfree module (SIFT/SURF) = NO (not found)
--   With Freenect = YES
--   With OpenNI2  = YES
--   With Freenect2 = NO (libfreenect2 not found)
--   With dc1394  = YES
--   With FlyCapture2/Triclops  = NO (Point Grey SDK not found)
--   With g2o  = YES
--   With Qt  = YES (version 4)
Unfortunately, executing make now gives the following file-not-found error:
[  6%] Built target rtabmap_utilite
[  7%] Built target uresourcegenerator
[  8%] Building CXX object corelib/src/CMakeFiles/rtabmap_core.dir/Graph.cpp.o
/home/bartoli/Projects/rtabmap/corelib/src/Graph.cpp:42:39: fatal error: g2o/core/sparse_optimizer.h: No such file or directory
 #include "g2o/core/sparse_optimizer.h"
                                       ^
compilation terminated.
make[2]: *** [corelib/src/CMakeFiles/rtabmap_core.dir/Graph.cpp.o] Error 1
make[1]: *** [corelib/src/CMakeFiles/rtabmap_core.dir/all] Error 2
make: *** [all] Error 2
Do you know what am I missing?
~Guido
Reply | Threaded
Open this post in threaded view
|

Re: Error while compiling RTAB-Map with g2o support

g.bartoli
However, the correct method for adding g2o support is simply install the ros-indigo-libg2o package or is it better to compile g2o from the official git source? Is RTAB-Map able to refine maps after loop closures even if g2o is not installed?
And another question, how much does adding OpenCV SURF/SIFT support increase the precision of feature tracking?

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

Re: Error while compiling RTAB-Map with g2o support

matlabbe
Administrator
Yes, rtabmap builds with g2o if it is installed (whether by the ROS binaries or source). Well, I only tested with the ROS binaries though.

RTAB-Map uses TORO by default for graph optimization, the option to use g2o becomes available when rtabmap is built with it. So yes, RTAB-Map can refine maps without g2o.

SURF is mostly used for loop closure detection, and RTAB-Map's loop closure detection benchmark is based on it (see referred papers). SURF is not used by default for the visual odometry, GFTT+BRIEF is used by default because it is much faster than SURF. However, I don't have comparisons for the odometry quality between all the features that can be used (SURF/SIFT/ORB/BRIEF/FAST/FREAK/BRISK). Same for loop closure detection.

cheers
Reply | Threaded
Open this post in threaded view
|

Re: Error while compiling RTAB-Map with g2o support

g.bartoli
Ok, thanks for pointing that out!
~Guido