Ask Your Question
1

move_base generating path in unknown space

asked 2021-01-12 20:55:49 -0600

So Young gravatar image

updated 2021-01-17 18:59:43 -0600

Hi, I am trying to use ROS navigation stack with RPlidar A2. currently, I am running gmapping with move_base and explore_lite so that robot can do auto-exploration and do SLAM. the problem is, even though I set allow_unkown to false in dwa_local_planner_params.yaml, the path generated by move_base is going through the unknown space (I also checked the value being false with rosparam get) Thank you for your help!

This is my costmap_common_parmas.yaml

obstacle_range: 2.5 #maximum obstale size
raytrace_range: 3.0 #robot will clear out space up to 3 meters 
footprint: [[-0.30,-0.177], [0.105,-0.177], [0.105, 0.177], [-0.30,0.177]] #not sure, from legacy
robot_radius: 0.2
inflation_radius: 0.3 #0.55

observation_sources: laser_scan_sensor 

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

This is my global_costmap.yaml

global_costmap:
  global_frame: map
  robot_base_frame: base_link
  update_frequency: 5.0

This is my local_costmap_params.yaml

local_costmap:
  global_frame: odom # NEW!! odom
  robot_base_frame: base_link
  update_frequency: 5.0
  publish_frequency: 2.0
  static_map: false
  rolling_window: true # will remain centered around the robot as the robot moves around
  width: 5.0 #meters
  height: 5.0
  resolution: 0.01 #tend to set them equally as the static map
  static_map: true #if we use map_sever, keep it true

and I am using dwa_local_planner and A* for global_planner.

EDIT

After accepting the answer, I worked on properly setting the costmap yaml files and now it works properly. I have played with 'track_unkown_space' param and I decided to set them like these. These are the files I have written.

common_costmap.yaml

obstacle_range: 2.5 #maximum obstale size
raytrace_range: 3.0 #robot will clear out space up to 3 meters 
footprint: [[-0.30,-0.177], [0.105,-0.177], [0.105, 0.177], [-0.30,0.177]] #not sure, from legacy
robot_radius: 0.2
inflation_radius: 0.3 #0.55

global_costmap.yaml (here, I set 'track_unkown_space' to true, since I wanted A* planner to only plan in known & free space) - make sure you load these in move_base.xml file with namespace global_costmap.

global_frame: map
robot_base_frame: base_link
update_frequency: 3.0
publish_frequency: 2.0
static_map: true #if we use map_sever, keep it true

  # obstacle_layer: {enabled: true, lethal_cost_threshold: 100, track_unknown_space: true, unknown_cost_value: -1}

  # static_layer: {enabled: true, lethal_cost_threshold: 100, track_unknown_space: true, unknown_cost_value: -1} 

plugins:
- {name: static_layer, type: "costmap_2d::StaticLayer"} 
- {name: obstacle_layer, type: "costmap_2d::ObstacleLayer"}
- {name: inflation_layer, type: "costmap_2d::InflationLayer"}

static_layer:
  unknown_cost_value: 0 # default: 0
  lethal_cost_threshold: 100 # default: 100
  map_topic: map # default: "map"

obstacle_layer:
  combination_method: 1 #default 1, meaning we will combine the layers
  observation_sources: laser_scan_sensor
  track_unknown_space: true
  map_type: costmap
  laser_scan_sensor:
    sensor_frame: laser_frame                 # default: ""
    topic: scan               # or /scan?
    data_type: LaserScan                # default: "PointCloud"
    marking: true                       # default: true
    clearing: true                      # default: false

inflation_layer:
  inflation_radius: 0.45 # default: 0.55

local_costmap.yaml (here, I set 'track_unknown_space' to false, since DWA planner works fine with this param being false.) I got this idea from this link text

global_frame: map # NEW!! odom
robot_base_frame: base_link
update_frequency: 5.0
publish_frequency: 2.0
static_map: false
rolling_window: true # will remain centered around the robot as the robot ...
(more)
edit retag flag offensive close merge delete

Comments

I've seen some posts about setting track_unknown_space to true, but since my costmap doesn't have layers, I thought wouldn't need to worry about that parameter. (or maybe I'm understanding it wrong)

So Young gravatar image So Young  ( 2021-01-12 20:58:27 -0600 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2021-01-13 09:45:22 -0600

tryan gravatar image

As you may have seen, the documentation for global_planner states:

~<name>/allow_unknown (bool, default: true)
    Specifies whether or not to allow the planner to create plans that traverse unknown space. NOTE: if you are using a layered costmap_2d costmap with a voxel or obstacle layer, you must also set the track_unknown_space param for that layer to be true, or it will convert all your unknown space to free space (which planner will then happily go right through)

What you may have missed is that your cost map does contain layers, even when defined with pre-Hydro parameters. From the costmap_2d wiki:

Pre-Hydro Parameters

Hydro and later releases use plugins for all costmap_2d layers. If you don't provide a plugins parameter then the initialization code will assume that your configuration is pre-Hydro and will load a default set of plugins with default namespaces. Your parameters will be moved to the new namespaces automagically. The default namespaces are static_layer, obstacle_layer and inflation_layer. Some tutorials (and books) still refer to pre-Hydro parameters, so pay close attention. To be safe, be sure to provide a plugins parameter.

Therefore, it seems you'll still need to set track_unknown_space to true in the obstacle_layer namespace.

edit flag offensive delete link more

Comments

Thank you, yes I didn't know my costmap had default layers. I'll try to set them properly and also set track_unkown_space and see if it works!

So Young gravatar image So Young  ( 2021-01-13 18:04:46 -0600 )edit
1

Thank you for helping me with this problem, I have fixed the costmap yamls and now it works properly. I have also edited my post. Thanks!

So Young gravatar image So Young  ( 2021-01-13 20:39:27 -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

1 follower

Stats

Asked: 2021-01-12 20:38:22 -0600

Seen: 26 times

Last updated: yesterday