Ask Your Question

No obstacle avoidance with dwb controller

asked 2020-01-08 15:17:20 -0500

madmax gravatar image

updated 2020-01-08 15:40:21 -0500

I am playing around with nav2 stack and I am heaving trouble getting simple obstacle avoidance to work.
I now returned to the default controller scales to see if avoidance would work with default params but also no change.


I have a fixed global plan, which goes through a local obstacle.
And I would have expected the local planner to at least plan a bit away from obstacle.
But as you see it's just going straight through and I am not sure if it's a bug or just tuning?
Adding ObstacleFootprint plugin stops the shuttle at least before the obstacle but no avoidance.

Also coming from ROS 1, I remember a parameter which doesn't erase obstacles inside its footprint.
Found this one footprint_clearing_enabled, but seems to have no effect if set to false.

    BaseObstacle.class: "BaseObstacle"
    BaseObstacle.scale: 0.02
    BaseObstacle.sum_scores: False
    GoalAlign.aggregation_type: "last"
    GoalAlign.class: "GoalAlign"
    GoalAlign.forward_point_distance: 0.325
    GoalAlign.scale: 0
    GoalDist.aggregation_type: "last"
    GoalDist.class: "GoalDist"
    GoalDist.scale: 24
    Oscillation.class: "Oscillation"
    Oscillation.oscillation_reset_angle: 0.2
    Oscillation.oscillation_reset_dist: 0.05
    Oscillation.oscillation_reset_time: -1
    Oscillation.scale: 1
    Oscillation.x_only_threshold: 0.05
    PathAlign.aggregation_type: "last"
    PathAlign.class: "PathAlign"
    PathAlign.forward_point_distance: 0.325
    PathAlign.scale: 0
    PathDist.aggregation_type: "last"
    PathDist.class: "PathDist"
    PathDist.scale: 32
    RotateToGoal.class: "RotateToGoal"
    RotateToGoal.scale: 32
    RotateToGoal.xy_goal_tolerance: 0.25
    acc_lim_theta: 2
    acc_lim_x: 2
    acc_lim_y: 0
    controller_frequency: 20
    controller_plugin_ids: ["FollowPath"]
    controller_plugin_types: ["dwb_core::DWBLocalPlanner"]
    critics: ["RotateToGoal", "Oscillation", "BaseObstacle", "GoalAlign", "PathAlign", "PathDist", "GoalDist"]
    debug_trajectory_details: True
    decel_lim_theta: -2
    decel_lim_x: -2
    decel_lim_y: 0
    discretize_by_time: False
    goal_checker_name: "dwb_plugins::SimpleGoalChecker"
    max_speed_xy: 1.3
    max_vel_theta: 1
    max_vel_x: 1.3
    max_vel_y: 0
    min_speed_theta: 0
    min_speed_xy: 0
    min_theta_velocity_threshold: 0.001
    min_vel_x: 0
    min_vel_y: 0
    min_x_velocity_threshold: 0.001
    min_y_velocity_threshold: 0.5
    prune_distance: 1
    prune_plan: True
    publish_cost_grid_pc: True
    publish_evaluation: True
    publish_global_plan: True
    publish_local_plan: True
    publish_trajectories: True
    publish_transformed_plan: True
    sim_time: 1.7
    trajectory_generator_name: "dwb_plugins::StandardTrajectoryGenerator"
    transform_tolerance: 0.2
    use_sim_time: True
    vx_samples: 20
    vy_samples: 5
    xy_goal_tolerance: 0.25
    yaw_goal_tolerance: 0.25

    3d_obstacle_layer.combination_method: 1
    3d_obstacle_layer.decay_model: 0
    3d_obstacle_layer.enabled: True
    3d_obstacle_layer.map_save_duration: 60
    3d_obstacle_layer.mapping_mode: False
    3d_obstacle_layer.mark_threshold: 0
    3d_obstacle_layer.observation_sources: "rgbd1_clear rgbd1_mark"
    3d_obstacle_layer.publish_voxel_map: True
    3d_obstacle_layer.rgbd1_clear.clear_after_reading: False
    3d_obstacle_layer.rgbd1_clear.clearing: True
    3d_obstacle_layer.rgbd1_clear.data_type: "PointCloud2"
    3d_obstacle_layer.rgbd1_clear.decay_acceleration: 1
    3d_obstacle_layer.rgbd1_clear.enabled: True
    3d_obstacle_layer.rgbd1_clear.expected_update_rate: 0
    3d_obstacle_layer.rgbd1_clear.horizontal_fov_angle: 1.04
    3d_obstacle_layer.rgbd1_clear.inf_is_valid: False
    3d_obstacle_layer.rgbd1_clear.marking: False
    3d_obstacle_layer.rgbd1_clear.max_obstacle_height: 3
    3d_obstacle_layer.rgbd1_clear.max_z: 10
    3d_obstacle_layer.rgbd1_clear.min_obstacle_height: 0
    3d_obstacle_layer.rgbd1_clear.min_z: 0.1
    3d_obstacle_layer.rgbd1_clear.model_type: 0
    3d_obstacle_layer.rgbd1_clear.observation_persistence: 0
    3d_obstacle_layer.rgbd1_clear.obstacle_range: 2.5
    3d_obstacle_layer.rgbd1_clear.sensor_frame: ""
    3d_obstacle_layer.rgbd1_clear.topic: "/custom_camera/custom_points"
    3d_obstacle_layer.rgbd1_clear.vertical_fov_angle: 0.7
    3d_obstacle_layer.rgbd1_clear.vertical_fov_padding: 0
    3d_obstacle_layer.rgbd1_clear.voxel_filter: False
    3d_obstacle_layer.rgbd1_mark.clear_after_reading: True
    3d_obstacle_layer.rgbd1_mark.clearing: False
    3d_obstacle_layer.rgbd1_mark.data_type: "PointCloud2"
    3d_obstacle_layer.rgbd1_mark.decay_acceleration: 0
    3d_obstacle_layer.rgbd1_mark.enabled: True
    3d_obstacle_layer.rgbd1_mark.expected_update_rate: 0
    3d_obstacle_layer.rgbd1_mark.horizontal_fov_angle: 1.04
    3d_obstacle_layer.rgbd1_mark.inf_is_valid: False
    3d_obstacle_layer.rgbd1_mark.marking: True
    3d_obstacle_layer.rgbd1_mark.max_obstacle_height: 5
    3d_obstacle_layer.rgbd1_mark.max_z: 10
    3d_obstacle_layer.rgbd1_mark.min_obstacle_height: 0.2
    3d_obstacle_layer.rgbd1_mark.min_z: 0
    3d_obstacle_layer.rgbd1_mark.model_type: 0
    3d_obstacle_layer.rgbd1_mark.observation_persistence: 0
    3d_obstacle_layer ...
