0
$\begingroup$

Rosanswers logo

Hi all,

I'm having some issues adding ultrasonic sensors to my costmap. My robot was set up using the move_base setup guide, and uses a single Hokuyo lidar for SLAM with hector_mapping. It uses three costmaps: local_costmap_params.yaml, global_costmap_params.yaml and costmap_common_params.yaml. I am using ROS indigo.

To help get the ultrasonic data into the costmap(s) I made a simplified URDF model (instead of manually adding static transform publishers to launch files, as I did with the laser scanner). I've got data from a SRF05 into ROS and displaying as a cone from the front of my model in RVIZ, and after a bit of playing with the costmaps I've managed to get ultrasonic range data to register as inflated obstacles in the local costmap.

The problem is that when I add the sonar sensor to the costmap, I no longer have any lidar data in the costmap. Before I added the range_layer to the params.yaml file I could see a global and local costmap in rviz. Now that the sonar settings are in there too I only see the ultrasonic range costmap stuff inside the local costmap, and the global costmap is empty. I am getting errors out of the move_base terminal which read:

[ERROR] [1486152698.562581761]: Range sensor layer can't transform from map to /ultrasound at 1486152698.395551

However there must be at least an intermittent transformation between map and /ultrasound because I can see the obstacles being added to the costmap in RVIZ, as you can see here. For comparison, this is what I get when I remove the "sonar_layer:" section and the "plugins:" section from costmap_common_params.yaml.

I'm not too sure what I'm doing in general with setting all this up (figuring it all out as I go along), so any advice or pointers from anyone would be greatly appreciated.


EDIT: Firstly, forgot to upload my tf frame tree. I can see that the transform between map and laser is only 10Hz, but as it's provided by my SLAM module whose input is a LIDAR with a max scanning rate of 10Hz I don't see how I can speed it up.

Also, to try and solve Range sensor layer can't transform from map to /ultrasound I ran: rosrun tf tf_monitor map ultrasound which gave me the following:

RESULTS: for map to ultrasound
Chain is: ultrasound -> base_link -> laser -> map
Net delay     avg = 0.119112: max = 0.168371

Frames:
Frame: base_link published by unknown_publisher Average Delay: -0.0398328 Max Delay: 0
Frame: laser published by unknown_publisher Average Delay: 0.0689363 Max Delay: 0.069513
Frame: map published by unknown_publisher Average Delay: -0.0398488 Max Delay: 0
Frame: ultrasound published by unknown_publisher Average Delay: -0.499823 Max Delay: 0

All Broadcasters:
Node: unknown_publisher 144.92 Hz, Average Delay: -0.183418 Max Delay: 0.0692722

Is anyone able to help me make sense of this? At the moment, as far as I can tell I have two problems:

Problem 1: Something I've done wrong in the costmap configuration gets rid of the lidar scan from the costmaps when I add the ultrasonic range layer.

Problem 2: An intermittent tf timing issue between the map and the ultrasound frames.

Can anyone point me in the right direction with diagnosing tf timing issues and also costmap configuration?


Here are my costmap parameter files:

local_costmap_params.yaml:

local_costmap:
  global_frame: /map
  robot_base_frame: base_link
  update_frequency: 6.0
  publish_frequency: 1.0
  static_map: false
  rolling_window: true
  width: 6.0
  height: 6.0
  resolution: 0.05
  transform_tolerance: 0.5

  obstacle_layer:
    observation_sources: laser_scan_sensor sonar_layer
    laser_scan_sensor: {sensor_frame: laser, data_type: LaserScan, topic: scan, marking: true, clearing: true}

global_costmap_params.yaml:

global_costmap:
  global_frame: /map
  robot_base_frame: base_link
  update_frequency: 6.0
  static_map: true

costmap_common_params.yaml:

plugins:
  - {name: sonar_layer,   type: "range_sensor_layer::RangeSensorLayer"}
  - {name: inflation_layer, type: "costmap_2d::InflationLayer"}
obstacle_range: 3
raytrace_range: 9
footprint: [[-0.162, -0.206], [-0.162, 0.206], [0.162, 0.206], [0.162, -0.206]]
#old footprint: [[-0.12, -0.18], [-0.12, 0.18], [0.12, 0.18], [0.12, -0.18]]
#robot_radius: ir_of_robot
inflation_radius: 0.4
transform_tolerance: 1.3

observation_sources: laser_scan_sensor

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

sonar_layer:
  frame: ultrasound
  topics: ["/ultrasound"]
  no_readings_timeout: 1.0
  clear_on_max_reading: true

And here is my URDF model.

Please let me know if there's any more information that I should add to this question.

Many thanks, Tom

edit:

Humpelstilzchen, thanks for your reply. I tried using the costmaps you suggested, but now nothing appears on either costmap in rviz and I get the following:

[ WARN] [1486496764.157229265]: MessageFilter [target=map camera_depth_frame ]: Dropped 100.00% of messages so far. Please turn the [ros.costmap_2d.message_notifier] rosconsole logger to DEBUG for more information.

Is there a resource that I haven't found yet which explains how to set up the .yaml files properly? Did you learn how to do this via an internet resource or just through experience?

I've tried to explore timing issues regarding the tf error, I'll update the question.

edit edit:

I am using ROS indigo, but I'll have a look through the appropriate documentation around where you linked me. I'll have a look around with dynamic reconfigure too. Thanks again, Tom


Originally posted by carebare47 on ROS Answers with karma: 1 on 2017-02-03

Post score: 0


Original comments

Comment by femitof on 2020-05-20:
@carebare47 how did you solve the timing issue?

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

You have sonar_layer in observation_sources of your obstacle_layer, also plugins in costmap_common_params.yaml is missing obstacle_layer. You should define the costmap plugins in local_costmap_params.yaml and global_costmap_params.yaml and the configuration of the plugins in costmap_common_params.yam, like this (Tried to adapt to your configuration, there might be an error):

local_costmap_params.yaml:

  plugins:
   - {name: obstacle_layer, type: 'costmap_2d::ObstacleLayer'}
   - {name: sonar_layer,   type: "range_sensor_layer::RangeSensorLayer"}
   - {name: inflation_layer, type: 'costmap_2d::InflationLayer'}

global_costmap_params.yaml:

  plugins:
    - {name: static_layer, type: 'costmap_2d::StaticLayer'}
    - {name: inflation_layer, type: 'costmap_2d::InflationLayer'}

costmap_common_params.yaml:

obstacle_layer:
  observation_sources: laser_scan_sensor
  obstacle_range: 3
  raytrace_range: 9
  laser_scan_sensor: {sensor_frame: camera_depth_frame, data_type: LaserScan, topic: scan, marking: true, clearing: true}

sonar_layer:
  frame: ultrasound
  topics: ["/ultrasound"]

inflation_layer:
  inflation_radius: 0.4

For your error:

[ERROR] [1486152698.562581761]: Range sensor layer can't transform from map to /ultrasound at 1486152698.395551

This might happen from time to time when your sensor/tf is publishing too slow.

Got the Layered setup from Hydro documentation and many posts here on answers.

Fire up dynamic reconfigure in rqt and check if the layers are there with your configuration values if you keep to having problems.


Originally posted by Humpelstilzchen with karma: 1504 on 2017-02-07

This answer was ACCEPTED on the original site

Post score: 3

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.