ropod-project / ed_sensor_integration

ED plugin for integrating sensor data
0 stars 1 forks source link

laser tracking plugin segfaults #3

Closed sthoduka closed 5 years ago

sthoduka commented 5 years ago

This issue refers to the feature/tracking branch of this repository. After launching ed, with this plugin enabled, it segfaults after a while.

Some details about the crash are below.

Bagfile: https://nextcloud.ropod.org/index.php/apps/files/?dir=/ropod_shared/rosbags/2019/06/20190618&fileid=16869#editor

Launch: roslaunch route_navigation route_navigation_brsu.launch

ed config:

world_name: brsu

plugins:
#  - name: gui_server
#    lib: libed_gui_server_plugin.so     
#    enabled: 0
#    parameters:
#        predict_entities: 0
  - name: laser_integration
    lib: libed_laser_plugin_tracking.so
    frequency: 30
    parameters:
        laser_topic: /ropod/laser/scan
        min_segment_size_pixels: 6
        world_association_distance: 0.2
        segment_depth_threshold: 0.08
        min_cluster_size: 0.05
        max_cluster_size: 10.0
        max_gap_size: 1
        min_gap_size_for_split: 5
        check_door_status: 1
        nominal_corridor_width: 0.5
        correctRot: 1
        correctTrans: 0
        dist_for_object_split: 0.4
#  - name: laser_integration2
#    lib: libed_laser_plugin_tracking2.so
#    frequency: 30
#    parameters:
#        laser_topic: /ropod/laser_back/scan
#        min_segment_size_pixels: 20
#        world_association_distance: 0.2
#        segment_depth_threshold: 0.08
#        min_cluster_size: 0.05
#        max_cluster_size: 10.0
#        max_gap_size: 10
#        min_gap_size_for_split: 10
#        check_door_status: 1
#        nominal_corridor_width: 0.5
#        correctRot: 1
#        correctTrans: 0
#        dist_for_object_split: 0.4

  - name: entity_clearer
    lib: libed_clearer_plugin.so
    enabled: 1
    parameters:
        entity_timeout: 3.0
  - name: route_navigation
    lib: libed_route_navigation_plugin.so
    frequency: 5
    parameters:
        mobidik_initially_connected: 0
        sensor_back: 1
  - name: gui_server
    lib: libed_gui_server_plugin.so
    parameters:
        predict_entities: 0

Workspace status is shown below.

