ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Ultrasonic sensor with range_sensor_layer not forming cone obstacles

asked 2018-09-21 09:10:47 -0600

mcarr gravatar image

updated 2018-10-11 01:34:33 -0600


I am able to form a costmap using my Lidar data and move_base through the ROS Navigation stack. However when I try to integrate an ultrasonic sensor to the costmap using range_sensor_layer there are 2 problems:

  1. The Lidar is no longer creating obstacles on the local costmap
  2. The Ultrasonic sensor is only creating obstacles in line of single pixels in front of the robot (by pixels I mean the smallest unit of map resolution, 0.05m in my case)

Below: local costmap created from lidar, without the range_sensor_layer plugin. Everything working fine

Local costmap created from lidar:

Below: Costmap with range_sensor_layer plugin active. I moved an object towards the ultrasonic sensor starting at about 80cm, moving to 30cm (it doesn't clear objects behind others thus why is forms a line). The robot is located at the center cross facing right in both these images

Local costmap created from ultrasonic sensor

I have tried playing with the parameters discussed in range_sensor_layer but this did not help. Is there some blatant oversight that I'm making? Below are my config files


obstacle_range: 4.0
raytrace_range: 5.0
footprint: [[0.075, 0.235], [0.075,-0.235], [-0.455,-0.235], [-0.455,0.235]]
inflation_radius: 0.55

observation_sources: laser_scan_sensor

laser_scan_sensor: {sensor_frame: /scan, data_type: LaserScan, topic: /scan, marking: true, clearing: true}

  topics: ['/ultrasonic']
  clear_threshold: 0.3
  mark_threshold: 0.6
  clear_on_max_reading: true
  no_readings_timeout: 2.0

  - {name: sonar, type: "range_sensor_layer::RangeSensorLayer"}
  - {name: obstacle_layer, type: "costmap_2d::ObstacleLayer"}
  - {name: inflation_layer, type: "costmap_2d::InflationLayer"}


  global_frame: odom
  robot_base_frame: base_link
  update_frequency: 5.0
  publish_frequency: 2.0
  static_map: false
  rolling_window: true
  width: 6.0
  height: 6.0
  resolution: 0.05


  global_frame: /map
  robot_base_frame: base_link
  update_frequency: 5.0
  static_map: false
  rolling_window: true
  height: 10.0
  width: 10.0
  resolution: 0.05

And here is my Ultrasonic message:

image description


The ultrasonic sensors are now marking obstacles after fixing the different layers and plugins in Costmap2D. However the range_sensor_layer package is still only marking dots, instead of arcs on the costmap. Is it even supposed to mark arcs? Maybe my understanding is incorrect. However there are field of view parameters so I would assume it is supposed to mark an arc obstacles at the detected range.

image description

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-09-24 12:39:21 -0600

Humpelstilzchen gravatar image

There is indeed something odd here. Could it be that you try the Layered costmap costmap configuration with a pre-Hydro configuration?

You have

  - {name: obstacle_layer, type: "costmap_2d::ObstacleLayer"}

but obstacle_layer is nowhere configured. Also

observation_sources: laser_scan_sensor

stands alone. It should probably be inside the obstacle_layer namespace, same with obstacle_range and raytrace_range. They are all options of the ObstacleLayer, not the costmap, e.g.

  observation_sources: laser_scan_sensor
  laser_scan_sensor: {sensor_frame: /scan, data_type: LaserScan, topic: /scan, marking: true, clearing: true}
  obstacle_range: 4.0
  raytrace_range: 5.0

The same with with the inflation_radius option, this belongs into the namespace of the InflationLayer, e.g.

  inflation_radius: 0.55
edit flag offensive delete link more


Cheers, realised that I didn't understand how Costmap2D worked really with the layers as plugins and such. Still haven't figured about why range_sensor_layer is not making cone obstacles though.

mcarr gravatar image mcarr  ( 2018-10-10 08:57:22 -0600 )edit

Is this still an issue? If so please update your question with the current configuration. Or maybe better a new question.

Humpelstilzchen gravatar image Humpelstilzchen  ( 2018-10-10 11:34:53 -0600 )edit

The main issue - not forming cone obstacles - is still an issue. Will update question

mcarr gravatar image mcarr  ( 2018-10-11 01:31:38 -0600 )edit

The frame_id "ultrasound" in your sample range message sounds strange. I'ld expect something like "ultrasound_fwd_left". Btw you should set radiation_type to Range.ULTRASOUND (1) instead of Range.INFRARED (0) if this is a us sensor (That probably will not change anything)

Humpelstilzchen gravatar image Humpelstilzchen  ( 2018-10-11 12:31:59 -0600 )edit

Hello, I need your help for something similar can you please check my question? thanks

Syrine gravatar image Syrine  ( 2019-06-28 07:55:03 -0600 )edit

Question Tools

1 follower


Asked: 2018-09-21 09:10:47 -0600

Seen: 1,611 times

Last updated: Oct 11 '18