edit retag flag offensive close merge delete



It may also be helpful to record and examine the /evaluation topic to figure out why it is preferring those trajectories.

David Lu gravatar image David Lu  ( 2020-01-10 15:32:09 -0500 )edit

prune_plan with a distance of 1 is not the best option.. Now shuttle drives with full speed and has at least some avoidance.

madmax gravatar image madmax  ( 2020-01-14 09:05:59 -0500 )edit

1 Answer

Sort by » oldest newest most voted

answered 2020-01-08 18:00:11 -0500

johnconn gravatar image

I would strongly recommend inputting the same obstacle layers you have enabled in your local costmap into your global costmap so that the global planner won't try ramming into things. The local planner will give you much better results if the path you give it doesn't contain obstacles.

If you don't want to do that, I would remove the oscillation critic to simplify your system a little bit and then start experimenting with critic parameters and see if you can get better results. Make sure the stop_on_failure is set for your mapgrid critics. Things like trinary_costmap, sim_time, aggregation_type and critic scale. It defaults to only scoring the last pose in a trajectory.

edit flag offensive delete link more


Thanks for the answer. In my case I need a „static“ global plan which is published by a central server. So I need to either stop in front of obstacle or in best case move around it with local planner. Will have a look at it and see if I that helps.

madmax gravatar image madmax  ( 2020-01-09 12:57:06 -0500 )edit

if your requirements allow you the margin, you could ingest the static global plan yourself, discretize it into a set of waypoints, and send those waypoints to the navigation global planner. There is a waypoint follower example in the nav2 repo

johnconn gravatar image johnconn  ( 2020-01-09 14:19:14 -0500 )edit

Interesting idea. But for me the better solution would be to stop in front of obstacle, and then give the planner a goal x meters after the obstacle, to calculate a plan avoiding the obstacle. If it won't work only with a local planner.

madmax gravatar image madmax  ( 2020-01-10 03:02:12 -0500 )edit

btw you have a good documentation by chance regarding the local planner and cost scales?
Or is it reading the code and trying things out?

madmax gravatar image madmax  ( 2020-01-10 03:26:32 -0500 )edit

Here are some docs for navigation tuning from ROS1:

Most param names have stayed the same between ROS1 and ROS2.

Reading the code gave me a better understanding of many params. The documentation in the stack wasn't good enough. There is a ticket filed to improve that documentaiton

johnconn gravatar image johnconn  ( 2020-01-10 09:13:16 -0500 )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



Asked: 2020-01-08 15:17:20 -0500

Seen: 541 times

Last updated: Jan 08 '20