Note: the following packages had cmake build type set to Debug locally: ed, ed_sensor_integration, ed_gui_server, ed_rviz_plugins, route_navigation, problib. I have also tested without 'Debug' and it results in the same segfault.

 Localname                                              S  SCM Version (Spec)                 UID  (Spec)                 URI  (Spec) [http(s)://...]
 ---------                                              -  --- --------------                 -----------                 ---------------------------
 platform/urg_node                                         git master                         fa1b02ecaf06                github.com/ropod-project/urg_node.git
 platform/ropod_low_level_control                       MV git fix/segfault  (develop)        608de4b0f0b2 (72fa7196b65b) git@git.ropod.org:ropod/control/ropod_low_level_control.git
 platform/ropod_teleop                                  MV git feature/cmd_vel_mux  (develop) 1b314c97a9e4 (1a41c78cf010) git@git.ropod.org:ropod/ropod_teleop.git
 platform/robot_common                                  M  git feature/tracking               e7f787c54ab1                github.com/ropod-project/robot_common.git
 platform/ropod_control                                    git master                         99cc97ebf5d0                github.com/ropod-project/ropod_control.git
 platform/ropod_bringup                                    git master                         c564d4829921                github.com/ropod-project/ropod_bringup.git
 platform/ropod_tue_2_bringup                           MC git master                         81a4558b0cb9                github.com/ropod-project/ropod_tue_2_bringup.git
 platform/setup                                            git master                         0b8043ac5fc5                github.com/ropod-project/setup.git
 functionalities/multi-git-status                          git master                         b203cca07164                github.com/fboender/multi-git-status.git
 functionalities/floor_detection                           git master                         bc6644a102e5                git@git.ropod.org:ropod/navigation/floor_detection.git
 functionalities/door_status_detection                  M  git develop                        3dee103fbaff                git@git.ropod.org:ropod/navigation/door_status_detection.git
 functionalities/ros_experimental_nav/teb_local_planner    git ropod-master                   b642b2549205                github.com/ropod-project/teb_local_planner.git
 functionalities/ros_structured_nav                     M  git master                         73ea841d5c3f                github.com/tue-ropod/ros-structured-nav.git
 functionalities/ropod_nav/ropod_navigation             M  git develop                        3ec411d3ac29                git@git.ropod.org:ropod/navigation/ropod_navigation.git
 functionalities/zyre                                      git master                         48471138f7ef                github.com/ropod-project/zyre_base.git
 functionalities/osm_bridge_ros_wrapper                    git develop                        2072b2cb500e                git@git.ropod.org:ropod/wm/osm_bridge_ros_wrapper.git
 functionalities/ropod_comm/ropod_ros_msgs                 git develop                        c913aecd7ab5                git@git.ropod.org:ropod/communication/ropod_ros_msgs.git
 functionalities/wire                                      git master                         0a8ce1439b1c                github.com/ropod-project/wire.git
 functionalities/problib                                M  git ropod-master                   f6e132b4f27f                github.com/ropod-project/problib.git
 functionalities/tue_serialization                         git ropod-master                   3e964f8fcbb5                github.com/ropod-project/tue_serialization.git
 functionalities/tue_filesystem                            git ropod-master                   544b8a632bd1                github.com/ropod-project/tue_filesystem.git
 functionalities/tue_config                                git ropod-master                   db8f58a4772a                github.com/ropod-project/tue_config.git
 functionalities/rgbd                                      git feature/freenect               03afef379822                github.com/ropod-project/rgbd.git
 functionalities/image_recognition                         git ropod-master                   95f3193ab5d7                github.com/ropod-project/image_recognition.git
 functionalities/geolib2                                   git ropod-master                   7ece89a490ee                github.com/ropod-project/geolib2.git
 functionalities/code_profiler                             git ropod-master                   21587d91b687                github.com/ropod-project/code_profiler.git
 functionalities/cb_planner_msgs_srvs                      git ropod-master                   67d2dd5de09f                github.com/ropod-project/cb_planner_msgs_srvs.git
 functionalities/ED/ed_tutorials                           git ropod-master                   ababca75f829                github.com/ropod-project/ed_tutorials.git
 functionalities/ED/ed_sensor_integration               M  git feature/tracking               3571b2a97a8e                github.com/ropod-project/ed_sensor_integration.git
 functionalities/ED/ed_rviz_plugins                     M  git feature/tracking               98035ebae66d                github.com/ropod-project/ed_rviz_plugins.git
 functionalities/ED/ed_perception_models                   git ropod-master                   b75d09459292                github.com/ropod-project/ed_perception_models.git
 functionalities/ED/ed_perception                          git ropod-master                   abd998335e8a                github.com/ropod-project/ed_perception.git
 functionalities/ED/ed_object_models                    M  git feature/tracking               d3e6cc648bbb                github.com/ropod-project/ed_object_models.git
 functionalities/ED/ed_navigation                          git ropod-master                   ae43fd85c724                github.com/ropod-project/ed_navigation.git
 functionalities/ED/ed_localization                        git ropod-master                   84c57caae506                github.com/ropod-project/ed_localization.git
 functionalities/ED/ed_gui_server                       M  git feature/tracking               c95a65e3cf4c                github.com/ropod-project/ed_gui_server.git
 functionalities/ED/ed                                  M  git feature/tracking               7e2ee9b3ef5c                github.com/ropod-project/ed.git
 applications/occupancy_grids                              git master                         2f3a7fb5e657                git@git.ropod.org:ropod/wm/occupancy_grids.git
 applications/miscellaneous                                git master                         6d9b66d1bfbb                github.com/ropod-project/miscellaneous.git
 applications/ropod_navigation_test                     M  git feature/tracking               732eef230887                github.com/ropod-project/ropod_navigation_test.git

GDB output:

#0  0x00007ffff53f2256 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#1  0x00000000004e12a9 in std::operator< <char, std::char_traits<char>, std::allocator<char> > (__lhs=<error reading variable: Cannot access memory at address 0x7d>, 
    __rhs="Rectangle") at /usr/include/c++/5/bits/basic_string.h:4989
#2  0x00000000004e4eaf in std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >::operator() (this=0x7fffb0000b10, 
    __x=<error reading variable: Cannot access memory at address 0x7d>, __y="Rectangle") at /usr/include/c++/5/bits/stl_function.h:387
#3  0x00007fffd6113482 in std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, double>, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, double> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, double> > >::_M_lower_bound (this=0x7fffb0000b10, __x=0x55, __y=0x7fffb0000b18, __k="Rectangle")
    at /usr/include/c++/5/bits/stl_tree.h:1628
