introlab / rtabmap_ros

RTAB-Map's ROS package.
http://wiki.ros.org/rtabmap_ros
BSD 3-Clause "New" or "Revised" License
965 stars 557 forks source link

Double free or corruption (out) #553

Closed askokostic closed 3 years ago

askokostic commented 3 years ago

Hello,

At the beginning of February, rtabmap was working without any issues, but around two weeks ago I started having problems. When trying to launch anything I started getting double free or corruption (out). If I only launch rtabmap without the simulation it does not crash, but as soon as it tries to subscribe to an existing topic it crashes.

Ubuntu 20.04 ROS2 Foxy Everything is running inside a Docker container. The same error occurred on another pc when doing the same steps (same Dockerfile).

I have tried the suggestion from #505, but it crashes even faster. Changing -DBUILD_WITH_MARCH_NATIVE to OFF has the same effect. Installing Eigen and GTSAM from the source also didn't help. When launching the node with gdb I get a lot of Eigen callback errors.

When executing:

export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:~/ros2_ws/src/turtlebot3_simulations/turtlebot3_gazebo/models
export TURTLEBOT3_MODEL=waffle
ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py
ros2 launch rtabmap_ros turtlebot3_scan.launch.py

I get this output:

[INFO] [launch]: All log files can be found below /home/vscode/.ros/log/2021-02-25-16-36-15-064915-aleksa-Vostro-7590-5100
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [rtabmap-1]: process started with pid [5105]
[INFO] [rtabmapviz-2]: process started with pid [5107]
[rtabmapviz-2] RCUTILS_CONSOLE_STDOUT_LINE_BUFFERED is now ignored.  Please set RCUTILS_LOGGING_USE_STDOUT and RCUTILS_LOGGING_BUFFERED_STREAM to control the stream and the buffering of log messages.
[rtabmap-1] RCUTILS_CONSOLE_STDOUT_LINE_BUFFERED is now ignored.  Please set RCUTILS_LOGGING_USE_STDOUT and RCUTILS_LOGGING_BUFFERED_STREAM to control the stream and the buffering of log messages.
[rtabmapviz-2] QStandardPaths: XDG_RUNTIME_DIR points to non-existing path '/run/user/1000', please create it with 0700 permissions.
[rtabmap-1] [INFO] [1614270976.170607016] [rtabmap]: rtabmap: subscribe_depth = false
[rtabmap-1] [INFO] [1614270976.170887317] [rtabmap]: rtabmap: subscribe_rgb = false
[rtabmap-1] [INFO] [1614270976.170908860] [rtabmap]: rtabmap: subscribe_stereo = false
[rtabmap-1] [INFO] [1614270976.170920231] [rtabmap]: rtabmap: subscribe_rgbd = false (rgbd_cameras=1)
[rtabmap-1] [INFO] [1614270976.170932497] [rtabmap]: rtabmap: subscribe_odom_info = false
[rtabmap-1] [INFO] [1614270976.170944118] [rtabmap]: rtabmap: subscribe_user_data = false
[rtabmap-1] [INFO] [1614270976.170960069] [rtabmap]: rtabmap: subscribe_scan = true
[rtabmap-1] [INFO] [1614270976.170975604] [rtabmap]: rtabmap: subscribe_scan_cloud = false
[rtabmap-1] [INFO] [1614270976.170991850] [rtabmap]: rtabmap: queue_size    = 10
[rtabmap-1] [INFO] [1614270976.171007709] [rtabmap]: rtabmap: approx_sync   = true
[rtabmap-1] [INFO] [1614270976.177933625] [rtabmap]: rtabmap(maps): map_filter_radius          = 0.000000
[rtabmap-1] [INFO] [1614270976.178015719] [rtabmap]: rtabmap(maps): map_filter_angle           = 30.000000
[rtabmap-1] [INFO] [1614270976.178039051] [rtabmap]: rtabmap(maps): map_cleanup                = true
[rtabmap-1] [INFO] [1614270976.178060963] [rtabmap]: rtabmap(maps): map_always_update          = false
[rtabmap-1] [INFO] [1614270976.178076719] [rtabmap]: rtabmap(maps): map_empty_ray_tracing      = true
[rtabmap-1] [INFO] [1614270976.178091851] [rtabmap]: rtabmap(maps): cloud_output_voxelized     = true
[rtabmap-1] [INFO] [1614270976.178106337] [rtabmap]: rtabmap(maps): cloud_subtract_filtering   = false
[rtabmap-1] [INFO] [1614270976.178120815] [rtabmap]: rtabmap(maps): cloud_subtract_filtering_min_neighbors = 2
[rtabmap-1] [INFO] [1614270976.211075701] [rtabmap]: rtabmap: frame_id      = base_footprint
[rtabmap-1] [INFO] [1614270976.211142195] [rtabmap]: rtabmap: map_frame_id  = map
[rtabmap-1] [INFO] [1614270976.211160963] [rtabmap]: rtabmap: use_action_for_goal  = false
[rtabmap-1] [INFO] [1614270976.211180060] [rtabmap]: rtabmap: tf_delay      = 0.050000
[rtabmap-1] [INFO] [1614270976.211264954] [rtabmap]: rtabmap: tf_tolerance  = 0.100000
[rtabmap-1] [INFO] [1614270976.211285119] [rtabmap]: rtabmap: odom_sensor_sync   = false
[rtabmapviz-2] [INFO] [1614270976.216233277] [rtabmapviz]: rtabmapviz: subscribe_depth = false
[rtabmapviz-2] [INFO] [1614270976.216577444] [rtabmapviz]: rtabmapviz: subscribe_rgb = false
[rtabmapviz-2] [INFO] [1614270976.216611710] [rtabmapviz]: rtabmapviz: subscribe_stereo = false
[rtabmapviz-2] [INFO] [1614270976.216630162] [rtabmapviz]: rtabmapviz: subscribe_rgbd = false (rgbd_cameras=1)
[rtabmapviz-2] [INFO] [1614270976.216659224] [rtabmapviz]: rtabmapviz: subscribe_odom_info = false
[rtabmapviz-2] [INFO] [1614270976.216678802] [rtabmapviz]: rtabmapviz: subscribe_user_data = false
[rtabmapviz-2] [INFO] [1614270976.216698061] [rtabmapviz]: rtabmapviz: subscribe_scan = true
[rtabmapviz-2] [INFO] [1614270976.216725072] [rtabmapviz]: rtabmapviz: subscribe_scan_cloud = false
[rtabmapviz-2] [INFO] [1614270976.216744381] [rtabmapviz]: rtabmapviz: queue_size    = 10
[rtabmapviz-2] [INFO] [1614270976.216764440] [rtabmapviz]: rtabmapviz: approx_sync   = true
[rtabmapviz-2] [INFO] [1614270976.221940982] [rtabmapviz]: rtabmapviz: Using configuration from "/home/vscode/.ros/rtabmapGUI.ini"
[rtabmap-1] [INFO] [1614270976.266343074] [rtabmap]: Setting RTAB-Map parameter "RGBD/NeighborLinkRefining"="True"
[rtabmap-1] [INFO] [1614270976.266749074] [rtabmap]: Setting RTAB-Map parameter "Reg/Strategy"="1"
[rtabmap-1] [WARN] [1614270976.282232905] [rtabmap]: Setting "Grid/FromDepth" parameter to false (default true) as "subscribe_scan" or "subscribe_scan_cloud" is true. The occupancy grid map will be constructed from laser scans. To get occupancy grid map from cloud projection, set "Grid/FromDepth" to true. To suppress this warning, add <param name="Grid/FromDepth" type="string" value="false"/>
[rtabmap-1] [INFO] [1614270976.282349111] [rtabmap]: Setting "Grid/RangeMax" parameter to 0 (default 5.000000) as "subscribe_scan" or "subscribe_scan_cloud" is true.
[rtabmap-1] [WARN] [1614270976.282410104] [rtabmap]: Setting "RGBD/ProximityPathMaxNeighbors" parameter to 10 (default 0) as "subscribe_scan" is true and "Reg/Strategy" uses ICP. Proximity detection by space will be also done by merging close scans. To disable, set "RGBD/ProximityPathMaxNeighbors" to 0. To suppress this warning, add <param name="RGBD/ProximityPathMaxNeighbors" type="string" value="10"/>
[rtabmap-1] [INFO] [1614270976.303969574] [rtabmap]: RTAB-Map detection rate = 1.000000 Hz
[rtabmap-1] [INFO] [1614270976.304983973] [rtabmap]: rtabmap: Using database from "/home/vscode/.ros/rtabmap.db" (0 MB).
[rtabmap-1] [INFO] [1614270976.625731986] [rtabmap]: rtabmap: Database version = "0.20.9".
[rtabmap-1] [INFO] [1614270976.669254719] [rtabmap]: Setup callbacks
[rtabmap-1] [INFO] [1614270976.669360939] [rtabmap]: Setup scan callback
[rtabmap-1] [INFO] [1614270976.709120793] [rtabmap]: 
[rtabmap-1] rtabmap subscribed to (approx sync):
[rtabmap-1]    odom,
[rtabmap-1]    scan
[rtabmap-1] [WARN] [1614270976.709237635] [rtabmap]: There is no image subscription, bag-of-words loop closure detection will be disabled...
[rtabmap-1] [WARN] [1614270976.709306613] [rtabmap]: Setting Kp/MaxFeatures=-1 (bag-of-words disabled)
[ERROR] [rtabmap-1]: process has died [pid 5105, exit code -11, cmd '/workspaces/ws_robogreen/install/rtabmap_ros/lib/rtabmap_ros/rtabmap -d --ros-args --params-file /tmp/launch_params_xadwwtjm -r scan:=/scan'].
[rtabmapviz-2] libpng warning: iCCP: known incorrect sRGB profile
[rtabmapviz-2] libpng warning: iCCP: known incorrect sRGB profile
[rtabmapviz-2] libpng warning: iCCP: known incorrect sRGB profile
[rtabmapviz-2] [WARN] [1614270977.567421198] [rcl.logging_rosout]: Publisher already registered for provided node name. If this is due to multiple nodes with the same name then all logs for that logger name will go out over the existing publisher. As soon as any node with that name is destructed it will unregister the publisher, preventing any further logs for that name from being published on the rosout topic.
[rtabmapviz-2] [INFO] [1614270977.569272031] [rtabmapviz]: Reading parameters from the ROS server...
[rtabmapviz-2] [INFO] [1614270982.571947558] [rtabmapviz]: Parameters read = 0
[rtabmapviz-2] [INFO] [1614270983.131544753] [rtabmapviz]: Setup scan callback
[rtabmapviz-2] [INFO] [1614270983.137675797] [rtabmapviz]: 
[rtabmapviz-2] rtabmapviz subscribed to (approx sync):
[rtabmapviz-2]    odom,
[rtabmapviz-2]    scan
[rtabmapviz-2] [INFO] [1614270983.137814053] [rtabmapviz]: rtabmapviz started.
[rtabmapviz-2] double free or corruption (out)
[ERROR] [rtabmapviz-2]: process has died [pid 5107, exit code -6, cmd '/workspaces/ws_robogreen/install/rtabmap_ros/lib/rtabmap_ros/rtabmapviz --ros-args --params-file /tmp/launch_params_cqmn8dty -r scan:=/scan'].[INFO] [launch]: All log files can be found below /home/vscode/.ros/log/2021-02-25-16-36-15-064915-aleksa-Vostro-7590-5100
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [rtabmap-1]: process started with pid [5105]
[INFO] [rtabmapviz-2]: process started with pid [5107]
[rtabmapviz-2] RCUTILS_CONSOLE_STDOUT_LINE_BUFFERED is now ignored.  Please set RCUTILS_LOGGING_USE_STDOUT and RCUTILS_LOGGING_BUFFERED_STREAM to control the stream and the buffering of log messages.
[rtabmap-1] RCUTILS_CONSOLE_STDOUT_LINE_BUFFERED is now ignored.  Please set RCUTILS_LOGGING_USE_STDOUT and RCUTILS_LOGGING_BUFFERED_STREAM to control the stream and the buffering of log messages.
[rtabmapviz-2] QStandardPaths: XDG_RUNTIME_DIR points to non-existing path '/run/user/1000', please create it with 0700 permissions.
[rtabmap-1] [INFO] [1614270976.170607016] [rtabmap]: rtabmap: subscribe_depth = false
[rtabmap-1] [INFO] [1614270976.170887317] [rtabmap]: rtabmap: subscribe_rgb = false
[rtabmap-1] [INFO] [1614270976.170908860] [rtabmap]: rtabmap: subscribe_stereo = false
[rtabmap-1] [INFO] [1614270976.170920231] [rtabmap]: rtabmap: subscribe_rgbd = false (rgbd_cameras=1)
[rtabmap-1] [INFO] [1614270976.170932497] [rtabmap]: rtabmap: subscribe_odom_info = false
[rtabmap-1] [INFO] [1614270976.170944118] [rtabmap]: rtabmap: subscribe_user_data = false
[rtabmap-1] [INFO] [1614270976.170960069] [rtabmap]: rtabmap: subscribe_scan = true
[rtabmap-1] [INFO] [1614270976.170975604] [rtabmap]: rtabmap: subscribe_scan_cloud = false
[rtabmap-1] [INFO] [1614270976.170991850] [rtabmap]: rtabmap: queue_size    = 10
[rtabmap-1] [INFO] [1614270976.171007709] [rtabmap]: rtabmap: approx_sync   = true
[rtabmap-1] [INFO] [1614270976.177933625] [rtabmap]: rtabmap(maps): map_filter_radius          = 0.000000
[rtabmap-1] [INFO] [1614270976.178015719] [rtabmap]: rtabmap(maps): map_filter_angle           = 30.000000
[rtabmap-1] [INFO] [1614270976.178039051] [rtabmap]: rtabmap(maps): map_cleanup                = true
[rtabmap-1] [INFO] [1614270976.178060963] [rtabmap]: rtabmap(maps): map_always_update          = false
[rtabmap-1] [INFO] [1614270976.178076719] [rtabmap]: rtabmap(maps): map_empty_ray_tracing      = true
[rtabmap-1] [INFO] [1614270976.178091851] [rtabmap]: rtabmap(maps): cloud_output_voxelized     = true
[rtabmap-1] [INFO] [1614270976.178106337] [rtabmap]: rtabmap(maps): cloud_subtract_filtering   = false
[rtabmap-1] [INFO] [1614270976.178120815] [rtabmap]: rtabmap(maps): cloud_subtract_filtering_min_neighbors = 2
[rtabmap-1] [INFO] [1614270976.211075701] [rtabmap]: rtabmap: frame_id      = base_footprint
[rtabmap-1] [INFO] [1614270976.211142195] [rtabmap]: rtabmap: map_frame_id  = map
[rtabmap-1] [INFO] [1614270976.211160963] [rtabmap]: rtabmap: use_action_for_goal  = false
[rtabmap-1] [INFO] [1614270976.211180060] [rtabmap]: rtabmap: tf_delay      = 0.050000
[rtabmap-1] [INFO] [1614270976.211264954] [rtabmap]: rtabmap: tf_tolerance  = 0.100000
[rtabmap-1] [INFO] [1614270976.211285119] [rtabmap]: rtabmap: odom_sensor_sync   = false
[rtabmapviz-2] [INFO] [1614270976.216233277] [rtabmapviz]: rtabmapviz: subscribe_depth = false
[rtabmapviz-2] [INFO] [1614270976.216577444] [rtabmapviz]: rtabmapviz: subscribe_rgb = false
[rtabmapviz-2] [INFO] [1614270976.216611710] [rtabmapviz]: rtabmapviz: subscribe_stereo = false
[rtabmapviz-2] [INFO] [1614270976.216630162] [rtabmapviz]: rtabmapviz: subscribe_rgbd = false (rgbd_cameras=1)
[rtabmapviz-2] [INFO] [1614270976.216659224] [rtabmapviz]: rtabmapviz: subscribe_odom_info = false
[rtabmapviz-2] [INFO] [1614270976.216678802] [rtabmapviz]: rtabmapviz: subscribe_user_data = false
[rtabmapviz-2] [INFO] [1614270976.216698061] [rtabmapviz]: rtabmapviz: subscribe_scan = true
[rtabmapviz-2] [INFO] [1614270976.216725072] [rtabmapviz]: rtabmapviz: subscribe_scan_cloud = false
[rtabmapviz-2] [INFO] [1614270976.216744381] [rtabmapviz]: rtabmapviz: queue_size    = 10
[rtabmapviz-2] [INFO] [1614270976.216764440] [rtabmapviz]: rtabmapviz: approx_sync   = true
[rtabmapviz-2] [INFO] [1614270976.221940982] [rtabmapviz]: rtabmapviz: Using configuration from "/home/vscode/.ros/rtabmapGUI.ini"
[rtabmap-1] [INFO] [1614270976.266343074] [rtabmap]: Setting RTAB-Map parameter "RGBD/NeighborLinkRefining"="True"
[rtabmap-1] [INFO] [1614270976.266749074] [rtabmap]: Setting RTAB-Map parameter "Reg/Strategy"="1"
[rtabmap-1] [WARN] [1614270976.282232905] [rtabmap]: Setting "Grid/FromDepth" parameter to false (default true) as "subscribe_scan" or "subscribe_scan_cloud" is true. The occupancy grid map will be constructed from laser scans. To get occupancy grid map from cloud projection, set "Grid/FromDepth" to true. To suppress this warning, add <param name="Grid/FromDepth" type="string" value="false"/>
[rtabmap-1] [INFO] [1614270976.282349111] [rtabmap]: Setting "Grid/RangeMax" parameter to 0 (default 5.000000) as "subscribe_scan" or "subscribe_scan_cloud" is true.
[rtabmap-1] [WARN] [1614270976.282410104] [rtabmap]: Setting "RGBD/ProximityPathMaxNeighbors" parameter to 10 (default 0) as "subscribe_scan" is true and "Reg/Strategy" uses ICP. Proximity detection by space will be also done by merging close scans. To disable, set "RGBD/ProximityPathMaxNeighbors" to 0. To suppress this warning, add <param name="RGBD/ProximityPathMaxNeighbors" type="string" value="10"/>
[rtabmap-1] [INFO] [1614270976.303969574] [rtabmap]: RTAB-Map detection rate = 1.000000 Hz
[rtabmap-1] [INFO] [1614270976.304983973] [rtabmap]: rtabmap: Using database from "/home/vscode/.ros/rtabmap.db" (0 MB).
[rtabmap-1] [INFO] [1614270976.625731986] [rtabmap]: rtabmap: Database version = "0.20.9".
[rtabmap-1] [INFO] [1614270976.669254719] [rtabmap]: Setup callbacks
[rtabmap-1] [INFO] [1614270976.669360939] [rtabmap]: Setup scan callback
[rtabmap-1] [INFO] [1614270976.709120793] [rtabmap]: 
[rtabmap-1] rtabmap subscribed to (approx sync):
[rtabmap-1]    odom,
[rtabmap-1]    scan
[rtabmap-1] [WARN] [1614270976.709237635] [rtabmap]: There is no image subscription, bag-of-words loop closure detection will be disabled...
[rtabmap-1] [WARN] [1614270976.709306613] [rtabmap]: Setting Kp/MaxFeatures=-1 (bag-of-words disabled)
[ERROR] [rtabmap-1]: process has died [pid 5105, exit code -11, cmd '/workspaces/ws_robogreen/install/rtabmap_ros/lib/rtabmap_ros/rtabmap -d --ros-args --params-file /tmp/launch_params_xadwwtjm -r scan:=/scan'].
[rtabmapviz-2] libpng warning: iCCP: known incorrect sRGB profile
[rtabmapviz-2] libpng warning: iCCP: known incorrect sRGB profile
[rtabmapviz-2] libpng warning: iCCP: known incorrect sRGB profile
[rtabmapviz-2] [WARN] [1614270977.567421198] [rcl.logging_rosout]: Publisher already registered for provided node name. If this is due to multiple nodes with the same name then all logs for that logger name will go out over the existing publisher. As soon as any node with that name is destructed it will unregister the publisher, preventing any further logs for that name from being published on the rosout topic.
[rtabmapviz-2] [INFO] [1614270977.569272031] [rtabmapviz]: Reading parameters from the ROS server...
[rtabmapviz-2] [INFO] [1614270982.571947558] [rtabmapviz]: Parameters read = 0
[rtabmapviz-2] [INFO] [1614270983.131544753] [rtabmapviz]: Setup scan callback
[rtabmapviz-2] [INFO] [1614270983.137675797] [rtabmapviz]: 
[rtabmapviz-2] rtabmapviz subscribed to (approx sync):
[rtabmapviz-2]    odom,
[rtabmapviz-2]    scan
[rtabmapviz-2] [INFO] [1614270983.137814053] [rtabmapviz]: rtabmapviz started.
[rtabmapviz-2] double free or corruption (out)
[ERROR] [rtabmapviz-2]: process has died [pid 5107, exit code -6, cmd '/workspaces/ws_robogreen/install/rtabmap_ros/lib/rtabmap_ros/rtabmapviz --ros-args --params-file /tmp/launch_params_cqmn8dty -r scan:=/scan'].

