introlab / rtabmap

RTAB-Map library and standalone application
https://introlab.github.io/rtabmap
Other
2.83k stars 787 forks source link

EdgeSE3Prior not declared in scope #363

Closed ahmadhasan2k8 closed 5 years ago

ahmadhasan2k8 commented 5 years ago

I just started using RTAB map. I have an installation in a ubuntu 16.04 system where it builds without problem. But I have another computer where I have Ubuntu 18.04 and I get the following build error:

In member function ‘virtual std::map<int, rtabmap::Transform> rtabmap::OptimizerG2O::optimize(int, const std::map<int, rtabmap::Transform>&, const std::multimap<int, rtabmap::Link>&, cv::Mat&, std::__cxx11::list<std::map<int, rtabmap::Transform> >*, double*, int*)’:
/home/aumi/rtabmap/corelib/src/optimizer/OptimizerG2O.cpp:497:8: error: ‘EdgeSE3XYZPrior’ was not declared in this scope
        EdgeSE3XYZPrior * priorEdge = new EdgeSE3XYZPrior();
        ^~~~~~~~~~~~~~~
/home/aumi/rtabmap/corelib/src/optimizer/OptimizerG2O.cpp:497:8: note: suggested alternative:
In file included from /usr/local/include/g2o/types/slam3d/types_slam3d.h:50:0,
                 from /home/aumi/rtabmap/corelib/src/optimizer/OptimizerG2O.cpp:61:
/usr/local/include/g2o/types/slam3d/edge_se3_xyzprior.h:39:30: note:   ‘g2o::EdgeSE3XYZPrior’
   class G2O_TYPES_SLAM3D_API EdgeSE3XYZPrior : public BaseUnaryEdge<3, Vector3, VertexSE3>
                              ^~~~~~~~~~~~~~~
/home/aumi/rtabmap/corelib/src/optimizer/OptimizerG2O.cpp:497:26: error: ‘priorEdge’ was not declared in this scope
        EdgeSE3XYZPrior * priorEdge = new EdgeSE3XYZPrior();
                          ^~~~~~~~~
/home/aumi/rtabmap/corelib/src/optimizer/OptimizerG2O.cpp:497:26: note: suggested alternative: ‘priorsIgnored’
        EdgeSE3XYZPrior * priorEdge = new EdgeSE3XYZPrior();
                          ^~~~~~~~~
                          priorsIgnored
/home/aumi/rtabmap/corelib/src/optimizer/OptimizerG2O.cpp:497:42: error: expected type-specifier before ‘EdgeSE3XYZPrior’
        EdgeSE3XYZPrior * priorEdge = new EdgeSE3XYZPrior();

To test I changed the line temporarily and made it

 g2o::EdgeSE3XYZPrior * priorEdge = new g2o::EdgeSE3XYZPrior();

which builds and I can run ./rtabmap just fine it seems like. Could you please give me an idea if it's somehow related to ubuntu 18.04 or something else?

matlabbe commented 5 years ago

I cannot reproduce this error on melodic (docker image can be built). Do you use a g2o built from source, or the binaries coming with melodic?

The cmake output of rtabmap library when creating the docker image for melodic:

-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Deprecation Warning at CMakeLists.txt:64 (cmake_policy):
The OLD behavior for policy CMP0020 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
-- Checking for module 'eigen3'
-- Found eigen3, version 3.3.4
-- Found eigen: /usr/include/eigen3
-- Checking for module 'libopenni'
-- Found libopenni, version 1.5.4.0
-- Found openni: /usr/lib/libOpenNI.so
-- The imported target "vtkRenderingPythonTkWidgets" references the file
"/usr/lib/x86_64-linux-gnu/libvtkRenderingPythonTkWidgets.so"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
"/usr/lib/cmake/vtk-6.3/VTKTargets.cmake"
but not all the files it references.
-- The imported target "vtk" references the file
"/usr/bin/vtk"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
"/usr/lib/cmake/vtk-6.3/VTKTargets.cmake"
but not all the files it references.
-- Found libusb-1.0: /usr/include
-- Checking for module 'flann'
-- Found flann, version 1.9.1
-- Found Flann: /usr/lib/x86_64-linux-gnu/libflann_cpp_s.a
-- Found qhull: /usr/lib/x86_64-linux-gnu/libqhull.so
-- Found PCL_COMMON: /usr/lib/x86_64-linux-gnu/libpcl_common.so
-- Found PCL_OCTREE: /usr/lib/x86_64-linux-gnu/libpcl_octree.so
-- Found PCL_IO: /usr/lib/x86_64-linux-gnu/libpcl_io.so
-- Found PCL_KDTREE: /usr/lib/x86_64-linux-gnu/libpcl_kdtree.so
-- Found PCL_SEARCH: /usr/lib/x86_64-linux-gnu/libpcl_search.so
-- Found PCL_SURFACE: /usr/lib/x86_64-linux-gnu/libpcl_surface.so
-- Found PCL_FILTERS: /usr/lib/x86_64-linux-gnu/libpcl_filters.so
-- Found PCL_2D: /usr/include/pcl-1.8
-- Found PCL_FEATURES: /usr/lib/x86_64-linux-gnu/libpcl_features.so
-- Found PCL_REGISTRATION: /usr/lib/x86_64-linux-gnu/libpcl_registration.so
-- Found PCL_SAMPLE_CONSENSUS: /usr/lib/x86_64-linux-gnu/libpcl_sample_consensus.so
-- Found PCL_GEOMETRY: /usr/include/pcl-1.8
-- Found PCL_ML: /usr/lib/x86_64-linux-gnu/libpcl_ml.so
-- Found PCL_SEGMENTATION: /usr/lib/x86_64-linux-gnu/libpcl_segmentation.so
-- Found PCL_VISUALIZATION: /usr/lib/x86_64-linux-gnu/libpcl_visualization.so
-- PCL definitions don't contain "-march=native", make sure all libraries using Eigen are also compiled without that flag to avoid some segmentation faults (with gdb referring to some Eigen functions).
-- Found Sqlite3: /usr/include /usr/lib/x86_64-linux-gnu/libsqlite3.so
-- Found OpenMP_C: -fopenmp (found version "4.5")
-- Found OpenMP_CXX: -fopenmp (found version "4.5")
-- Found OpenMP: TRUE (found version "4.5")
-- Found OpenMP
-- Found OpenCV: /usr/include;/usr/include/opencv
-- Found PCL: /usr/include/pcl-1.8;/usr/include/eigen3;/usr/include;/usr/include/ni;/usr/include/openni2;/usr/include/vtk-6.3;/usr/include/freetype2;/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi;/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi/opal/mca/event/libevent2022/libevent;/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi/opal/mca/event/libevent2022/libevent/include;/usr/lib/x86_64-linux-gnu/openmpi/include;/usr/include/python2.7;/usr/include/x86_64-linux-gnu;/usr/include/hdf5/openmpi;/usr/include/libxml2;/usr/include/jsoncpp;/usr/include/tcl
-- Found ZLIB: /usr/include
CMake Warning at /usr/lib/x86_64-linux-gnu/cmake/Qt5/Qt5Config.cmake:39 (message):
Failed to find Qt5 component "Svg" config file at
"/usr/lib/x86_64-linux-gnu/cmake/Qt5Svg/Qt5SvgConfig.cmake"
Call Stack (most recent call first):
CMakeLists.txt:265 (FIND_PACKAGE)
-- Could NOT find Qt5Svg (missing: Qt5Svg_DIR)
-- VTK_RENDERING_BACKEND=OpenGL
-- Found Freenect: /usr/include
-- Found OpenNI2: /usr/include/openni2
-- Found DC1394: /usr/include/dc1394
-- Found CSPARSE: /usr/include/suitesparse
CMake Warning at cmake_modules/FindG2O.cmake:122 (MESSAGE):
Latest g2o version detected with c++11 interface (config file:
/opt/ros/melodic/include/g2o/config.h). Make sure g2o is built with
"-DBUILD_WITH_MARCH_NATIVE=OFF" to avoid segmentation faults caused by
Eigen.
Call Stack (most recent call first):
CMakeLists.txt:339 (FIND_PACKAGE)
-- Found g2o: /opt/ros/melodic/include;/usr/include/suitesparse;/usr/include/suitesparse
-- FlyCapture2_INCLUDE_DIR=FlyCapture2_INCLUDE_DIR-NOTFOUND
-- FlyCapture2_LIBRARY=FlyCapture2_LIBRARY-NOTFOUND
-- Triclops_INCLUDE_DIR=Triclops_INCLUDE_DIR-NOTFOUND
-- Triclops_LIBRARY=Triclops_LIBRARY-NOTFOUND
-- FlyCaptureBridge_LIBRARY=FlyCaptureBridge_LIBRARY-NOTFOUND
-- Found octomap 1.9.0: /opt/ros/melodic/include
-- Performing Test COMPILER_SUPPORTS_CXX11
-- Performing Test COMPILER_SUPPORTS_CXX11 - Success
-- Performing Test COMPILER_SUPPORTS_CXX0X
-- Performing Test COMPILER_SUPPORTS_CXX0X - Success
-- Found Pthreads
CMake Deprecation Warning at tools/KittiDataset/CMakeLists.txt:14 (cmake_policy):
The OLD behavior for policy CMP0020 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
CMake Deprecation Warning at tools/RgbdDataset/CMakeLists.txt:14 (cmake_policy):
The OLD behavior for policy CMP0020 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
CMake Deprecation Warning at tools/EurocDataset/CMakeLists.txt:30 (cmake_policy):
The OLD behavior for policy CMP0020 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
CMake Deprecation Warning at tools/Recovery/CMakeLists.txt:12 (cmake_policy):
The OLD behavior for policy CMP0020 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
CMake Deprecation Warning at tools/Reprocess/CMakeLists.txt:12 (cmake_policy):
The OLD behavior for policy CMP0020 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
CMake Deprecation Warning at tools/DetectMoreLoopClosures/CMakeLists.txt:12 (cmake_policy):
The OLD behavior for policy CMP0020 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
CMake Deprecation Warning at tools/Report/CMakeLists.txt:16 (cmake_policy):
The OLD behavior for policy CMP0020 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
CMake Deprecation Warning at examples/BOWMapping/CMakeLists.txt:27 (cmake_policy):
The OLD behavior for policy CMP0020 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
CMake Deprecation Warning at examples/RGBDMapping/CMakeLists.txt:41 (cmake_policy):
The OLD behavior for policy CMP0020 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
CMake Deprecation Warning at examples/WifiMapping/CMakeLists.txt:35 (cmake_policy):
The OLD behavior for policy CMP0020 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
CMake Deprecation Warning at examples/NoEventsExample/CMakeLists.txt:35 (cmake_policy):
The OLD behavior for policy CMP0020 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
CMake Deprecation Warning at examples/Export/CMakeLists.txt:28 (cmake_policy):
The OLD behavior for policy CMP0020 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
-- --------------------------------------------
-- Info :
-- Version : 0.19.0
-- CMAKE_INSTALL_PREFIX = /usr/local
-- CMAKE_BUILD_TYPE = Release
-- CMAKE_INSTALL_LIBDIR = lib
-- BUILD_APP = ON
-- BUILD_TOOLS = ON
-- BUILD_EXAMPLES = ON
-- BUILD_SHARED_LIBS = ON
-- CMAKE_CXX_FLAGS = -fmessage-length=0 -fopenmp -std=c++11
-- FLANN_KDTREE_MEM_OPT = OFF
-- PCL_DEFINITIONS = ;-DDISABLE_ENSENSO;-DDISABLE_DAVIDSDK;-DDISABLE_DSSDK;-DDISABLE_PCAP;-DDISABLE_PNG;-DDISABLE_LIBUSB_1_0;-DFLANN_STATIC;-Dqh_QHpointer;-DDISABLE_RSSDK
-- Optional dependencies ('*' affects some default parameters) :
-- *With OpenCV 3 xfeatures2d module (SIFT/SURF/BRIEF/FREAK) = NO (not found, License: BSD)
-- With external SQLite3 = YES (License: Public Domain)
-- With Freenect = YES (License: Apache v2 and/or GPLv2)
-- With OpenNI2 = YES (License: Apache v2)
-- With Freenect2 = NO (libfreenect2 not found)
-- With Kinect for Windows 2 = NO (Kinect for Windows 2 SDK not found)
-- With dc1394 = YES (License: LGPL)
-- With FlyCapture2/Triclops = NO (Point Grey SDK not found)
-- With TORO = YES (License: Creative Commons [Attribution-NonCommercial-ShareAlike])
-- *With g2o = YES (License: BSD)
-- *With GTSAM = NO (GTSAM not found)
-- With VERTIGO = YES (License: GPLv3)
-- With cvsba = NO (cvsba not found)
-- *With libpointmatcher = NO (libpointmatcher not found)
-- With loam_velodyne = NO (loam_velodyne not found)
-- With ZED = NO (ZED sdk not found)
-- With RealSense = NO (librealsense not found)
-- With RealSense2 = NO (librealsense2 not found)
-- With OCTOMAP = YES (License: BSD)
-- With CPUTSDF = NO (CPUTSDF not found)
-- With OpenChisel = NO (open_chisel not found)
-- With libfovis = NO (libfovis not found)
-- With libviso2 = NO (libviso2 not found)
-- With dvo_core = NO (dvo_core not found)
-- With okvis = NO (okvis not found)
-- With msckf_vio = NO (WITH_MSCKF_VIO=OFF)
-- With ORB_SLAM2 = NO (WITH_G2O should be OFF as ORB_SLAM2 uses its own g2o version)
-- With Qt5 = YES (License: Open Source or Commercial)
-- --------------------------------------------
-- Configuring done
-- Generating done
matlabbe commented 5 years ago

The problem was when using g2o from source. This is fixed in the commit above.

ahmadhasan2k8 commented 5 years ago

Great. Sorry about late response. I was out during weekend. I will test it and let you know. Thanks for looking into it.

ahmadhasan2k8 commented 5 years ago

It builds fine now. Thanks