#4  0x00007fffd61127f4 in std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, double>, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, double> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, double> > >::find (this=0x7fffb0000b10, __k="Rectangle") at /usr/include/c++/5/bits/stl_tree.h:2295
#5  0x00007fffd6111cdb in std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, double, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, double> > >::find (this=0x7fffb0000b10, __x="Rectangle") at /usr/include/c++/5/bits/stl_map.h:846
#6  0x00007fffd610fee9 in pbl::PMF::setProbability (this=0x7fffd5842a90, value="Rectangle", p=0.5)
    at /home/ropod/ropod-project-software/catkin_workspace/src/functionalities/problib/src/pdfs/PMF.cpp:123
#7  0x00007fffd64f07cb in ed::tracking::FeatureProbabilities::setProbabilities (this=0x7fffd5842a90, pRectangle_in=0.5, pCircle_in=0.5)
---Type <return> to continue, or q <return> to quit---
    at /home/ropod/ropod-project-software/catkin_workspace/src/functionalities/ED/ed_sensor_integration/src/laser/feature_functions.h:307
#8  0x00007fffd64f0b67 in ed::tracking::FeatureProperties::FeatureProperties (this=0x7fffd5842a90)
    at /home/ropod/ropod-project-software/catkin_workspace/src/functionalities/ED/ed_sensor_integration/src/laser/feature_functions.h:351
#9  0x00007fffd64e02be in LaserPluginTracking::update (this=0x7c7030, world=..., scan=..., sensor_pose=..., req=...)
    at /home/ropod/ropod-project-software/catkin_workspace/src/functionalities/ED/ed_sensor_integration/src/laser/plugin_tracking.cpp:1328
#10 0x00007fffd64dce45 in LaserPluginTracking::process (this=0x7c7030, world=..., req=...)
    at /home/ropod/ropod-project-software/catkin_workspace/src/functionalities/ED/ed_sensor_integration/src/laser/plugin_tracking.cpp:907
#11 0x0000000000531046 in ed::PluginContainer::step (this=0x7bc4f0)
    at /home/ropod/ropod-project-software/catkin_workspace/src/functionalities/ED/ed/src/plugin_container.cpp:189
#12 0x0000000000530d61 in ed::PluginContainer::run (this=0x7bc4f0)
    at /home/ropod/ropod-project-software/catkin_workspace/src/functionalities/ED/ed/src/plugin_container.cpp:141
#13 0x0000000000538353 in boost::_mfi::mf0<void, ed::PluginContainer>::operator() (this=0x7ce3e8, p=0x7bc4f0) at /usr/include/boost/bind/mem_fn_template.hpp:49
#14 0x00000000005382b6 in boost::_bi::list1<boost::_bi::value<ed::PluginContainer*> >::operator()<boost::_mfi::mf0<void, ed::PluginContainer>, boost::_bi::list0> (
    this=0x7ce3f8, f=..., a=...) at /usr/include/boost/bind/bind.hpp:253
#15 0x0000000000538184 in boost::_bi::bind_t<void, boost::_mfi::mf0<void, ed::PluginContainer>, boost::_bi::list1<boost::_bi::value<ed::PluginContainer*> > >::operator()
    (this=0x7ce3e8) at /usr/include/boost/bind/bind_template.hpp:20
#16 0x0000000000537fb2 in boost::detail::thread_data<boost::_bi::bind_t<void, boost::_mfi::mf0<void, ed::PluginContainer>, boost::_bi::list1<boost::_bi::value<ed::PluginContainer*> > > >::run (this=0x7ce230) at /usr/include/boost/thread/detail/thread.hpp:116
#17 0x00007ffff5d8f5d5 in ?? () from /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.58.0
#18 0x00007ffff5b686ba in start_thread (arg=0x7fffd5844700) at pthread_create.c:333
#19 0x00007ffff4df841d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

GDB output from last week (seems to be slightly different, but is still in PMF)

#0  0x00007fffd611324d in std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, double>, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, double> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, double> > >::_S_right (__x=0x3da15e62) at /usr/include/c++/5/bits/stl_tree.h:687
#1  0x00007fffd6112629 in std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, double>, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, double> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, double> > >::_M_erase (this=0x7fffa8020260, __x=0x3da15e62) at /usr/include/c++/5/bits/stl_tree.h:1612
#2  0x00007fffd6111c63 in std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, double>, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, double> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, double> > >::~_Rb_tree (this=0x7fffa8020260, __in_chrg=<optimized out>) at /usr/include/c++/5/bits/stl_tree.h:858
#3  0x00007fffd6111ac4 in std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, double, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, double> > >::~map (this=0x7fffa8020260, __in_chrg=<optimized out>) at /usr/include/c++/5/bits/stl_map.h:96
#4  0x00007fffd6111b80 in pbl::PMF::PMFStruct::~PMFStruct (this=0x7fffa8020250, __in_chrg=<optimized out>)
    at /home/ropod/ropod-project-software/catkin_workspace/src/functionalities/problib/include/problib/pdfs/PMF.h:175
