ros-navigation / navigation2

ROS 2 Navigation Framework and System
https://nav2.org/
Other
2.52k stars 1.28k forks source link

Costmap_2d: how to support cost values as double datatype #3949

Closed xyaoab closed 11 months ago

xyaoab commented 11 months ago

Hi team,

Is there any specific reason that unsigned char instead of double is supported in cost values in nav2_costmap_2d /costmap_2d.hpp?

Feature request

Feature description

We are using distance to the nearest occupied cell to represent the cost value in the costmap. double is expected to have higher precision.

SteveMacenski commented 11 months ago

Because unsigned chars are the underlying data in the costmap, not doubles. Its 1/8 the size allowing it to scale better. I won't say that that'll always be the case, but it was a solid engineering decision back with the resources we had in the 2000s when Willow was working on that package. Its on my agenda in 2024 to enable more flexibility here, but today, unsigned chars are your options. 0-100 is also what we think about in the literature for probability fields, which 0-255 handles quite nicely.