0
$\begingroup$

Rosanswers logo

Hi all,

I am simulating a mobile robot that only moves horizontal and vertical, like:

image description

It's length is 7 meters, width is 2.5 meters, and LiDAR is on middle of the robot, the green arrow is the direction it can move, but only one direction at a time.

The wheels are using steering, so it can rotate all wheels for 90 degrees to change direction, like:

image description

In this case, footprint data sets to:[[-1.25, -3.5], [-1.25, 3.5], [1.25, 3.5], [1.25, -3.5]]

In this case, local_planner is: dwa_local_planner

When it moves vertical, it can find the local obstacle, and it can avoid obstacle(Let mobile robot stop), like:

image description

When it moves horizontal, it finds the obstacle, too, but it can't avoid obstacle, like:

image description

Then, I use dynamic_reconfigure update my footprint data to: [[-3.5, -3.5], [-3.5, 3.5], [3.5, 3.5], [3.5, -3.5]]

And, it success, like:

image description

But now, It can't move horizontal to the edge of map, like:

image description

I want it to move like:

image description

But this case it can't avoid obstacle of edge of mobile robot.


My parameters of navigation:

move_base_params.yaml

footprint: [[-1.25, -3.5], [-1.25, 3.5], [1.25, 3.5], [1.25, -3.5]]

controller_frequency: 5.0
controller_patience: 15.0
planner_frequency: 0.0
planner_patience: 5.0
max_planning_retries: 0
oscillation_timeout: 30.0

recovery_behavior_enabled: true
recovery_behaviors: [{name: conservative_reset, type: clear_costmap_recovery/ClearCostmapRecovery}, {name: aggressive_reset, type: clear_costmap_recovery/ClearCostmapRecovery}]
conservative_reset:
  reset_distance: 1.25

dwa_local_planner_params.yaml

base_local_planner: dwa_local_planner/DWAPlannerROS
DWAPlannerROS:

  max_vel_x: 0.5
  min_vel_x: -0.5

  max_vel_y: 0.5
  min_vel_y: -0.5

  max_vel_trans:  0.5
  min_vel_trans:  -0.5

  max_vel_theta: 0.05
  min_vel_theta: -0.05

  acc_lim_x: 5.0
  acc_lim_y: 5.0
  acc_lim_theta: 3.2

  xy_goal_tolerance: 0.03
  yaw_goal_tolerance: 100
  latch_xy_goal_tolerance: true

  sim_time: 1.0
  vx_samples: 10
  vy_samples: 10
  vth_samples: 15

  path_distance_bias: 24.0
  goal_distance_bias: 72.0
  occdist_scale: -1.0           
  forward_point_distance: 0.01  
  stop_time_buffer: 0.2
  scaling_speed: 0.25
  max_scaling_factor: 0.2
  prune_plan: true

  oscillation_reset_dist: 0.001
  oscillation_reset_angle: 0.002

  publish_traj_pc : true
  publish_cost_grid_pc: true

costmap_common_params.yaml

robot_base_frame: base_footprint
transform_tolerance: 0.4
update_frequency: 5.0
publish_frequency: 1.0
obstacle_range: 6.0
publish_voxel_map: true
navigation_map:
  map_topic: /map
obstacles:
  observation_sources: scan
  scan: 
    sensor_frame: laser_link
    data_type: LaserScan 
    topic: scan
    marking: true
    clearing: true

global_costmap_params.yaml

global_costmap:
global_frame: map
static_map: true
raytrace_range: 7.0
resolution: 0.05
z_resolution: 0.2
z_voxels: 10

inflation:
  cost_scaling_factor:  3.0  
  inflation_radius:     0.6 

plugins: 
    - {name: navigation_map, type: "costmap_2d::StaticLayer" }
    - {name: obstacles,  type: "costmap_2d::VoxelLayer" }
    - {name: inflation,  type: "costmap_2d::InflationLayer" }

local_costmap_params.yaml

local_costmap:
  global_frame: odom
  static_map: false
  rolling_window: true
  raytrace_range: 7.0
  resolution: 0.05
  width: 10.0
  height: 10.0
  origin_x: 0.0
  origin_y: 0.0

  inflation:
    cost_scaling_factor: 3.0
    inflation_radius: 3.5
  
  plugins: 
      - {name: obstacles,  type: "costmap_2d::VoxelLayer" }
      - {name: inflation,  type: "costmap_2d::InflationLayer" }