#5  0x00007fffd610fb7c in pbl::PMF::~PMF (this=0x7fffd5842a90, __in_chrg=<optimized out>)
    at /home/ropod/ropod-project-software/catkin_workspace/src/functionalities/problib/src/pdfs/PMF.cpp:59
#6  0x00007fffd64f0a66 in ed::tracking::FeatureProbabilities::~FeatureProbabilities (this=0x7fffd5842a90, __in_chrg=<optimized out>)
    at /home/ropod/ropod-project-software/catkin_workspace/src/functionalities/ED/ed_sensor_integration/src/laser/feature_functions.h:292
---Type <return> to continue, or q <return> to quit---
#7  0x00007fffd64f252f in ed::tracking::FeatureProperties::~FeatureProperties (this=0x7fffd5842a90, __in_chrg=<optimized out>)
    at /home/ropod/ropod-project-software/catkin_workspace/src/functionalities/ED/ed_sensor_integration/src/laser/feature_functions.h:339
#8  0x00007fffd64e1f10 in LaserPluginTracking::update (this=0x7c7060, world=..., scan=..., sensor_pose=..., req=...)
    at /home/ropod/ropod-project-software/catkin_workspace/src/functionalities/ED/ed_sensor_integration/src/laser/plugin_tracking.cpp:1563
#9  0x00007fffd64dce45 in LaserPluginTracking::process (this=0x7c7060, world=..., req=...)
    at /home/ropod/ropod-project-software/catkin_workspace/src/functionalities/ED/ed_sensor_integration/src/laser/plugin_tracking.cpp:907
#10 0x0000000000531046 in ed::PluginContainer::step (this=0x7bc670)
    at /home/ropod/ropod-project-software/catkin_workspace/src/functionalities/ED/ed/src/plugin_container.cpp:189
#11 0x0000000000530d61 in ed::PluginContainer::run (this=0x7bc670)
    at /home/ropod/ropod-project-software/catkin_workspace/src/functionalities/ED/ed/src/plugin_container.cpp:141
#12 0x0000000000538353 in boost::_mfi::mf0<void, ed::PluginContainer>::operator() (this=0x7ce408, p=0x7bc670) at /usr/include/boost/bind/mem_fn_template.hpp:49
#13 0x00000000005382b6 in boost::_bi::list1<boost::_bi::value<ed::PluginContainer*> >::operator()<boost::_mfi::mf0<void, ed::PluginContainer>, boost::_bi::list0> (
    this=0x7ce418, f=..., a=...) at /usr/include/boost/bind/bind.hpp:253
#14 0x0000000000538184 in boost::_bi::bind_t<void, boost::_mfi::mf0<void, ed::PluginContainer>, boost::_bi::list1<boost::_bi::value<ed::PluginContainer*> > >::operator()
    (this=0x7ce408) at /usr/include/boost/bind/bind_template.hpp:20
#15 0x0000000000537fb2 in boost::detail::thread_data<boost::_bi::bind_t<void, boost::_mfi::mf0<void, ed::PluginContainer>, boost::_bi::list1<boost::_bi::value<ed::PluginContainer*> > > >::run (this=0x7ce250) at /usr/include/boost/thread/detail/thread.hpp:116
#16 0x00007ffff5d8f5d5 in ?? () from /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.58.0
#17 0x00007ffff5b686ba in start_thread (arg=0x7fffd5844700) at pthread_create.c:333
#18 0x00007ffff4df841d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
blumenthal commented 5 years ago

I might need to be the below cahne, since some parts seem to rely having it properly set to null once it is deleted.

        delete ptr_; 
                ptr_ = NULL;
whoutman commented 5 years ago

Indeed, like Sebastian mentions the problems is in the problib-library. There, for each functionality, pointers are created which can be shared, but shared pointers was not used. Therefore, I updated the libraries and included the shared pointers. In order to get it running, please update the following packages:

The testfile in the problib-library is updated as well and does not give any segfaults or memory leaks. By used the shared pointers, it turned out to be slightly slower (<1%).

I have the code in simulation as wel as on the bagfile which Santosh created and no problems were detected, so time to test it on the robot now.

sthoduka commented 5 years ago

tested the docking sequence on the robot just now, and there were no crashes (or memory leaks).