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

NavFn setting up cost array (costarr) from ROS's costmap

asked 2014-11-14 08:06:00 -0500

2ROS0 gravatar image


The NavFn planner takes in ROS's costmap created by costmap_2d package. The input is in the format mentioned here.

Now, when NavFn reads those values, it refactors everything from the (0, 253) range by the equation COST_NEUTRAL + COST_FACTOR * input_cost_value which scales all of it proportionally to the (50, 253) range.

Why is this done?

Thank you.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-11-14 10:21:10 -0500

dornhege gravatar image

My guess is that this was done to ensure there is always a minimal cost to visit a cell. Otherwise, if the costmap has 0-cost cells any path nevermind the length would be equally good as a solution.

edit flag offensive delete link more


I see, but you could potentially resolve that by making the score 1. What is the need to scale the data to 50+?

2ROS0 gravatar image 2ROS0  ( 2014-11-14 11:09:23 -0500 )edit

If my guess is even correct this is just a balancing factor. if there is a narrow passage with 253, you'd be willing to take a 253 times as long detour to avoid that.

dornhege gravatar image dornhege  ( 2014-11-14 11:24:51 -0500 )edit

The author mentions something about narrow packages when deciding on the COST_FACTOR (set to 0.8) which is different from the initial 50 offset.

2ROS0 gravatar image 2ROS0  ( 2014-11-14 13:07:52 -0500 )edit

I'm not sure I entirely understand your point - are you saying that by making it 50+ you ensure open passages only upto ~5 times as large as the narrow passage (253) would be considered equivalent per se?

2ROS0 gravatar image 2ROS0  ( 2014-11-14 13:08:33 -0500 )edit

Basically yes, under the assumption that my guess is correct. There might be other motivations.

dornhege gravatar image dornhege  ( 2014-11-17 04:57:32 -0500 )edit

Those are the motivations as far as I have been able to uncover. Note that global_planner has these factors as dynamic parameters.

David Lu gravatar image David Lu  ( 2014-11-19 10:24:43 -0500 )edit

Question Tools

1 follower


Asked: 2014-11-14 08:06:00 -0500

Seen: 233 times

Last updated: Nov 14 '14