My questions are:

  1. Can I eliminate global costmap obstacle in local costmap?
  2. In addition to changing the footprint, how can I change the obstacle inflation in different axis?
  3. Is there any other solution to figure out this problem in this case?

If not, I think I should give up using navigation to avoid obstacle in this case.


This is my first time ask question here, if there is any violation or Insufficient narrative, please let me know and I will improve it as soon as possible.

Thanks!


Originally posted by Arthur6057 on ROS Answers with karma: 13 on 2020-08-11

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Thank you for providing all the required information but I'm not entirely sure to get what is not working for you exactly. I'm still answering to provide you some insights.

First of all you shouldn't change the footprint, the first value you set it to ([[-1.25, -3.5], [-1.25, 3.5], [1.25, 3.5], [1.25, -3.5]]) is correct because it matches with the robot dimensions.

I would recommend you to check #q12874 and also costmap2d wiki to understand the relation between the footprint and the inflation radius. The costmap calcluates a cost for each cell according to the distance from an obstacle, but it's only the case if this distance is less than the inflation_radius which is set to 3.5 for your local costmap. So when you increase the footprint all the cells closer than 3.5 meters of an obstacle will be considered unavailable because the inflation_radius matches your footprint size and it won't calculate the cost of the other cells.

You want to set the inflation_radius to the maximum distance that you want your robot to avoid the obstacles (from the robot center). If you can rotate your robot that would mean that you are only limited by its length, I would set it to 1.25 + distance_from_obstacle (1.25 is length/2 ). If you can't rotate it then it should be set to 3.5 + distance_from_obstacle (3.5 for width/2). From small and/or slow robots distance_from_obstacle can be around 0.1 meters but given the dimensions of your robot you should at the very least have it to 0.5 meters. So you should set the inflation_radius of your local and global costmaps to minimm 4 meters (because you can't rotate it if I understood propperly, if not you can have it to minimum 2.75 meters). Eventhough it might not be the core issue it will probably improve the navigation.

The second thing I've noticed is that you have set occdist_scale to -1. If you look at the dwa_local_planner wiki about the trajectory scoring parameters. You can tell the local planner to prefer trajectories close to the global planner trajectory (path_distance_bias), or to trust the local goals more than the global trajectory (goal_distance_bias) or to avoid obstacles over respecting the trajectory (occdist_scale). Then the cost of the trajectory is calculated with :

cost =
  path_distance_bias * (distance to path from the endpoint of the trajectory in meters)
  + goal_distance_bias * (distance to local goal from the endpoint of the trajectory in meters)
  + occdist_scale * (maximum obstacle cost along the trajectory in obstacle cost (0-254))

In your case occdist_scale is negative so you probably end up with negative cost values (I haven't found what happen in this case but a trajectory with a negative cost would likely be ignored). You can set it to the default value (0.01) to see if there are improvements.

To direclty answer your questions :

  1. Check #q10620, it should help you understand the difference between the two costmaps.

  2. You don't change it in different axis, but a big inflation_radius shouldn't prevent your robot to find trajectories. if you have a big inflation_radius but you have set occdist_scale to a small value (but not negative) it doesn't matter.

  3. I think you should be able to have it working now.


Originally posted by Delb with karma: 3907 on 2020-08-12

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by Arthur6057 on 2020-08-12:
Thanks for your reply, I checked costmap2d wiki and dwa_local_planner wiki again, now, I do know what my problem is, and it works successfully, I apologize for not looking for answers carefully.Thank you very much for all your help.

Comment by Delb on 2020-08-12:
It's normal to make mistakes, even though move_base is well documented there are a lot of parameters to be aware of. Can you tell what exactly solved your issue ? Is it simply changing the inflation_radius, the occdist_scale parameter or both ?

Comment by Arthur6057 on 2020-08-12:
Sorry for replying late, I only change occdist_scale to default value(0.01) and keep footprint be [[-1.25, -3.5], [-1.25, 3.5], [1.25, 3.5], [1.25, -3.5]]. inflation_radius I didn't change it in global costmap, because I only want mobile robot move straight, if changes it bigger, it will plan a curved path. In this case, if mobile robot encounter obstacles, I don't want it to replan, I just want it to stop. That I think I could keep inflation_radius as it in local costmap. Sorry for my explanation misled you.

$\endgroup$

Your Answer

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