ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

how to remove forward bias in move_base

asked 2015-04-18 21:59:12 -0500

dan gravatar image

updated 2015-04-21 12:44:57 -0500

I have a robot that senses and moves in reverse just as well as in forward. However, move_base trajectories are highly biased toward turning the robot around and moving forward. I tried setting prefer_forward_cost_function to 0.0 and also tied turning on and off DWA, but these have no apparent effect.

Is there some way to remove the forward bias in move_base?


I tried the excellent suggestion of making min_vel_x negative and initially thought it worked, but in fact, it does not.

The output from move_base still does not generate negative x velocities. When given a goal to the rear, with a blank map, it turns 180 degrees and goes there. If I set max_vel_x = 0.0, then it just turns in place. Here is base_local_planner_params.yaml

Second revise: I swapped from TrajectoryPlanner to DWAPlanner (param file and move_base output shown below) but it does not seem to make any difference.

Third revise: I was entering DWAPlanner parameters, but did not select DWAPlanner as the local planner, so it was defaulting to TrajectoryPlanner. Adding this line to the parameter list fixed that and the bot now goes backwards.

base_local_planner: "DWAPlannerROS"

Many thanks to David Lu for his help with this.

controller_frequency: 4.0
recovery_behavior_enabled: true
clearing_rotation_allowed: false

   max_vel_x: 0.3
   min_vel_x: -0.5
   max_rotational_vel: 0.5
   min_vel_theta: -0.5
   min_in_place_vel_theta: 0.2
   escape_vel: -0.1
   acc_lim_x: 2.3
   acc_lim_y: 2.3
   acc_lim_theta: 1.5

   holonomic_robot: false
   yaw_goal_tolerance: 0.1 # about 6 degrees
   xy_goal_tolerance: 0.2  # 20 cm
   latch_xy_goal_tolerance: false
   pdist_scale: 0.8
   gdist_scale: 0.6
   meter_scoring: true
   prefer_forward_cost_function: 0.0

   heading_lookahead: 1.0
   heading_scoring: false
   heading_scoring_timestep: 0.8
   occdist_scale: 0.1
   oscillation_reset_dist: 0.05
   publish_cost_grid_pc: false
   prune_plan: true

   sim_time: 1.5
   sim_granularity: 0.025
   angular_sim_granularity: 0.025
   vx_samples: 8
   vtheta_samples: 20
   dwa: true
   simple_attractor: false

Just in case it is useful, here is the output from move_base startup. Note that it is using rangefinders as sources and I thought maybe the rear sensors were creating an obstacle, but the behavior is unchanged with the hokuyo sensors removed.


 * /map_server/frame_id: map
 * /move_base/DWAPlannerROS/acc_lim_theta: 1.5
 * /move_base/DWAPlannerROS/acc_lim_x: 2.3
 * /move_base/DWAPlannerROS/acc_lim_y: 2.3
 * /move_base/DWAPlannerROS/angular_sim_granularity: 0.025
 * /move_base/DWAPlannerROS/dwa: True
 * /move_base/DWAPlannerROS/escape_vel: -0.1
 * /move_base/DWAPlannerROS/gdist_scale: 0.6
 * /move_base/DWAPlannerROS/heading_lookahead: 1.0
 * /move_base/DWAPlannerROS/heading_scoring: False
 * /move_base/DWAPlannerROS/heading_scoring_timestep: 0.8
 * /move_base/DWAPlannerROS/holonomic_robot: False
 * /move_base/DWAPlannerROS/latch_xy_goal_tolerance: False
 * /move_base/DWAPlannerROS/max_rotational_vel: 0.5
 * /move_base/DWAPlannerROS/max_vel_x: 0.3
 * /move_base/DWAPlannerROS/meter_scoring: True
 * /move_base/DWAPlannerROS/min_in_place_vel_theta: 0.2
 * /move_base/DWAPlannerROS/min_vel_theta: -0.5
 * /move_base/DWAPlannerROS/min_vel_x: -0.5
 * /move_base/DWAPlannerROS/occdist_scale: 0.1
 * /move_base/DWAPlannerROS/oscillation_reset_dist: 0.05
 * /move_base/DWAPlannerROS/pdist_scale: 0.8
 * /move_base/DWAPlannerROS/prefer_forward_cost_function: 0.0
 * /move_base/DWAPlannerROS/prune_plan: True
 * /move_base/DWAPlannerROS/publish_cost_grid_pc: False
 * /move_base/DWAPlannerROS/sim_granularity: 0.025
 * /move_base/DWAPlannerROS/sim_time: 1.5
 * /move_base/DWAPlannerROS/simple_attractor: False
 * /move_base/DWAPlannerROS/vtheta_samples: 20
 * /move_base/DWAPlannerROS/vx_samples: 8
 * /move_base/DWAPlannerROS/xy_goal_tolerance: 0.2
 * /move_base/DWAPlannerROS/yaw_goal_tolerance: 0.1
 * /move_base/clearing_rotation_allowed: False
 * /move_base/controller_frequency: 4.0
 * /move_base/global_costmap/footprint: [[0 ...
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-04-19 13:19:33 -0500

David Lu gravatar image

You need to set min_vel_x to be negative (not 0)

edit flag offensive delete link more


that was it-- thanks!! Do you know if prefer_forward_cost_function has any effect and, if so, what are the ranges?

dan gravatar image dan  ( 2015-04-19 20:46:29 -0500 )edit

prefer_forward_cost makes it so that even if backwards trajectories are possible it prefers to go forwards. The value is just a weight on the weighted sum that calculates the best overall score, so the real range is 0-infinity (as helpful as that is)

David Lu gravatar image David Lu  ( 2015-04-19 21:46:54 -0500 )edit

turns out I spoke too soon. move_base is still not outputting negative x velocities-- see the details in the revised question.

dan gravatar image dan  ( 2015-04-20 23:05:21 -0500 )edit

I assumed from your initial question you were using dwa_local_planner. I don't know if TrajectoryPlannerROS can go backwards.

David Lu gravatar image David Lu  ( 2015-04-21 10:44:58 -0500 )edit

I tried with dwa_local_planner with no difference. See the revised question for the param file and the move_base output with dwa_planner Hmm, I am wondering if I set the dwa parameters but have not selected dwa as the planner. Is there a parameter to select the planner?

dan gravatar image dan  ( 2015-04-21 12:05:43 -0500 )edit

ah, there is indeed such a parameter and when I added base_local_planner: "DWAPlannerROS" to the param file, the bot now goes backwards. However, the trajectory is somewhat ragged, as if it is being dragged along in fits and spurts. That may be out of scope for this question. I'll look into it.

dan gravatar image dan  ( 2015-04-21 12:38:17 -0500 )edit

one last thought: if you have to have min_vel_x negative to get backwards planning motion, then do you use min_trans_vel to avoid getting velocity commands that are too small for the robot to move? That was the original point of min_vel_x I think.

dan gravatar image dan  ( 2015-04-21 12:52:57 -0500 )edit

Indeed how do you make sure that the min velocity (forward or backward) is enough to overcome friction?

hc gravatar image hc  ( 2018-10-19 05:46:00 -0500 )edit

Question Tools

1 follower


Asked: 2015-04-18 21:59:12 -0500

Seen: 2,426 times

Last updated: Apr 21 '15