Cmake output:

HEAD is now at 6b119c1f Camera test view: show intensity/rgb/normals if input scans have them
+ mkdir -p build
+ cd build+ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local ..
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.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:67 (cmake_policy):
  The OLD behavior for policy CMP0043 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.7
-- Found Eigen: /usr/include/eigen3 (Required is at least version "3.1") 
-- Eigen found (include: /usr/include/eigen3, version: 3.3.7)
-- Checking for module 'libusb-1.0'
--   Found libusb-1.0, version 1.0.23
-- Found USB_10: /usr/lib/x86_64-linux-gnu/libusb-1.0.so  
-- OpenNI found (include: /usr/include/ni, lib: /usr/lib/libOpenNI.so)
-- The imported target "vtkParseOGLExt" references the file
   "/usr/bin/vtkParseOGLExt-7.1"
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-7.1/VTKTargets.cmake"
but not all the files it references.

-- 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-7.1/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-7.1/VTKTargets.cmake"
but not all the files it references.

-- The imported target "pvtk" references the file
   "/usr/bin/pvtk"
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-7.1/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.so  
-- Found Qhull: optimized;/usr/lib/x86_64-linux-gnu/libqhull.so;debug;/usr/lib/x86_64-linux-gnu/libqhull.so  
-- QHULL found (include: /usr/include, lib: optimized;/usr/lib/x86_64-linux-gnu/libqhull.so;debug;/usr/lib/x86_64-linux-gnu/libqhull.so)
-- OpenNI found (include: /usr/include/ni, lib: /usr/lib/libOpenNI.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.10  
-- 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.10  
-- 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/opencv4
-- Found PCL: /usr/include/pcl-1.10;/usr/include/eigen3;/usr/include;/usr/include/ni;/usr/include/vtk-7.1;/usr/include/freetype2;/usr/include/x86_64-linux-gnu
-- Found ZLIB: /usr/include
-- VTK_RENDERING_BACKEND=OpenGL2
-- 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:
  /usr/local/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:411 (FIND_PACKAGE)

-- Found g2o: /usr/local/include;/usr/include/suitesparse
-- GTSAM include directory:  /usr/lib/cmake/GTSAM/../../../include
-- 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 libpointmatcher: /usr/local/include;/usr/include;/usr/include/eigen3;/usr/local/include;/tmp/libpointmatcher/pointmatcher
-- Found Threads: TRUE  
-- Found Boost: /usr/include (found version "1.71.0") found components: thread filesystem system program_options date_time chrono atomic 
CMake Warning (dev) at /usr/share/cmake-3.16/Modules/FindBoost.cmake:1287 (if):
  Policy CMP0054 is not set: Only interpret if() arguments as variables or
  keywords when unquoted.  Run "cmake --help-policy CMP0054" for policy
  details.  Use the cmake_policy command to set the policy and suppress this
  warning.

  Quoted variables like "chrono" will no longer be dereferenced when the
  policy is set to NEW.  Since the policy is not set the OLD behavior will be
  used.
Call Stack (most recent call first):
  /usr/share/cmake-3.16/Modules/FindBoost.cmake:1921 (_Boost_MISSING_DEPENDENCIES)
  CMakeLists.txt:446 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found Boost: /usr/include (found version "1.71.0") found components: thread filesystem system program_options date_time chrono timer chrono atomic chrono 
-- Found RealSense2: 
-- Found octomap 1.9.3: /usr/include
-- Found installed version of Eigen: /usr/lib/cmake/eigen3
-- Found required Ceres dependency: Eigen version 3.3.7 in /usr/include/eigen3
-- Found required Ceres dependency: glog
-- Found installed version of gflags: /usr/lib/x86_64-linux-gnu/cmake/gflags
-- Detected gflags version: 2.2.2
-- Found required Ceres dependency: gflags
-- Found Ceres version: 1.14.0 installed in: /usr with components: [EigenSparse, SparseLinearAlgebraLibrary, LAPACK, SuiteSparse, CXSparse, SchurSpecializations, OpenMP, Multithreading]
-- Architecture: x86_64
-- Performing Test COMPILER_SUPPORTS_CXX14
-- Performing Test COMPILER_SUPPORTS_CXX14 - Success
-- Found Pthreads
-- --------------------------------------------
-- Info :
--   Version : 0.20.9
--   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++14
--   FLANN_KDTREE_MEM_OPT = OFF
--   PCL_DEFINITIONS = -DDISABLE_OPENNI2;-DDISABLE_PCAP;-DDISABLE_PNG;-DDISABLE_LIBUSB_1_0
--   PCL_VERSION = 1.10.0
-- 
-- Optional dependencies ('*' affects some default parameters) :
--  *With OpenCV 4.2.0 xfeatures2d = NO, nonfree = NO (License: BSD)
--   With Qt 5.12.8            = YES (License: Open Source or Commercial)
--   With VTK 7.1              = YES (License: BSD)
--   With external SQLite3     = YES (License: Public Domain)
--   With ORB OcTree           = YES (License: GPLv3)
--   With SupertPoint          = NO (WITH_TORCH=OFF)
--   With Python3              = NO (WITH_PYTHON=OFF)
--   With Madgwick             = YES (License: GPL)
--   With FastCV               = NO (FastCV not found)
--   With PDAL                 = NO (PDAL not found)
-- 
--  Solvers:
--   With TORO                 = YES (License: Creative Commons [Attribution-NonCommercial-ShareAlike])
--  *With g2o                  = YES (License: BSD)
--  *With GTSAM                = YES (License: BSD)
--  *With Ceres                = YES (License: BSD)
--   With VERTIGO              = YES (License: GPLv3)
--   With cvsba                = NO (cvsba not found)
--  *With libpointmatcher      = YES (License: BSD)
-- 
--  Reconstruction Approaches:
--   With OCTOMAP              = YES (License: BSD)
--   With CPUTSDF              = NO (CPUTSDF not found)
--   With OpenChisel           = NO (open_chisel not found)
--   With AliceVision          = NO (WITH_ALICE_VISION=OFF)
-- 
--  Camera Drivers:
--   With Freenect             = NO (libfreenect not found)
--   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 Kinect for Azure     = NO (Kinect for Azure SDK not found)
--   With dc1394               = YES (License: LGPL)
--   With FlyCapture2/Triclops = NO (Point Grey SDK not found)
--   With ZED                  = NO (ZED sdk and/or cuda not found)
--   With RealSense            = NO (librealsense not found)
--   With RealSense2           = YES (License: Apache-2)
--   With MyntEyeS             = NO (mynteye s sdk not found)
-- 
--  Odometry Approaches:
--   With loam_velodyne        = NO (loam_velodyne 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 VINS-Fusion          = NO (VINS-Fusion not found)
--   With ORB_SLAM2            = NO (WITH_G2O should be OFF as ORB_SLAM2 uses its own g2o version)
-- Show all options with: cmake -LA | grep WITH_
-- --------------------------------------------
-- Configuring done
-- Generating done

Dockerfile:

#FROM ubuntu:20.04
FROM nvidia/cudagl:11.1-devel-ubuntu20.04

ARG CMAKE_INSTALL_PREFIX=/usr/local
ARG NUM_THREADS=8

# nvidia-container-runtime
# https://github.com/NVIDIA/nvidia-container-runtime#environment-variables-oci-spec
ENV NVIDIA_VISIBLE_DEVICES all
ENV NVIDIA_DRIVER_CAPABILITIES compute,utility,display
ENV NVIDIA_REQUIRE_CUDA "cuda>=10.1 brand=tesla,driver>=384,driver<385 brand=tesla,driver>=396,driver<397 brand=tesla,driver>=410,driver<411"

# Avoid warnings by switching to noninteractive
ENV DEBIAN_FRONTEND=noninteractive

# Update all packages
RUN apt-get update && apt-get -y dist-upgrade
RUN apt-get update && apt-get -y dist-upgrade

# ros-core include begin
# https://github.com/osrf/docker_images/blob/master/ros/foxy/ubuntu/focal/ros-core/Dockerfile
# setup timezone
RUN echo 'Etc/UTC' > /etc/timezone && \
    ln -s /usr/share/zoneinfo/Etc/UTC /etc/localtime && \
    apt-get update && \
    apt-get install -q -y --no-install-recommends tzdata && \
    rm -rf /var/lib/apt/lists/*

# install packages
RUN apt-get update && apt-get install -q -y --no-install-recommends \
    dirmngr \
    gnupg2 \
    && rm -rf /var/lib/apt/lists/*

# setup keys
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

# setup sources.list
RUN echo "deb http://packages.ros.org/ros2/ubuntu focal main" > /etc/apt/sources.list.d/ros2-latest.list

# setup environment
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8

ENV ROS_DISTRO foxy

# install ros2 packages
RUN apt-get update && apt-get install -y --no-install-recommends \
    ros-foxy-ros-core=0.9.2-1*
# ros-core include end

# ros-base include begin
# https://github.com/osrf/docker_images/blob/master/ros/foxy/ubuntu/focal/ros-base/Dockerfile
# install bootstrap tools
RUN apt-get update && apt-get install --no-install-recommends -y \
    build-essential \
    git \
    python3-colcon-common-extensions \
    python3-colcon-mixin \
    python3-rosdep \
    python3-vcstool \
    && rm -rf /var/lib/apt/lists/*

# bootstrap rosdep
RUN rosdep init && \
  rosdep update --rosdistro $ROS_DISTRO

# setup colcon mixin and metadata
RUN colcon mixin add default \
      https://raw.githubusercontent.com/colcon/colcon-mixin-repository/master/index.yaml && \
    colcon mixin update && \
    colcon metadata add default \
      https://raw.githubusercontent.com/colcon/colcon-metadata-repository/master/index.yaml && \
    colcon metadata update

# install ros2 packages
RUN apt-get update && apt-get install -y --no-install-recommends \
    ros-foxy-ros-base=0.9.2-1*
# ros-base include end

# ros-desktop include begin
# https://github.com/osrf/docker_images/blob/master/ros/foxy/ubuntu/focal/desktop/Dockerfile
# install ros2 packages
RUN apt-get update && apt-get install -y --no-install-recommends \
    ros-foxy-desktop=0.9.2-1*
# ros-desktop include end

# Configure apt and install packages
RUN apt-get update && apt-get install -y \
    ros-foxy-diagnostic-updater \
    ros-foxy-diagnostic-aggregator \
    ros-foxy-turtlesim \
    ros-foxy-rqt-robot-monitor \
    ros-foxy-rqt-robot-steering \
# packages for ros navigation stack + gazebo models
    ros-foxy-navigation2 \
    ros-foxy-nav2-bringup \
    ros-foxy-turtlebot3* \
    ros-foxy-gazebo-ros-pkgs \
    ros-foxy-ublox \
    ros-foxy-xacro \
    ros-foxy-joint-state-publisher \
# packages for debug
    aptitude \
    gitk \
# packages for installing librealsense
    software-properties-common \
# packages for building librealsense
    libssl-dev \
    libusb-1.0-0-dev \
    pkg-config \
    libgtk-3-dev \
    libglfw3-dev \
    libgl1-mesa-dev \
    libglu1-mesa-dev

RUN apt-key adv --keyserver keys.gnupg.net --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE || sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE \
    && add-apt-repository "deb http://realsense-hw-public.s3.amazonaws.com/Debian/apt-repo focal main" -u \
    && apt-get -y install librealsense2-utils \
    librealsense2-dev

# Clean up
RUN apt-get autoremove -y \
    && apt-get clean -y \
    && rm -rf /var/lib/apt/lists/*

# Set environment variables
ENV TURTLEBOT3_MODEL=waffle
ENV GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:/workspaces/ws_robogreen/src/turtlebot3_simulations/turtlebot3_gazebo/models

# Switch back to dialog for any ad-hoc use of apt-get
ENV DEBIAN_FRONTEND=dialog

# This Dockerfile adds a non-root user with sudo access. Use the "remoteUser"
# property in devcontainer.json to use it. On Linux, the container user's GID/UIDs
# will be updated to match your local UID/GID (when using the dockerFile property).
# See https://aka.ms/vscode-remote/containers/non-root-user for details.
ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=$USER_UID

# Options for common package install script - SHA generated on release
ARG INSTALL_ZSH="false"
ARG UPGRADE_PACKAGES="true"
ARG COMMON_SCRIPT_SOURCE="https://raw.githubusercontent.com/microsoft/vscode-dev-containers/v0.122.1/script-library/common-debian.sh"
ARG COMMON_SCRIPT_SHA="da956c699ebef75d3d37d50569b5fbd75d6363e90b3f5d228807cff1f7fa211c"

# Configure apt and install packages
RUN apt-get update \
    && export DEBIAN_FRONTEND=noninteractive \
    #
    # Verify git, common tools / libs installed, add/modify non-root user, optionally install zsh
    && apt-get -y install --no-install-recommends curl ca-certificates 2>&1 \
    && curl -sSL  ${COMMON_SCRIPT_SOURCE} -o /tmp/common-setup.sh \
    && ([ "${COMMON_SCRIPT_SHA}" = "dev-mode" ] || (echo "${COMMON_SCRIPT_SHA} /tmp/common-setup.sh" | sha256sum -c -)) \
    && /bin/bash /tmp/common-setup.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" \
    && rm /tmp/common-setup.sh \
    && apt-get -y install --no-install-recommends build-essential gdb cmake aptitude udev can-utils python3-pyqtgraph 2>&1 \
    #
    # Clean ups
    && apt-get autoremove -y \
    && apt-get clean -y \
    && rm -rf /var/lib/apt/lists/*

# Install STVL Dependencies (apt + from source OpenVDB)
RUN apt-get update \
    && apt-get -y install \
    libboost-iostreams-dev \
    libboost-system-dev \
    libtbb-dev \
    libilmbase-dev \
    libopenexr-dev \
    #
    # Clean ups
    && apt-get autoremove -y \
    && apt-get clean -y \
    && rm -rf /var/lib/apt/lists/*

RUN git clone -b v1.5.0 https://github.com/Blosc/c-blosc.git /tmp/c-blosc && \
    cd /tmp/c-blosc && \ 
    mkdir build && \
    cd build && \
    cmake .. && \
    make -j${NUM_THREADS} && \
    make install && \
    rm -r /tmp/c-blosc

RUN git clone -b v7.1.0 https://github.com/AcademySoftwareFoundation/openvdb.git /tmp/openvdb && \
    cd /tmp/openvdb && \ 
    mkdir build && \
    cd build && \
    cmake .. && \
    make -j${NUM_THREADS} && \
    make install && \
    rm -r /tmp/openvdb

# install openVSLAM deps

# install dependencies via apt
ENV DEBCONF_NOWARNINGS yes
RUN set -x && \
  apt-get update -y -qq && \
  apt-get upgrade -y -qq --no-install-recommends && \
  : "basic dependencies" && \
  apt-get install -y -qq \
    build-essential \
    pkg-config \
    cmake \
    git \
    wget \
    curl \
    tar \
    unzip && \
  : "g2o dependencies" && \
  apt-get install -y -qq \
    libgoogle-glog-dev \
    libatlas-base-dev \
    libsuitesparse-dev \
    libglew-dev && \
  : "OpenCV dependencies" && \
  apt-get install -y -qq \
    libopencv-dev \
    python3-opencv \
    libgtk-3-dev \
    libjpeg-dev \
    libpng++-dev \
    libtiff-dev \
    libopenexr-dev \
    libwebp-dev \
    ffmpeg \
    libavcodec-dev \
    libavformat-dev \
    libavutil-dev \
    libswscale-dev \
    libavresample-dev && \
  : "other dependencies" && \
  apt-get install -y -qq \
    libyaml-cpp-dev && \
  : "remove cache" && \
  apt-get autoremove -y -qq && \
  rm -rf /var/lib/apt/lists/*

# Eigen
# ARG EIGEN3_VERSION=3.3.7
# WORKDIR /tmp
# RUN set -x && \
#   git clone -b ${EIGEN3_VERSION} https://gitlab.com/libeigen/eigen.git && \
#   cd eigen && \
#   mkdir -p build && \
#   cd build && \
#   cmake \
#     -DCMAKE_BUILD_TYPE=Release \
#     -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} \
#     .. && \
#   make -j${NUM_THREADS} && \
#   make install && \
#   cd /tmp && \
#   rm -rf *
# ENV Eigen3_DIR=${CMAKE_INSTALL_PREFIX}/share/eigen3/cmake

# g2o
ARG G2O_COMMIT=9b41a4ea5ade8e1250b9c1b279f3a9c098811b5a
WORKDIR /tmp
RUN set -x && \
  git clone https://github.com/RainerKuemmerle/g2o.git && \
  cd g2o && \
  git checkout ${G2O_COMMIT} && \
  mkdir -p build && \
  cd build && \
  cmake \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} \
    -DBUILD_SHARED_LIBS=ON \
    -DBUILD_UNITTESTS=OFF \
    -DBUILD_WITH_MARCH_NATIVE=ON \
    -DG2O_USE_CHOLMOD=OFF \
    -DG2O_USE_CSPARSE=ON \
    -DG2O_USE_OPENGL=OFF \
    -DG2O_USE_OPENMP=ON \
    -DG2O_BUILD_APPS=OFF \
    -DG2O_BUILD_EXAMPLES=OFF \
    -DG2O_BUILD_LINKED_APPS=OFF \
    .. && \
  make -j${NUM_THREADS} && \
  make install && \
  cd /tmp && \
  rm -rf *
ENV g2o_DIR=${CMAKE_INSTALL_PREFIX}/lib/cmake/g2o 

# # OpenCV
# ARG OPENCV_VERSION=4.1.0
# WORKDIR /tmp
# RUN set -x && \
#   wget -q https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.zip && \
#   unzip -q ${OPENCV_VERSION}.zip && \
#   rm -rf ${OPENCV_VERSION}.zip && \
#   cd opencv-${OPENCV_VERSION} && \
#   mkdir -p build && \
#   cd build && \
#   cmake \
#     -DCMAKE_BUILD_TYPE=Release \
#     -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} \
#     -DBUILD_DOCS=OFF \
#     -DBUILD_EXAMPLES=OFF \
#     -DBUILD_JASPER=OFF \
#     -DBUILD_OPENEXR=OFF \
#     -DBUILD_PERF_TESTS=OFF \
#     -DBUILD_TESTS=OFF \
#     -DBUILD_opencv_apps=OFF \
#     -DBUILD_opencv_dnn=OFF \
#     -DBUILD_opencv_ml=OFF \
#     -DBUILD_opencv_python_bindings_generator=OFF \
#     -DENABLE_CXX11=ON \
#     -DENABLE_FAST_MATH=ON \
#     -DWITH_EIGEN=ON \
#     -DWITH_FFMPEG=ON \
#     -DWITH_OPENMP=ON \
#     .. && \
#   make -j${NUM_THREADS} && \
#   make install && \
#   cd /tmp && \
#   rm -rf *
# ENV OpenCV_DIR=${CMAKE_INSTALL_PREFIX}/lib/cmake/opencv4

# DBoW2
ARG DBOW2_COMMIT=687fcb74dd13717c46add667e3fbfa9828a7019f
WORKDIR /tmp
RUN set -x && \
  git clone https://github.com/shinsumicco/DBoW2.git && \
  cd DBoW2 && \
  git checkout ${DBOW2_COMMIT} && \
  mkdir -p build && \
  cd build && \
  cmake \
    -DCMAKE_BUILD_TYPE=Release \
    # -DEigen3_DIR=${Eigen3_DIR} \
    -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} \
    .. && \
  make -j${NUM_THREADS} && \
  make install && \
  cd /tmp && \
  rm -rf *
ENV DBoW2_DIR=${CMAKE_INSTALL_PREFIX}/lib/cmake/DBoW2

# Pangolin
ARG PANGOLIN_COMMIT=ad8b5f83222291c51b4800d5a5873b0e90a0cf81
WORKDIR /tmp
RUN set -x && \
  git clone https://github.com/stevenlovegrove/Pangolin.git && \
  cd Pangolin && \
  git checkout ${PANGOLIN_COMMIT} && \
  sed -i -e "193,198d" ./src/utils/file_utils.cpp && \
  mkdir -p build && \
  cd build && \
  cmake \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} \
    -DBUILD_EXAMPLES=OFF \
    -DBUILD_PANGOLIN_DEPTHSENSE=OFF \
    -DBUILD_PANGOLIN_FFMPEG=OFF \
    -DBUILD_PANGOLIN_LIBDC1394=OFF \
    -DBUILD_PANGOLIN_LIBJPEG=OFF \
    -DBUILD_PANGOLIN_LIBOPENEXR=OFF \
    -DBUILD_PANGOLIN_LIBPNG=OFF \
    -DBUILD_PANGOLIN_LIBREALSENSE=OFF \
    -DBUILD_PANGOLIN_LIBREALSENSE2=OFF \
    -DBUILD_PANGOLIN_LIBTIFF=OFF \
    -DBUILD_PANGOLIN_LIBUVC=OFF \
    -DBUILD_PANGOLIN_LZ4=OFF \
    -DBUILD_PANGOLIN_OPENNI=OFF \
    -DBUILD_PANGOLIN_OPENNI2=OFF \
    -DBUILD_PANGOLIN_PLEORA=OFF \
    -DBUILD_PANGOLIN_PYTHON=OFF \
    -DBUILD_PANGOLIN_TELICAM=OFF \
    -DBUILD_PANGOLIN_TOON=OFF \
    -DBUILD_PANGOLIN_UVC_MEDIAFOUNDATION=OFF \
    -DBUILD_PANGOLIN_V4L=OFF \
    -DBUILD_PANGOLIN_VIDEO=OFF \
    -DBUILD_PANGOLIN_ZSTD=OFF \
    -DBUILD_PYPANGOLIN_MODULE=OFF \
    .. && \
  make -j${NUM_THREADS} && \
  make install && \
  cd /tmp && \
  rm -rf *
ENV Pangolin_DIR=${CMAKE_INSTALL_PREFIX}/lib/cmake/Pangolin

# COPY ./src/colcon_ignore/openvslam /openvslam
# RUN cd /openvslam &&  \
#   mkdir -p build && \
#   cd build && \
#   cmake \
#     -DCMAKE_BUILD_TYPE=RelWithDebInfo \
#     -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} \
#     -DBUILD_WITH_MARCH_NATIVE=ON \
#     -DUSE_PANGOLIN_VIEWER=ON \
#     -DUSE_SOCKET_PUBLISHER=OFF \
#     -DUSE_STACK_TRACE_LOGGER=ON \
#     -DBOW_FRAMEWORK=DBoW2 \
#     -DBUILD_TESTS=OFF \
#     -DINSTALL_PANGOLIN_VIEWER=ON \
#     # -DEigen3_DIR=${Eigen3_DIR} \
#     .. && \
#   make -j${NUM_THREADS} && \
#   make install && \
#   # rm -rf CMakeCache.txt CMakeFiles Makefile cmake_install.cmake example src && \
#   chmod -R 777 ./*
#   ENV openvslam_DIR=_DIR=${CMAKE_INSTALL_PREFIX}/lib/cmake/openvslam

# install rtabmap lib

RUN add-apt-repository ppa:joseluisblancoc/gtsam-develop -y
RUN apt-get update \
    && apt-get -y install \
      libqt5svg5-dev \
      libgtsam-dev \
    #
    # Clean ups
    && apt-get autoremove -y \
    && apt-get clean -y \
    && rm -rf /var/lib/apt/lists/*

ARG LIBNABO_COMMIT=7e378f6765393462357b8b74d8dc8c5554542ae6
WORKDIR /tmp
RUN set -x && \
  git clone https://github.com/ethz-asl/libnabo.git && \
  cd libnabo && \
  git checkout ${LIBNABO_COMMIT} && \
  mkdir -p build && \
  cd build && \
  cmake \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} \
    .. && \
  make -j${NUM_THREADS} && \
  make install && \
  cd /tmp && \
  rm -rf *

ARG LIBPOINTMATCHER_COMMIT=00004bd41e44a1cf8de24ad87e4914760717cbcc
WORKDIR /tmp
RUN set -x && \
  git clone https://github.com/ethz-asl/libpointmatcher.git && \
  cd libpointmatcher && \
  git checkout ${LIBPOINTMATCHER_COMMIT} && \
  mkdir -p build && \
  cd build && \
  cmake \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} \
    .. && \
  make -j${NUM_THREADS} && \
  make install && \
  cd /tmp && \
  rm -rf *

ARG RTABMAP_COMMIT=6b119c1f900b8b3c2c9f4396777ee34aa04eaad3
WORKDIR /tmp
RUN set -x && \
  git clone https://github.com/introlab/rtabmap.git && \
  cd rtabmap && \
  git checkout ${RTABMAP_COMMIT} && \
  mkdir -p build && \
  cd build && \
  cmake \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} \
    .. && \
  make -j${NUM_THREADS} && \
  make install && \
  cd /tmp && \
  rm -rf * && \
  ldconfig
# ENV DBoW2_DIR=${CMAKE_INSTALL_PREFIX}/lib/cmake/DBoW2

ENV FASTRTPS_DEFAULT_PROFILES_FILE=/workspaces/ws_robogreen/fast_dds_config.xml

RUN echo "source /workspaces/ws_robogreen/install/setup.bash" >> /home/${USERNAME}/.bashrc \
    && usermod -aG 104 vscode \
    && usermod -aG video vscode \
    && usermod -aG dialout vscode 
matlabbe commented 3 years ago

I tried with a minimal Dockerfile (from ros:foxy) with ros-foxy-desktop and ros-foxy-libg2o (had to update rtabmap library to find that g2o on foxy), gtsam binaries (like in your dockerfile), libpointmatcher from source. Using gdb:

~/ros2_ws/install/rtabmap_ros/lib/rtabmap_ros# gdb ex run --args rtabmap

GNU gdb (Ubuntu 9.2-0ubuntu1~20.04) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from rtabmap...
(No debugging symbols found in rtabmap)
(gdb) run
Starting program: /root/ros2_ws/install/rtabmap_ros/lib/rtabmap_ros/rtabmap 
warning: Error disabling address space randomization: Operation not permitted
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
double free or corruption (out)

Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50  ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007fa561e23859 in __GI_abort () at abort.c:79
#2  0x00007fa561e8e3ee in __libc_message (action=action@entry=do_abort, fmt=fmt@entry=0x7fa561fb8285 "%s\n") at ../sysdeps/posix/libc_fatal.c:155
#3  0x00007fa561e9647c in malloc_printerr (str=str@entry=0x7fa561fba670 "double free or corruption (out)") at malloc.c:5347
#4  0x00007fa561e98120 in _int_free (av=0x7fa561fe9b80 <main_arena>, p=0x5587f111efb0, have_lock=<optimized out>) at malloc.c:4314
#5  0x00007fa55ee968e1 in g2o::EdgeProjectP2MC_Intrinsics::~EdgeProjectP2MC_Intrinsics() () at /opt/ros/foxy/lib/libg2o_types_sba.so
#6  0x00007fa55965ec84 in g2o::Factory::registerType(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, g2o::AbstractHyperGraphElementCreator*) ()
    at /opt/ros/foxy/lib/libg2o_core.so
#7  0x00007fa55ee8fb47 in  () at /opt/ros/foxy/lib/libg2o_types_sba.so
#8  0x00007fa56ae23b8a in  () at /lib64/ld-linux-x86-64.so.2
#9  0x00007fa56ae23c91 in  () at /lib64/ld-linux-x86-64.so.2
#10 0x00007fa56ae1313a in  () at /lib64/ld-linux-x86-64.so.2
#11 0x0000000000000001 in  ()
#12 0x00007fffeca30665 in  ()
#13 0x0000000000000000 in  ()
(gdb) 

Looks like it is crashing in /opt/ros/foxy/lib/libg2o_types_sba.so. I'll try to uninstall those g2o binaries and build an older g2o version.

matlabbe commented 3 years ago

Installing older g2o version (I did go down to 20170730_git version) does the same error. I noticed that without GTSAM dependency, it was working. I reinstalled latest g2o binaries, then installed GTSAM stable release instead of develop, then it worked!

Instead of:

RUN add-apt-repository ppa:joseluisblancoc/gtsam-develop -y
RUN apt-get update \
    && apt-get -y install \
      libqt5svg5-dev \
      libgtsam-dev \
    #
    # Clean ups
    && apt-get autoremove -y \
    && apt-get clean -y \
    && rm -rf /var/lib/apt/lists/*

do:

RUN add-apt-repository ppa:borglab/gtsam-release-4.0 -y
RUN apt-get update \
    && apt-get -y install \
      libqt5svg5-dev \
      libgtsam-dev \
      libgtsam-unstable-dev \
    #
    # Clean ups
    && apt-get autoremove -y \
    && apt-get clean -y \
    && rm -rf /var/lib/apt/lists/*

For fast test to detect the bug, just after building rtabmap library:

cd ~/rtabmap/bin
./rtabmap-console

If it crashes, do

gdb rtabmap-console
# type "run",
# then "bt" after crash
askokostic commented 3 years ago

I'm getting these error messages when building the package

[Processing: rtabmap_ros]                               
--- stderr: rtabmap_ros                                 
CMake Warning:
  Manually-specified variables were not used by the project:

    DBoW2_DIR
    Pangolin_DIR
    g2o_DIR
    openvslam_DIR

Member name 'global' in the service request 'GetMap' is a reserved keyword in Python and is not supported at the moment. Please use a different name.
Member name 'global' in the service request 'PublishMap' is a reserved keyword in Python and is not supported at the moment. Please use a different name.
/ros2_ws/src/rtabmap_ros/src/MsgConversion.cpp: In function ‘bool rtabmap_ros::convertScanMsg(const LaserScan&, const string&, const string&, const rclcpp::Time&, rtabmap::LaserScan&, tf2_ros::Buffer&, double, bool)’:
/ros2_ws/src/rtabmap_ros/src/MsgConversion.cpp:1741:74: error: no match for ‘operator=’ (operand types are ‘cv::Mat’ and ‘rtabmap::LaserScan’)
 1741 |   data = rtabmap::util3d::laserScan2dFromPointCloud(*pclScan, laserToOdom); // put back in laser frame
      |                                                                          ^
In file included from /usr/include/opencv4/opencv2/core/mat.hpp:3724,
                 from /usr/include/opencv4/opencv2/core.hpp:59,
                 from /usr/include/opencv4/opencv2/opencv.hpp:52,
                 from /ros2_ws/src/rtabmap_ros/include/rtabmap_ros/MsgConversion.h:40,
                 from /ros2_ws/src/rtabmap_ros/src/MsgConversion.cpp:28:
/usr/include/opencv4/opencv2/core/mat.inl.hpp:743:6: note: candidate: ‘cv::Mat& cv::Mat::operator=(const cv::Mat&)’
  743 | Mat& Mat::operator = (const Mat& m)
      |      ^~~
/usr/include/opencv4/opencv2/core/mat.inl.hpp:743:34: note:   no known conversion for argument 1 from ‘rtabmap::LaserScan’ to ‘const cv::Mat&’
  743 | Mat& Mat::operator = (const Mat& m)
      |                       ~~~~~~~~~~~^
In file included from /usr/include/opencv4/opencv2/core/mat.hpp:3724,
                 from /usr/include/opencv4/opencv2/core.hpp:59,
                 from /usr/include/opencv4/opencv2/opencv.hpp:52,
                 from /ros2_ws/src/rtabmap_ros/include/rtabmap_ros/MsgConversion.h:40,
                 from /ros2_ws/src/rtabmap_ros/src/MsgConversion.cpp:28:
/usr/include/opencv4/opencv2/core/mat.inl.hpp:3356:6: note: candidate: ‘cv::Mat& cv::Mat::operator=(const cv::MatExpr&)’
 3356 | Mat& Mat::operator = (const MatExpr& e)
      |      ^~~
/usr/include/opencv4/opencv2/core/mat.inl.hpp:3356:38: note:   no known conversion for argument 1 from ‘rtabmap::LaserScan’ to ‘const cv::MatExpr&’
 3356 | Mat& Mat::operator = (const MatExpr& e)
      |                       ~~~~~~~~~~~~~~~^
In file included from /usr/include/opencv4/opencv2/core.hpp:59,
                 from /usr/include/opencv4/opencv2/opencv.hpp:52,
                 from /ros2_ws/src/rtabmap_ros/include/rtabmap_ros/MsgConversion.h:40,
                 from /ros2_ws/src/rtabmap_ros/src/MsgConversion.cpp:28:
/usr/include/opencv4/opencv2/core/mat.hpp:1241:10: note: candidate: ‘cv::Mat& cv::Mat::operator=(const Scalar&)’
 1241 |     Mat& operator = (const Scalar& s);
      |          ^~~~~~~~
/usr/include/opencv4/opencv2/core/mat.hpp:1241:36: note:   no known conversion for argument 1 from ‘rtabmap::LaserScan’ to ‘const Scalar&’ {aka ‘const cv::Scalar_<double>&’}
 1241 |     Mat& operator = (const Scalar& s);
      |                      ~~~~~~~~~~~~~~^
In file included from /usr/include/opencv4/opencv2/core/mat.hpp:3724,
                 from /usr/include/opencv4/opencv2/core.hpp:59,
                 from /usr/include/opencv4/opencv2/opencv.hpp:52,
                 from /ros2_ws/src/rtabmap_ros/include/rtabmap_ros/MsgConversion.h:40,
                 from /ros2_ws/src/rtabmap_ros/src/MsgConversion.cpp:28:
/usr/include/opencv4/opencv2/core/mat.inl.hpp:1405:6: note: candidate: ‘cv::Mat& cv::Mat::operator=(cv::Mat&&)’
 1405 | Mat& Mat::operator = (Mat&& m)
      |      ^~~
/usr/include/opencv4/opencv2/core/mat.inl.hpp:1405:29: note:   no known conversion for argument 1 from ‘rtabmap::LaserScan’ to ‘cv::Mat&&’
 1405 | Mat& Mat::operator = (Mat&& m)
      |                       ~~~~~~^
/ros2_ws/src/rtabmap_ros/src/MsgConversion.cpp:1749:74: error: no match for ‘operator=’ (operand types are ‘cv::Mat’ and ‘rtabmap::LaserScan’)
 1749 |   data = rtabmap::util3d::laserScan2dFromPointCloud(*pclScan, laserToOdom); // put back in laser frame
      |                                                                          ^
In file included from /usr/include/opencv4/opencv2/core/mat.hpp:3724,
                 from /usr/include/opencv4/opencv2/core.hpp:59,
                 from /usr/include/opencv4/opencv2/opencv.hpp:52,
                 from /ros2_ws/src/rtabmap_ros/include/rtabmap_ros/MsgConversion.h:40,
                 from /ros2_ws/src/rtabmap_ros/src/MsgConversion.cpp:28:
/usr/include/opencv4/opencv2/core/mat.inl.hpp:743:6: note: candidate: ‘cv::Mat& cv::Mat::operator=(const cv::Mat&)’
  743 | Mat& Mat::operator = (const Mat& m)
      |      ^~~
/usr/include/opencv4/opencv2/core/mat.inl.hpp:743:34: note:   no known conversion for argument 1 from ‘rtabmap::LaserScan’ to ‘const cv::Mat&’
  743 | Mat& Mat::operator = (const Mat& m)
      |                       ~~~~~~~~~~~^
In file included from /usr/include/opencv4/opencv2/core/mat.hpp:3724,
                 from /usr/include/opencv4/opencv2/core.hpp:59,
                 from /usr/include/opencv4/opencv2/opencv.hpp:52,
                 from /ros2_ws/src/rtabmap_ros/include/rtabmap_ros/MsgConversion.h:40,
                 from /ros2_ws/src/rtabmap_ros/src/MsgConversion.cpp:28:
/usr/include/opencv4/opencv2/core/mat.inl.hpp:3356:6: note: candidate: ‘cv::Mat& cv::Mat::operator=(const cv::MatExpr&)’
 3356 | Mat& Mat::operator = (const MatExpr& e)
      |      ^~~
/usr/include/opencv4/opencv2/core/mat.inl.hpp:3356:38: note:   no known conversion for argument 1 from ‘rtabmap::LaserScan’ to ‘const cv::MatExpr&’
 3356 | Mat& Mat::operator = (const MatExpr& e)
      |                       ~~~~~~~~~~~~~~~^
In file included from /usr/include/opencv4/opencv2/core.hpp:59,
                 from /usr/include/opencv4/opencv2/opencv.hpp:52,
                 from /ros2_ws/src/rtabmap_ros/include/rtabmap_ros/MsgConversion.h:40,
                 from /ros2_ws/src/rtabmap_ros/src/MsgConversion.cpp:28:
/usr/include/opencv4/opencv2/core/mat.hpp:1241:10: note: candidate: ‘cv::Mat& cv::Mat::operator=(const Scalar&)’
 1241 |     Mat& operator = (const Scalar& s);
      |          ^~~~~~~~
/usr/include/opencv4/opencv2/core/mat.hpp:1241:36: note:   no known conversion for argument 1 from ‘rtabmap::LaserScan’ to ‘const Scalar&’ {aka ‘const cv::Scalar_<double>&’}
 1241 |     Mat& operator = (const Scalar& s);
      |                      ~~~~~~~~~~~~~~^
In file included from /usr/include/opencv4/opencv2/core/mat.hpp:3724,
                 from /usr/include/opencv4/opencv2/core.hpp:59,
                 from /usr/include/opencv4/opencv2/opencv.hpp:52,
                 from /ros2_ws/src/rtabmap_ros/include/rtabmap_ros/MsgConversion.h:40,
                 from /ros2_ws/src/rtabmap_ros/src/MsgConversion.cpp:28:
/usr/include/opencv4/opencv2/core/mat.inl.hpp:1405:6: note: candidate: ‘cv::Mat& cv::Mat::operator=(cv::Mat&&)’
 1405 | Mat& Mat::operator = (Mat&& m)
      |      ^~~
/usr/include/opencv4/opencv2/core/mat.inl.hpp:1405:29: note:   no known conversion for argument 1 from ‘rtabmap::LaserScan’ to ‘cv::Mat&&’
 1405 | Mat& Mat::operator = (Mat&& m)
      |                       ~~~~~~^
/ros2_ws/src/rtabmap_ros/src/MsgConversion.cpp: In function ‘bool rtabmap_ros::convertScan3dMsg(const PointCloud2&, const string&, const string&, const rclcpp::Time&, rtabmap::LaserScan&, tf2_ros::Buffer&, double, int, float)’:
/ros2_ws/src/rtabmap_ros/src/MsgConversion.cpp:1842:156: warning: ‘rtabmap::LaserScan::LaserScan(const rtabmap::LaserScan&, int, float, rtabmap::LaserScan::Format, const rtabmap::Transform&)’ is deprecated: Use version without "format" argument. [-Wdeprecated-declarations]
 1842 |    scan = rtabmap::LaserScan(rtabmap::util3d::laserScanFromPointCloud(*pclScan), maxPoints, maxRange, rtabmap::LaserScan::kXYZRGBNormal, scanLocalTransform);
      |                                                                                                                                                            ^
In file included from /usr/local/lib/rtabmap-0.20/../../include/rtabmap-0.20/rtabmap/core/Transform.h:31,
                 from /ros2_ws/src/rtabmap_ros/include/rtabmap_ros/MsgConversion.h:44,
                 from /ros2_ws/src/rtabmap_ros/src/MsgConversion.cpp:28:
/usr/local/lib/rtabmap-0.20/../../include/rtabmap-0.20/rtabmap/core/LaserScan.h:78:21: note: declared here
   78 |  RTABMAP_DEPRECATED(LaserScan(const LaserScan & data,
      |                     ^~~~~~~~~
/usr/local/lib/rtabmap-0.20/../../include/rtabmap-0.20/rtabmap/core/RtabmapExp.h:42:39: note: in definition of macro ‘RTABMAP_DEPRECATED’
   42 | #define RTABMAP_DEPRECATED(func, msg) func __attribute__ ((deprecated(msg)))
      |                                       ^~~~
/ros2_ws/src/rtabmap_ros/src/MsgConversion.cpp:1852:154: warning: ‘rtabmap::LaserScan::LaserScan(const rtabmap::LaserScan&, int, float, rtabmap::LaserScan::Format, const rtabmap::Transform&)’ is deprecated: Use version without "format" argument. [-Wdeprecated-declarations]
 1852 |    scan = rtabmap::LaserScan(rtabmap::util3d::laserScanFromPointCloud(*pclScan), maxPoints, maxRange, rtabmap::LaserScan::kXYZINormal, scanLocalTransform);
      |                                                                                                                                                          ^
In file included from /usr/local/lib/rtabmap-0.20/../../include/rtabmap-0.20/rtabmap/core/Transform.h:31,
                 from /ros2_ws/src/rtabmap_ros/include/rtabmap_ros/MsgConversion.h:44,
                 from /ros2_ws/src/rtabmap_ros/src/MsgConversion.cpp:28:
/usr/local/lib/rtabmap-0.20/../../include/rtabmap-0.20/rtabmap/core/LaserScan.h:78:21: note: declared here
   78 |  RTABMAP_DEPRECATED(LaserScan(const LaserScan & data,
      |                     ^~~~~~~~~
/usr/local/lib/rtabmap-0.20/../../include/rtabmap-0.20/rtabmap/core/RtabmapExp.h:42:39: note: in definition of macro ‘RTABMAP_DEPRECATED’
   42 | #define RTABMAP_DEPRECATED(func, msg) func __attribute__ ((deprecated(msg)))
      |                                       ^~~~
/ros2_ws/src/rtabmap_ros/src/MsgConversion.cpp:1862:153: warning: ‘rtabmap::LaserScan::LaserScan(const rtabmap::LaserScan&, int, float, rtabmap::LaserScan::Format, const rtabmap::Transform&)’ is deprecated: Use version without "format" argument. [-Wdeprecated-declarations]
 1862 |    scan = rtabmap::LaserScan(rtabmap::util3d::laserScanFromPointCloud(*pclScan), maxPoints, maxRange, rtabmap::LaserScan::kXYZNormal, scanLocalTransform);
      |                                                                                                                                                         ^
In file included from /usr/local/lib/rtabmap-0.20/../../include/rtabmap-0.20/rtabmap/core/Transform.h:31,
                 from /ros2_ws/src/rtabmap_ros/include/rtabmap_ros/MsgConversion.h:44,
                 from /ros2_ws/src/rtabmap_ros/src/MsgConversion.cpp:28:
/usr/local/lib/rtabmap-0.20/../../include/rtabmap-0.20/rtabmap/core/LaserScan.h:78:21: note: declared here
   78 |  RTABMAP_DEPRECATED(LaserScan(const LaserScan & data,
      |                     ^~~~~~~~~
/usr/local/lib/rtabmap-0.20/../../include/rtabmap-0.20/rtabmap/core/RtabmapExp.h:42:39: note: in definition of macro ‘RTABMAP_DEPRECATED’
   42 | #define RTABMAP_DEPRECATED(func, msg) func __attribute__ ((deprecated(msg)))
      |                                       ^~~~
/ros2_ws/src/rtabmap_ros/src/MsgConversion.cpp:1875:150: warning: ‘rtabmap::LaserScan::LaserScan(const rtabmap::LaserScan&, int, float, rtabmap::LaserScan::Format, const rtabmap::Transform&)’ is deprecated: Use version without "format" argument. [-Wdeprecated-declarations]
 1875 |    scan = rtabmap::LaserScan(rtabmap::util3d::laserScanFromPointCloud(*pclScan), maxPoints, maxRange, rtabmap::LaserScan::kXYZRGB, scanLocalTransform);
      |                                                                                                                                                      ^
In file included from /usr/local/lib/rtabmap-0.20/../../include/rtabmap-0.20/rtabmap/core/Transform.h:31,
                 from /ros2_ws/src/rtabmap_ros/include/rtabmap_ros/MsgConversion.h:44,
                 from /ros2_ws/src/rtabmap_ros/src/MsgConversion.cpp:28:
/usr/local/lib/rtabmap-0.20/../../include/rtabmap-0.20/rtabmap/core/LaserScan.h:78:21: note: declared here
   78 |  RTABMAP_DEPRECATED(LaserScan(const LaserScan & data,
      |                     ^~~~~~~~~
/usr/local/lib/rtabmap-0.20/../../include/rtabmap-0.20/rtabmap/core/RtabmapExp.h:42:39: note: in definition of macro ‘RTABMAP_DEPRECATED’
   42 | #define RTABMAP_DEPRECATED(func, msg) func __attribute__ ((deprecated(msg)))
      |                                       ^~~~
/ros2_ws/src/rtabmap_ros/src/MsgConversion.cpp:1885:148: warning: ‘rtabmap::LaserScan::LaserScan(const rtabmap::LaserScan&, int, float, rtabmap::LaserScan::Format, const rtabmap::Transform&)’ is deprecated: Use version without "format" argument. [-Wdeprecated-declarations]
 1885 |    scan = rtabmap::LaserScan(rtabmap::util3d::laserScanFromPointCloud(*pclScan), maxPoints, maxRange, rtabmap::LaserScan::kXYZI, scanLocalTransform);
      |                                                                                                                                                    ^
In file included from /usr/local/lib/rtabmap-0.20/../../include/rtabmap-0.20/rtabmap/core/Transform.h:31,
                 from /ros2_ws/src/rtabmap_ros/include/rtabmap_ros/MsgConversion.h:44,
                 from /ros2_ws/src/rtabmap_ros/src/MsgConversion.cpp:28:
/usr/local/lib/rtabmap-0.20/../../include/rtabmap-0.20/rtabmap/core/LaserScan.h:78:21: note: declared here
   78 |  RTABMAP_DEPRECATED(LaserScan(const LaserScan & data,
      |                     ^~~~~~~~~
/usr/local/lib/rtabmap-0.20/../../include/rtabmap-0.20/rtabmap/core/RtabmapExp.h:42:39: note: in definition of macro ‘RTABMAP_DEPRECATED’
   42 | #define RTABMAP_DEPRECATED(func, msg) func __attribute__ ((deprecated(msg)))
      |                                       ^~~~
/ros2_ws/src/rtabmap_ros/src/MsgConversion.cpp:1895:147: warning: ‘rtabmap::LaserScan::LaserScan(const rtabmap::LaserScan&, int, float, rtabmap::LaserScan::Format, const rtabmap::Transform&)’ is deprecated: Use version without "format" argument. [-Wdeprecated-declarations]
 1895 |    scan = rtabmap::LaserScan(rtabmap::util3d::laserScanFromPointCloud(*pclScan), maxPoints, maxRange, rtabmap::LaserScan::kXYZ, scanLocalTransform);
      |                                                                                                                                                   ^
In file included from /usr/local/lib/rtabmap-0.20/../../include/rtabmap-0.20/rtabmap/core/Transform.h:31,
                 from /ros2_ws/src/rtabmap_ros/include/rtabmap_ros/MsgConversion.h:44,
                 from /ros2_ws/src/rtabmap_ros/src/MsgConversion.cpp:28:
/usr/local/lib/rtabmap-0.20/../../include/rtabmap-0.20/rtabmap/core/LaserScan.h:78:21: note: declared here
   78 |  RTABMAP_DEPRECATED(LaserScan(const LaserScan & data,
      |                     ^~~~~~~~~
/usr/local/lib/rtabmap-0.20/../../include/rtabmap-0.20/rtabmap/core/RtabmapExp.h:42:39: note: in definition of macro ‘RTABMAP_DEPRECATED’
   42 | #define RTABMAP_DEPRECATED(func, msg) func __attribute__ ((deprecated(msg)))
      |                                       ^~~~
/ros2_ws/src/rtabmap_ros/src/OdometryROS.cpp: In member function ‘void rtabmap_ros::OdometryROS::init(bool, bool, bool)’:
/ros2_ws/src/rtabmap_ros/src/OdometryROS.cpp:318:34: error: ‘class rtabmap::Odometry’ has no member named ‘canProcessIMU’; did you mean ‘canProcessAsyncIMU’?
  318 |  if(waitIMUToinit_ || odometry_->canProcessIMU())
      |                                  ^~~~~~~~~~~~~
      |                                  canProcessAsyncIMU
/ros2_ws/src/rtabmap_ros/src/OdometryROS.cpp: In member function ‘void rtabmap_ros::OdometryROS::callbackIMU(sensor_msgs::msg::Imu_<std::allocator<void> >::SharedPtr)’:
/ros2_ws/src/rtabmap_ros/src/OdometryROS.cpp:357:18: error: ‘class rtabmap::Odometry’ has no member named ‘canProcessIMU’; did you mean ‘canProcessAsyncIMU’?
  357 |   if(!odometry_->canProcessIMU() &&
      |                  ^~~~~~~~~~~~~
      |                  canProcessAsyncIMU
/ros2_ws/src/rtabmap_ros/src/OdometryROS.cpp:385:18: error: ‘class rtabmap::Odometry’ has no member named ‘canProcessIMU’; did you mean ‘canProcessAsyncIMU’?
  385 |   if(!odometry_->canProcessIMU())
      |                  ^~~~~~~~~~~~~
      |                  canProcessAsyncIMU
/ros2_ws/src/rtabmap_ros/src/OdometryROS.cpp: In member function ‘void rtabmap_ros::OdometryROS::processData(const rtabmap::SensorData&, const rclcpp::Time&)’:
/ros2_ws/src/rtabmap_ros/src/OdometryROS.cpp:455:17: error: ‘class rtabmap::Odometry’ has no member named ‘canProcessIMU’; did you mean ‘canProcessAsyncIMU’?
  455 |   if(odometry_->canProcessIMU() && data.imu().empty() && lastImuReceivedStamp_>0.0 && data.stamp() > lastImuReceivedStamp_)
      |                 ^~~~~~~~~~~~~
      |                 canProcessAsyncIMU
make[2]: *** [CMakeFiles/rtabmap_ros.dir/build.make:63: CMakeFiles/rtabmap_ros.dir/src/MsgConversion.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [CMakeFiles/rtabmap_ros.dir/build.make:89: CMakeFiles/rtabmap_ros.dir/src/OdometryROS.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:893: CMakeFiles/rtabmap_ros.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
---
Failed   <<< rtabmap_ros [44.1s, exited with code 2]
matlabbe commented 3 years ago

This is a change done yesterday (canProcessIMU->canProcessAsyncIMU), pull latest rtabmap_ros ros2 branch: https://github.com/introlab/rtabmap_ros/commit/688584db65b6e95b176680ae765642979252d760

askokostic commented 3 years ago

Console output:

[INFO] [launch]: All log files can be found below /home/vscode/.ros/log/2021-03-02-21-14-02-494762-aleksa-Vostro-7590-36189
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [rtabmap-1]: process started with pid [36194]
[INFO] [rtabmapviz-2]: process started with pid [36196]
[ERROR] [rtabmapviz-2]: process has died [pid 36196, exit code -11, cmd '/workspaces/ws_robogreen/install/rtabmap_ros/lib/rtabmap_ros/rtabmapviz --ros-args --params-file /tmp/launch_params_yvkr1e5x -r scan:=/scan'].
[ERROR] [rtabmap-1]: process has died [pid 36194, exit code -11, cmd '/workspaces/ws_robogreen/install/rtabmap_ros/lib/rtabmap_ros/rtabmap -d --ros-args --params-file /tmp/launch_params_n045s7ys -r scan:=/scan'].

gdb call stack (of [rtabmap-1]):

libc.so.6!free (Unknown Source:0)
libg2o_types_slam2d.so!g2o::EdgeSE2PointXYCalib::~EdgeSE2PointXYCalib() (Unknown Source:0)
libg2o_core.so!g2o::Factory::registerType(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, g2o::AbstractHyperGraphElementCreator*) (Unknown Source:0)
libg2o_types_slam2d.so!__static_initialization_and_destruction_0(int, int) [clone .constprop.0] (Unknown Source:0)
ld-linux-x86-64.so.2![Unknown/Just-In-Time compiled code] (Unknown Source:0)
matlabbe commented 3 years ago

It seems crashing on another Factory::registerType. Let me rebuild your dockerfile with gtsam stable release and -DBUILD_WITH_MARCH_NATIVE=OFF.

askokostic commented 3 years ago

This and -DBUILD_WITH_MARCH_NATIVE=OFF seemed to have worked. It launches without any errors now. I will try out the other launch files to make sure everything works. Thank you very much!

matlabbe commented 3 years ago

Yeah, just finished testing your dockerfile with those changes and I don't have errors. Well I had an exception from libpointmacher about not existing parameter Force4DoF, which has been added recently. This commit fixed that problem.