ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A answers.ros.org
Ask Your Question
0

How to add obstacles detected by LaserScan to the global costmap?

asked 2021-06-25 08:59:06 -0500

jmyazbeck gravatar image

updated 2022-05-23 09:00:34 -0500

lucasw gravatar image

I am trying to add obstacles in the way of my robot. Even if they are detected by the laser scan, it's not until the obstacle comes in the local costmap's frame that the obstacle is noticed and added to the global costmap.

Please note that, I tried following and understanding the tutorial and tried reading and understanding other similar questions on the forum... but I don't understand two things: 1. Setting up the costmap in the launch file: what is happening here? Is it necessary? 2. Loading the plugins in the yaml files... Why not just load them in the common yaml file since I am loading it under both namespaces (global and local) and what do they really mean?

I just stole these bits from ready made simulations and I cant seem to find anything that explains them properly, and I am pretty sure this is what is not allowing to add obstacles to my global costmap.

Here are my costmap param files:

costmap_common_params.yaml:

obstacle_range: 2.0
raytrace_range: 3.0
publish_frequency: 1.0
footprint: [[0.57, 0.75],[0.57, -0.75],[-1.153, -0.75],[-1.153, 0.75]]
# robot_radius: 0.18

plugins:
- {name: obstacles_layer, type: "costmap_2d::VoxelLayer"}
- {name: inflater_layer, type: "costmap_2d::InflationLayer"}

obstacles_layer:
  observation_sources: scan scan2
  scan: {sensor_frame: base_scan, data_type: LaserScan, topic: scan, marking: true, clearing: true}
  scan2: {sensor_frame: base_scan2, data_type: LaserScan, topic: scan2, marking: true, clearing: true}

inflater_layer:
 inflation_radius: 1.0

global_costmap_params.yaml:

global_costmap:
  global_frame: map
  robot_base_frame: base_footprint
  update_frequency: 10.0
  publish_frequency: 10.0
  static_map: true
  plugins:
  - {name: static_layer, type: "costmap_2d::StaticLayer"}
  - {name: obstacles_layer, type: "costmap_2d::VoxelLayer"}
  - {name: inflater_layer, type: "costmap_2d::InflationLayer"}

local_costmap_params.yaml:

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

move_base.launch

<launch>

  <master auto="start"/>
  <!-- Run the map server -->
  <node name="map_server" pkg="map_server" type="map_server" args="/home/jm/isaac/sdk/packages/eband_ros/maps/factory.yaml"/>

  <!-- Setting up costmap -->
  <node name="static_tf0" pkg="tf" type="static_transform_publisher" args="2 0 0 0 0 0 /map /base_footprint 100"/>

  <!-- move_base -->
  <node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen">

    <rosparam file="$(find isaac_navigation)/param/costmap_common_params.yaml" command="load" ns="global_costmap" />
    <rosparam file="$(find isaac_navigation)/param/costmap_common_params.yaml" command="load" ns="local_costmap" />
    <rosparam file="$(find isaac_navigation)/param/local_costmap_params.yaml" command="load" />
    <rosparam file="$(find isaac_navigation)/param/global_costmap_params.yaml" command="load" />
    <rosparam file="$(find isaac_navigation)/param/base_local_planner_params.yaml" command="load" />

    <param name="base_global_planner" type="string" value="navfn/NavfnROS" />
    <param name="base_local_planner" value="eband_local_planner/EBandPlannerROS" />

  </node>
</launch>
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-07-08 09:10:41 -0500

jmyazbeck gravatar image

Edited my costmap_common_params.yaml to look like this:

map_type: costmap
obstacle_range: 10.0
raytrace_range: 12.0
publish_frequency: 1.0
footprint: [[-1.045, 0.315],[-1.045,  -0.315],[0.39, -0.315],[0.39, 0.315]]
# robot_radius: 0.18

plugins:
- {name: obstacles_layer, type: "costmap_2d::ObstacleLayer"}
- {name: inflater_layer, type: "costmap_2d::InflationLayer"}

obstacles_layer:
  observation_sources: scan scan2
  scan: {sensor_frame: base_scan, data_type: LaserScan, topic: scan, marking: true, clearing: true, obstacle_range: 10.0, raytrace_range: 12.0}
  scan2: {sensor_frame: base_scan2, data_type: LaserScan, topic: scan2, marking: true, clearing: true, obstacle_range: 10.0, raytrace_range: 12.0}

inflater_layer:
 inflation_radius: 1.0

Basically added, the map_type, and added more range to my obstacle_range. I also added the obstcale_range and raytrace_range for each observation_sources setup.

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: 2021-06-25 08:59:06 -0500

Seen: 78 times

Last updated: Jul 08 '21