Re: Navigation Stack + rtabmap requesting map configuration problem

Posted by mjedmonds on
URL: http://official-rtab-map-forum.206.s1.nabble.com/Navigation-Stack-rtabmap-requesting-map-configuration-problem-tp1378p1484.html

Er - I spoke too soon. Everything is working, but the move_base node is consistently crashing. The behavior is very consistent; eventually it crashes with the same error every time. The amount of time it takes to crash does vary. I'm going to post this same question on http://answers.ros.org/question/237927/move_base-corrupt-linked-list/

Here's the exact error, each time corresponding to the following warning:
[ WARN] [1466704185.100935930]: InflationLayer::updateCosts(): seen_ array size is wrong

and the error:

*** Error in `/opt/ros/indigo/lib/move_base/move_base': corrupted double-linked list: 0x00000000029ad9b0 ***
[move_base-1] process has died [pid 8680, exit code -6, cmd /opt/ros/indigo/lib/move_base/move_base cmd_vel:=/mobility_base/cmd_vel odom:=/odometry/filtered map:=/rtabmap/proj_map __name:=move_base __log:=/home/mb/.ros/log/4d826ab2-396a-11e6-ad82-b8aeed747f2b/move_base-1.log].
log file: /home/mb/.ros/log/4d826ab2-396a-11e6-ad82-b8aeed747f2b/move_base-1*.log
all processes on machine have died, roslaunch will exit

Unfortunately, the log file isn't actually written, so I haven't been able to get any useful information from there. I've done some googling and the only thing I can turn up is line 192 of the source of costmap_2d's inflation_layer.cpp (http://docs.ros.org/jade/api/costmap_2d/html/inflation__layer_8cpp_source.html). So it seems deleting the seen_ array of costmap_2d's inflation layer is causing a corruption of a linked list somewhere else. What's odd is the warning doesn't always cause the error. I'm thinking it might be cause by how rtabmap is updating proj_map, but I'm somewhat shooting in the dark. Any insight would be helpful.

Here's every related file:

base_local_planner_params.yaml
TrajectoryPlannerROS:

  acc_lim_x:  1.0
  acc_lim_y:  1.0
  acc_lim_theta: 2.0
  max_vel_x:  0.4
  min_vel_x:  0.05
  escape_vel: -0.05
  max_vel_theta: 0.5
  min_vel_theta: -0.5
  min_in_place_vel_theta: 0.01
  holonomic_robot: true
  y_vels: [-0.3, -0.05, 0.05, 0.3]

  xy_goal_tolerance:  0.03
  yaw_goal_tolerance: 0.05
  latch_xy_goal_tolerance: true
  
  # make sure that the minimum velocity multiplied by the sim_period is less than twice the tolerance on a goal. Otherwise, the robot will prefer to rotate in place just outside of range of its target position rather than moving towards the goal.
  sim_time: 1.5 # set between 1 and 2. The higher he value, the smoother the path (though more samples would be required).
  sim_granularity: 0.025
  angular_sim_granularity: 0.025
  vx_samples: 12
  vtheta_samples: 20

  meter_scoring: true

  pdist_scale: 0.7 # The higher will follow more the global path.
  gdist_scale: 0.8
  occdist_scale: 0.03
  publish_cost_grid_pc: false

# move_base controller_frequency
controller_frequency: 5.0 

# global planner 
NavfnROS:
  allow_unknown: true
  visualize_potential: false

costmap_common_params.yaml
footprint: [[0.42, -0.43], [0.42, 0.43], [-0.42, 0.43], [-0.42, -0.43]]
footprint_padding: 0.02

inflation_layer:
  inflation_radius: 0.02

transform_tolerance: 2

obstacle_layer:
  obstacle_range: 3.0
  raytrace_range: 3.5
  track_unknown_space: false

  observation_sources: point_cloud_sensor
  
  point_cloud_sensor: {
    sensor_frame: /camera_link,
    data_type: PointCloud2,
    topic: /rtabmap/cloud_map,
    expected_update_rate: 1.0,
    max_obstacle_height: 3.0,
    min_obstacle_height: 0.1,
    marking: true,
    clearing: true
  }

global_costmap_params.yaml
global_costmap:
  global_frame: /map
  robot_base_frame: base_footprint
  update_frequency: 0.5
  publish_frequency: 0.5
  always_send_full_costmap: true
  static_map: true

  plugins:
     - {name: static_layer, type: "rtabmap_ros::StaticLayer"}
     - {name: obstacle_layer, type: "costmap_2d::ObstacleLayer"}
     - {name: inflation_layer, type: "costmap_2d::InflationLayer"}

local_costmap_params.yaml
local_costmap:
  global_frame: odom
  robot_base_frame: base_footprint
  update_frequency: 1
  publish_frequency: 1
  static_map: false
  rolling_window: true
  width: 6.0
  height: 6.0
  resolution: 0.025
  #origin_x: -3.0
  #origin_y: -3.0

  plugins:
    - {name: obstacle_layer,   type: "costmap_2d::ObstacleLayer"}
    - {name: inflation_layer,  type: "costmap_2d::InflationLayer"}

rtabmap.launch
<launch>

  <!-- huroco specific additional params -->
  <arg name="publish_odom_tf"       default="true"/>
  <arg name="publish_map_tf"        default="true"/>
  <arg name="proj_min_cluster_size" default="2.0"/>

  <!-- Localization-only mode -->
  <arg name="localization"            default="true"/>

  <arg if="$(arg localization)" name="mapping" value="false" />
  <arg unless="$(arg localization)" name="mapping" value="true" />

  <!-- Convenience launch file to launch odometry, rtabmap and rtabmapviz nodes at once -->

  <!-- For rgbd:=true
        Your RGB-D sensor should be already started with "depth_registration:=true".
        Examples:
           $ roslaunch freenect_launch freenect.launch depth_registration:=true 
           $ roslaunch openni2_launch openni2.launch depth_registration:=true -->
           
  <!-- For stereo:=true
        Your camera should be calibrated and publishing rectified left and right 
        images + corresponding camera_info msgs. You can use stereo_image_proc for image rectification.
        Example:
           $ roslaunch rtabmap_ros bumblebee.launch -->
     
  <!-- Choose between RGB-D and stereo -->      
  <arg name="rgbd"            default="true"/>
  <arg name="stereo"          default="false"/>
 
  <!-- Choose visualization -->
  <arg name="rtabmapviz"              default="false" /> 
  <arg name="rviz"                    default="false" />
  
  <!-- Corresponding config files -->
  <arg name="cfg"                     default="" /> <!-- To change RTAB-Map's parameters, set the path of config file (*.ini) generated by the standalone app -->
  <arg name="gui_cfg"                 default="~/.ros/rtabmap_gui.ini" />
  <arg name="rviz_cfg"                default="-d $(find rtabmap_ros)/launch/config/rgbd.rviz" />
  
  <arg name="frame_id"                default="base_link"/>     <!-- Fixed frame id, you may set "base_link" or "base_footprint" if they are published -->
  <arg name="namespace"               default="rtabmap"/>
  <arg name="database_path"           default="~/.ros/rtabmap.db"/>
  <arg name="queue_size"              default="10"/>
  <arg name="wait_for_transform"      default="0.5"/>

  <arg if="$(arg localization)" name="rtabmap_args" value="" />
  <arg unless="$(arg localization)" name="rtabmap_args" value="--delete_db_on_start" />

  <arg name="launch_prefix"           default=""/>              <!-- for debugging purpose, it fills launch-prefix tag of the nodes -->
  
  <!-- RGB-D related topics -->
  <arg name="rgb_topic"               default="/camera/rgb/image_rect_color" />
  <arg name="depth_topic"             default="/camera/depth_registered/image_raw" />
  <arg name="camera_info_topic"       default="/camera/rgb/camera_info" />
  
  <!-- stereo related topics -->
  <arg name="stereo_namespace"        default="/stereo_camera"/>
  <arg name="left_image_topic"        default="$(arg stereo_namespace)/left/image_rect_color" />
  <arg name="right_image_topic"       default="$(arg stereo_namespace)/right/image_rect" />      <!-- using grayscale image for efficiency -->
  <arg name="left_camera_info_topic"  default="$(arg stereo_namespace)/left/camera_info" />
  <arg name="right_camera_info_topic" default="$(arg stereo_namespace)/right/camera_info" />
  <arg name="approx_sync"             default="false"/>         <!-- if timestamps of the stereo images are not synchronized -->
  
  <arg name="compressed"              default="false"/>         <!-- If you want to subscribe to compressed image topics -->
                                                                <!-- For depth_topic, "compressedDepth" image_transport is used. --> 
                                                                <!-- For rgb_topic, see "rgb_image_transport" argument. -->
  <arg name="rgb_image_transport"     default="compressed"/>    <!-- Common types: compressed, theora (see "rosrun image_transport list_transports") -->
   
  <arg name="subscribe_scan"          default="false"/>
  <arg name="scan_topic"              default="/scan"/>
  
  <arg name="subscribe_scan_cloud"    default="false"/>
  <arg name="scan_cloud_topic"        default="/scan_cloud"/>
   
  <arg name="visual_odometry"         default="true"/>          <!-- Launch rtabmap visual odometry node -->
  <arg name="odom_topic"              default="/odom"/>         <!-- Odometry topic used if visual_odometry is false -->
  <arg name="odom_args"               default="$(arg rtabmap_args)"/>
  
  <!-- These arguments should not be modified directly, see referred topics without "_relay" suffix above -->
  <arg if="$(arg compressed)"     name="rgb_topic_relay"           default="$(arg rgb_topic)_relay"/>
  <arg unless="$(arg compressed)" name="rgb_topic_relay"           default="$(arg rgb_topic)"/>
  <arg if="$(arg compressed)"     name="depth_topic_relay"         default="$(arg depth_topic)_relay"/>
  <arg unless="$(arg compressed)" name="depth_topic_relay"         default="$(arg depth_topic)"/>
  <arg if="$(arg compressed)"     name="left_image_topic_relay"    default="$(arg left_image_topic)_relay"/>
  <arg unless="$(arg compressed)" name="left_image_topic_relay"    default="$(arg left_image_topic)"/>
  <arg if="$(arg compressed)"     name="right_image_topic_relay"   default="$(arg right_image_topic)_relay"/>
  <arg unless="$(arg compressed)" name="right_image_topic_relay"   default="$(arg right_image_topic)"/>

  <!-- algorithm params -->
  <arg name="strategy" default="0" />
  <arg name="feature" default="6" />
  <arg name="nn" default="3" />
  <arg name="max_depth" default="5.0" />
  <arg name="min_inliers" default="15" />
  <arg name="inlier_distance" default="0.02" />
  <arg name="local_map" default="2000" />
  <arg name="gftt_max_corners" default="1000" />
  <arg name="gftt_min_distance" default="7" />

  <!-- Nodes -->
  <group ns="$(arg namespace)">

  
    <!-- RGB-D Odometry -->
    <group if="$(arg rgbd)">
      <node if="$(arg compressed)" name="republish_rgb" type="republish" pkg="image_transport" args="$(arg rgb_image_transport) in:=$(arg rgb_topic) raw out:=$(arg rgb_topic_relay)" />
      <node if="$(arg compressed)" name="republish_depth" type="republish" pkg="image_transport" args="compressedDepth in:=$(arg depth_topic) raw out:=$(arg depth_topic_relay)" />
  
      <node if="$(arg visual_odometry)" pkg="rtabmap_ros" type="rgbd_odometry" name="rgbd_odometry" output="screen" args="$(arg odom_args)" launch-prefix="$(arg launch_prefix)">
        <remap from="rgb/image"       to="$(arg rgb_topic_relay)"/>
        <remap from="depth/image"     to="$(arg depth_topic_relay)"/>
        <remap from="rgb/camera_info" to="$(arg camera_info_topic)"/>

        <param name="frame_id"                    type="string" value="$(arg frame_id)"/>
        <param name="wait_for_transform_duration" type="double" value="$(arg wait_for_transform)"/>
        <param name="config_path"                 type="string" value="$(arg cfg)"/>
        <param name="queue_size"                  type="int"    value="$(arg queue_size)"/>
        <param name="publish_tf"                  type="bool"   value="$(arg publish_odom_tf)" />      

        <!-- Force 2D odometry -->
        <param name="Reg/Force2D" type="string" value="true"/> 
        <param name="Reg/Force3DoF" type="string" value="true"/> 

        <param name="Vis/EstimationType" type="string" value="$(arg strategy)"/>
        <param name="Vis/CorNNType" type="string" value="$(arg nn)"/>
        <param name="Vis/MaxDepth" type="string" value="$(arg max_depth)"/>  
        <param name="Vis/MinInliers" type="string" value="$(arg min_inliers)"/> 
        <param name="Vis/InlierDistance" type="string" value="$(arg inlier_distance)"/>       
        <param name="OdomF2M/LocalHistorySize" type="string" value="$(arg local_map)"/>
        <param name="Vis/MaxFeatures" type="string" value="$(arg gftt_max_corners)"/>
        <param name="GFTT/MinDistance" type="string" value="$(arg gftt_min_distance)"/>
      </node>
    </group>
    
    <!-- Stereo Odometry -->
    <group if="$(arg stereo)">
      <node if="$(arg compressed)" name="republish_left"  type="republish" pkg="image_transport" args="compressed in:=$(arg left_image_topic) raw out:=$(arg left_image_topic_relay)" />
      <node if="$(arg compressed)" name="republish_right" type="republish" pkg="image_transport" args="compressed in:=$(arg right_image_topic) raw out:=$(arg right_image_topic_relay)" />
  
      <node if="$(arg visual_odometry)" pkg="rtabmap_ros" type="stereo_odometry" name="stereo_odometry" output="screen" args="$(arg rtabmap_args)" launch-prefix="$(arg launch_prefix)">
        <remap from="left/image_rect"        to="$(arg left_image_topic_relay)"/>
        <remap from="right/image_rect"       to="$(arg right_image_topic_relay)"/>
        <remap from="left/camera_info"       to="$(arg left_camera_info_topic)"/>
        <remap from="right/camera_info"      to="$(arg right_camera_info_topic)"/>
	  
        <param name="frame_id"                    type="string" value="$(arg frame_id)"/>
        <param name="wait_for_transform_duration" type="double" value="$(arg wait_for_transform)"/>
        <param name="approx_sync"                 type="bool"   value="$(arg approx_sync)"/>
        <param name="config_path"                 type="string" value="$(arg cfg)"/>
        <param name="queue_size"                  type="int" value="$(arg queue_size)"/>
      </node>
    </group>
  
    <!-- Visual SLAM (robot side) -->
    <!-- args: "delete_db_on_start" and "udebug" -->
    <node name="rtabmap" pkg="rtabmap_ros" type="rtabmap" output="screen" args="$(arg rtabmap_args)" launch-prefix="$(arg launch_prefix)">
      <param name="subscribe_depth"      type="bool"   value="$(arg rgbd)"/>
      <param name="subscribe_stereo"     type="bool"   value="$(arg stereo)"/>
      <param name="subscribe_scan"       type="bool"   value="$(arg subscribe_scan)"/>
      <param name="subscribe_scan_cloud" type="bool"   value="$(arg subscribe_scan_cloud)"/>
      <param name="frame_id"             type="string" value="$(arg frame_id)"/>
      <param name="publish_tf"           type="bool"   value="$(arg publish_map_tf)" />      
      <param name="wait_for_transform_duration"  type="double"   value="$(arg wait_for_transform)"/>
      <param name="database_path"        type="string" value="$(arg database_path)"/>
      <param name="stereo_approx_sync"   type="bool"   value="$(arg approx_sync)"/>
      <param name="config_path"          type="string" value="$(arg cfg)"/>
      <param name="queue_size"           type="int" value="$(arg queue_size)"/>
      
      <remap from="rgb/image"       to="$(arg rgb_topic_relay)"/>
      <remap from="depth/image"     to="$(arg depth_topic_relay)"/>
      <remap from="rgb/camera_info" to="$(arg camera_info_topic)"/>
	
      <remap from="left/image_rect"        to="$(arg left_image_topic_relay)"/>
      <remap from="right/image_rect"       to="$(arg right_image_topic_relay)"/>
      <remap from="left/camera_info"       to="$(arg left_camera_info_topic)"/>
      <remap from="right/camera_info"      to="$(arg right_camera_info_topic)"/>
      
      <remap from="scan"                   to="$(arg scan_topic)"/>
      <remap from="scan_cloud"             to="$(arg scan_cloud_topic)"/>
      <remap unless="$(arg visual_odometry)" from="odom"  to="$(arg odom_topic)"/>

      <!-- Force 2D mapping  (constrained to x-y plane + yaw) -->
      <param name="Reg/Force3DoF" type="string" value="true"/>
      <param name="Reg/Force2D" type="string" value="true"/>
      <param name="Optimizer/Slam2D" type="string" value="true"/>

      <param name="Rtabmap/DetectionRate" type="string" value="3.0" />
      <param name="DbSqlite3/InMemory" type="string" value="true" />
      <param name="Vis/MinInliers" type="string" value="$(arg min_inliers)"/>
      <param name="Vis/InlierDistance" type="string" value="$(arg inlier_distance)"/>
      <param name="proj_min_cluster_size" type="double" value="$(arg proj_min_cluster_size)" />

      <!-- localization mode -->
      <param     if="$(arg localization)" name="Mem/IncrementalMemory" type="string" value="false"/>
      <param unless="$(arg localization)" name="Mem/IncrementalMemory" type="string" value="true"/>
      <param name="Mem/InitWMWithAllNodes" type="string" value="$(arg localization)"/>
    </node>
  
    <!-- Visualisation RTAB-Map -->
    <node if="$(arg rtabmapviz)" pkg="rtabmap_ros" type="rtabmapviz" name="rtabmapviz" args="-d $(arg gui_cfg)" output="screen" launch-prefix="$(arg launch_prefix)">
      <param name="subscribe_depth"      type="bool"   value="$(arg rgbd)"/>
      <param name="subscribe_stereo"     type="bool"   value="$(arg stereo)"/>
      <param name="subscribe_scan"       type="bool"   value="$(arg subscribe_scan)"/>
      <param name="subscribe_scan_cloud" type="bool"   value="$(arg subscribe_scan_cloud)"/>
      <param name="subscribe_odom_info"  type="bool"   value="$(arg visual_odometry)"/>
      <param name="frame_id"             type="string" value="$(arg frame_id)"/>
      <param name="wait_for_transform_duration" type="double"   value="$(arg wait_for_transform)"/>
      <param name="queue_size"           type="int" value="$(arg queue_size)"/>
    
      <remap from="rgb/image"       to="$(arg rgb_topic_relay)"/>
      <remap from="depth/image"     to="$(arg depth_topic_relay)"/>
      <remap from="rgb/camera_info" to="$(arg camera_info_topic)"/>
      
      <remap from="left/image_rect"        to="$(arg left_image_topic_relay)"/>
      <remap from="right/image_rect"       to="$(arg right_image_topic_relay)"/>
      <remap from="left/camera_info"       to="$(arg left_camera_info_topic)"/>
      <remap from="right/camera_info"      to="$(arg right_camera_info_topic)"/>
      
      <remap from="scan"                   to="$(arg scan_topic)"/>
      <remap from="scan_cloud"             to="$(arg scan_cloud_topic)"/>
      <remap unless="$(arg visual_odometry)" from="odom"  to="$(arg odom_topic)"/>
    </node>
  
  </group>
  
  <!-- Visualization RVIZ -->
  <node if="$(arg rviz)" pkg="rviz" type="rviz" name="rviz" args="$(arg rviz_cfg)"/>
  <node if="$(arg rviz)" pkg="nodelet" type="nodelet" name="points_xyzrgb" args="standalone rtabmap_ros/point_cloud_xyzrgb">
    <remap from="left/image"        to="$(arg left_image_topic_relay)"/>
    <remap from="right/image"       to="$(arg right_image_topic_relay)"/>
    <remap from="left/camera_info"  to="$(arg left_camera_info_topic)"/>
    <remap from="right/camera_info" to="$(arg right_camera_info_topic)"/>
    <remap from="rgb/image"         to="$(arg rgb_topic_relay)"/>
    <remap from="depth/image"       to="$(arg depth_topic_relay)"/>
    <remap from="rgb/camera_info"   to="$(arg camera_info_topic)"/>
    <remap from="cloud"             to="voxel_cloud" />

    <param name="decimation"  type="double" value="2"/>
    <param name="voxel_size"  type="double" value="0.02"/>
    <param if="$(arg stereo)" name="approx_sync" type="bool"   value="$(arg approx_sync)"/>
  </node>

</launch>