Ask Your Question
0

Unable to add range_sensor_layer to costmap - segfault

asked 2019-10-02 04:49:52 -0500

luchko gravatar image

updated 2019-10-03 08:11:23 -0500

Hi all, I'm trying to add range sensors (InfraRed and Ultrasound) to my costmap following the wiki.

I tried few configurations, but i still have this error:

[ INFO] [1570006931.502167907]: Using plugin "obstacle"
[ INFO] [1570006931.511011399]:     Subscribed to Topics: scan
[ INFO] [1570006931.623187927]: Using plugin "range_sensor_layer"
[tcsetpgrp failed in terminal_inferior: Inappropriate ioctl for device]
[tcsetpgrp failed in terminal_inferior: Inappropriate ioctl for device]
Thread 1 "move_base" received signal SIGSEGV, Segmentation fault.
0x00007fffe8279338 in typeinfo for range_sensor_layer::RangeSensorLayer ()
   from /opt/ros/melodic/lib//librange_sensor_layer.so

I think the problem is relative to the // that make me think to an empty namespace or something like that, but I can't find it ...

Here are my configurations :

 PARAMETERS
 * /rosdistro: melodic
 * /rosversion: 1.14.3

Main launch file:

<include file="$(find robot_move)/launch/auto_nav.launch"/>

Auto_nav launch file:

<launch>
    <node pkg="move_base" type="move_base" respawn="false" name="robot_move" output="screen" launch-prefix="gdb -ex run --args"  >
        <rosparam file="$(find robot_move)/cfg/costmap_params.yaml" command="load" ns="global_costmap" />
        <rosparam file="$(find robot_move)/cfg/costmap_params.yaml" command="load" ns="local_costmap" />
        <rosparam file="$(find robot_move)/cfg/global_costmap_params.yaml" command="load"  />
        <rosparam file="$(find robot_move)/cfg/local_costmap_params.yaml" command="load"  />
        # truncated for lisibility 
    </node>
</launch>

local_costmap_params.yaml :

local_costmap:
  global_frame: map
  robot_base_frame: base_link
  update_frequency: 5.0
  publish_frequency: 2.0
  static_map: true
  rolling_window: true
  width: 10
  height: 10
  resolution: 0.1
  transform_tolerance: 0.5

  plugins:
   - {name: map,             type: "costmap_2d::StaticLayer"}
   - {name: obstacle,            type: "costmap_2d::ObstacleLayer"}
   - {name: range_sensor_layer,  type: "range_sensor_layer::RangeSensorLayer"}
   - {name: local_inflation,       type: "costmap_2d::InflationLayer"}

  range_sensor_layer:
    clear_threshold:    0.46
    mark_threshold:     0.98
    no_readings_timeout: 2.0
    topics: ["robot_base/us/raw_data"]

edit: both "robot_base/us/raw_data" and "/robot_base/us/raw_data" lead to the same error

edit: robot_base/us/raw_data is:

sensor_msgs::Range range_msg;
range_msg.header.stamp = now;
range_msg.header.frame_id = "front_us_link";
range_msg.radiation_type = sensor_msgs::Range::ULTRASOUND;
range_msg.field_of_view = 0.7854;
range_msg.min_range = 0.016;
range_msg.max_range = 6;
edit retag flag offensive close merge delete

Comments

I'd check if topics: ["robot_base/us/raw_data"] is correct (maybe a prepended slash /robot_base/...) based on the error message.

Otherwise could you post the stack trace relative to node move_base that you get from gdb? I.e. replace gdb -ex run --args with xterm -e gdb --args, then launch normally: you'll see an xterm window with gdb, where you can do (gdb) run (r for short), wait for the SIGSEGV to happen and then do (gdb) backtrace (bt for short).

aPonza gravatar imageaPonza ( 2019-10-03 05:15:58 -0500 )edit

Hi, thank you for your response. I appended Ultrasound informations to my original post :) Please, find here the output of the bt gdb command

luchko gravatar imageluchko ( 2019-10-03 08:29:22 -0500 )edit

Could you add the full bt as text in the question and not as a link to an external site? You can copy-paste it and then format it with the 10101 button. Otherwise this question will be irrelevant once the link expires.

It's most likely a dangling/uninitialized pointer somewhere while constructing the layer, I'm thinking the tf2 buffer, but it could be you're not initializing the layer correctly somehow (I don't have experience with costmaps).

If no uninitialized pointers appear apparent, have you tried waiting a few seconds for the tf2 buffer to fill up? Could you also check the tf tree (so as to see if /map, base_link, front_us_link, ... exist and are connected? Does it segfault without the range layer enabled?

aPonza gravatar imageaPonza ( 2019-10-04 02:47:48 -0500 )edit

1 Answer

Sort by ┬╗ oldest newest most voted
0

answered 2019-10-04 10:07:19 -0500

luchko gravatar image

Hello again, as I am limited in characters in comment, let me reply to you here. FIrst, here is the BackTrace:

[ INFO] [1570200605.707747442]: Using plugin "range_sensor_layer"
[tcsetpgrp failed in terminal_inferior: Inappropriate ioctl for device]
[tcsetpgrp failed in terminal_inferior: Inappropriate ioctl for device]

Thread 1 "move_base" received signal SIGSEGV, Segmentation fault.
0x00007fffe8279338 in typeinfo for range_sensor_layer::RangeSensorLayer ()
   from /opt/ros/melodic/lib//librange_sensor_layer.so
(gdb) bt
#0  0x00007fffe8279338 in typeinfo for range_sensor_layer::RangeSensorLayer ()
   from /opt/ros/melodic/lib//librange_sensor_layer.so
#1  0x00007ffff6a080e2 in costmap_2d::Layer::initialize(costmap_2d::LayeredCostmap*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, tf2_ros::Buffer*) ()
   from /home/robot/catkin_ws/devel_isolated/costmap_2d/lib/libcostmap_2d.so
#2  0x00007ffff6a0b875 in costmap_2d::Costmap2DROS::Costmap2DROS(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, tf2_ros::Buffer&) ()
   from /home/robot/catkin_ws/devel_isolated/costmap_2d/lib/libcostmap_2d.so
#3  0x00007ffff7ada011 in move_base::MoveBase::MoveBase(tf2_ros::Buffer&) ()
   from /home/robot/catkin_ws/devel_isolated/move_base/lib/libmove_base.so
#4  0x000055555555c6a7 in main ()

HEre is a sample of range data I want to use in the range_layer : echo robot_base/us/raw_data :

---
header: 
  seq: 4585
  stamp: 
    secs: 1570200965
    nsecs: 412347322
  frame_id: "front_us_link"
radiation_type: 0
field_of_view: 0.785399973392
min_range: 0.01600000076
max_range: 6.0
range: 1.57000005245
---

Does it segfault without the range layer enabled?

No, everything works fine if I disable the range_layer.

have you tried waiting a few seconds for the tf2 buffer to fill up?

Unfortunately, this has no effect

Could you also check the tf tree (so as to see if /map, base_link, front_us_link, ... exist and are connected?

In my tf_tree, everything seems fine ...

I'm sorry for the lack of hint about this problem ... Doesn't the double backslash in from /opt/ros/melodic/lib//librange_sensor_layer.so in my first message make you think this error is "path related" ?

Thanks again!

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2019-10-02 04:49:52 -0500

Seen: 20 times

Last updated: Oct 04