Ask Your Question
0

how to setup range_sensor_layer in local costmap

asked 2019-04-09 23:18:49 -0600

simk0024 gravatar image

updated 2019-04-11 03:21:33 -0600

Hi guys,

I am adding range_sensor_layer to local costmap of navigation stack (ROS Kinetic). I followed the advise as mentioned in this post, Parameters for the new range_sensor_layer. However, I didn't manage to activate the range_sensor_layer in local costmap.

//EDIT @ 11th Apr 19

I setup as describe below.

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: obstacle_layer, type: 'costmap_2d::ObstacleLayer'}
  - {name: inflation_layer, type: 'costmap_2d::InflationLayer'}

costmap_common_params.yaml

map_type: costmap

transform_tolerance: 0.3

inflation_layer:
  inflation_radius: 0.3

obstacle_layer:
  obstacle_range: 3.0
  raytrace_range: 2.5
  observation_sources: laser_scan_sensor
  laser_scan_sensor: {sensor_frame: hokuyo, data_type: LaserScan, topic: /myrobot/laser/scan, marking: true, clearing: true}

sonar_layer:
  ns: /arduino
  topics: ["/sonar1", "/sonar2", "/sonar3", "/sonar4", "/sonar5"]
  no_readings_timeout: 2.0
  clear_threshold: 0.05
  mark_threshold: 0.15

launch file:

<node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen">
   <rosparam file="$(find myrobot)/config/costmap_common_params.yaml" command="load" ns="global_costmap" />
   <rosparam file="$(find myrobot)/config/costmap_common_params.yaml" command="load" ns="local_costmap" />
   <rosparam file="$(find myrobot)/config/local_costmap_params.yaml" command="load"/>
   <rosparam file="$(find myrobot)/config/global_costmap_params.yaml" command="load"/>
   <rosparam file="$(find myrobot)/config/base_local_planner_params.yaml" command="load" />

   <param name="base_global_planner" type="string" value="navfn/NavfnROS" />
   <param name="base_local_planner" value="base_local_planner/TrajectoryPlannerROS"/>
</node>

And here is the output of roslaunch(timestamp is hidden), which range_sensor_layer is not initiated:

[ INFO] [--]: Loading from pre-hydro parameter style
[ INFO] [--]: Using plugin "static_layer"
[ INFO] [--]: Requesting the map...
[ INFO] [--]: Resizing costmap to 2912 X 2496 at 0.020000 m/pix
[ INFO] [--]: Received a 2912 X 2496 map at 0.020000 m/pix
[ INFO] [--]: Using plugin "obstacle_layer"
[ INFO] [--]:     Subscribed to Topics: laser_scan_sensor
[ INFO] [--]: Using plugin "inflation_layer"
[ INFO] [--]: Loading from pre-hydro parameter style
[ INFO] [--]: Using plugin "obstacle_layer"
[ INFO] [--]:     Subscribed to Topics: laser_scan_sensor
[ INFO] [--]: Using plugin "inflation_layer"
[ INFO] [--]: Created local_planner base_local_planner/TrajectoryPlannerROS
[ INFO] [--]: Sim period is set to 0.50
[ INFO] [--]: Received a 2912 X 2496 map @ 0.020 m/pix

[ INFO] [--]: Initializing likelihood field model; this can take some time on large maps...
[ INFO] [--]: Recovery behavior will clear layer obstacles
[ INFO] [--]: Recovery behavior will clear layer obstacles

//END OF EDIT

I do know what I have missed. Please advice. Thank you very much.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2019-04-22 10:57:58 -0600

David Lu gravatar image

I would guess that your local_costmap_params.yaml is in the wrong namespace. Do a rosparam dump to see all the parameters.

The plugins should be loaded at move_base/local_costmap/plugins not move_base/plugins

edit flag offensive delete link more

Comments

You are RIGHT! It's because of the indentation before the plugins. By adding indent and make it like below will fix the issue of adding plugin

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

Log info:
    [ INFO] : local_costmap/sonar_layer: ALL as input_sensor_type given
    [ INFO] : RangeSensorLayer: subscribed to topic /arduino/sonar1
    [ INFO] : RangeSensorLayer: subscribed to topic /arduino/sonar2
    [ INFO] : RangeSensorLayer: subscribed to topic /arduino/sonar3
    [ INFO] : RangeSensorLayer: subscribed to topic /arduino/sonar4
    [ INFO] : RangeSensorLayer: subscribed to topic /arduino/sonar5

However, range data still not reflected on the costmap, unlike pointcloud and laserscan.

simk0024 gravatar imagesimk0024 ( 2019-04-24 03:20:54 -0600 )edit

Hello @simk0024 I'm having the same problem, I can't reflect obstacles from range sensors on the costmap, did you find a solution? Thanks

Syrine gravatar imageSyrine ( 2019-06-27 02:27:52 -0600 )edit

Your Answer

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

Add Answer

Question Tools

2 followers

Stats

Asked: 2019-04-09 23:18:49 -0600

Seen: 162 times

Last updated: Apr 22