Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Why does costmap_2d::Costmap2D Class Reference use integers and not float?

Looking through the documentation of costmap_2d::Costmap2D Class Reference I am seeing that a lot of the functionality for querying specific values about cells uses unsigned ints. For example;

"getCost (unsigned int mx, unsigned int my) const-- Get the cost of a cell in the costmap."

"getIndex (unsigned int mx, unsigned int my) const-- Given two map coordinates... compute the associated index."

"indexToCells (unsigned int index, unsigned int &mx, unsigned int &my) const-- Given an index... compute the associated map coordinates."

My question is why does it not use floats instead of unsigned ints? Because if I want to get the cost of a cell at map coordinate (25.25, 13.75), and the resolution is small, then the integer value (25, 14) will not be able to query the value of the true cell I want.

This may be a pretty bad question cause I am so new to this, but it has really been frustrating my understating and use of the ROS costmap2D.

Thanks ahead of time!

JJB

Why does costmap_2d::Costmap2D Class Reference use integers and not float?

Looking through the documentation of costmap_2d::Costmap2D Class Reference I am seeing that a lot of the functionality for querying specific values about cells uses unsigned ints. For example;

"getCost getCost (unsigned int mx, unsigned int my) const-- const Get the cost of a cell in the costmap."

"getIndex costmap.

getIndex (unsigned int mx, unsigned int my) const-- const Given two map coordinates... compute the associated index."

"indexToCells index.

indexToCells (unsigned int index, unsigned int &mx, unsigned int &my) const-- const Given an index... compute the associated map coordinates."

My question is why does it not use floats instead of unsigned ints? Because if I want to get the cost of a cell at map coordinate (25.25, 13.75), and the resolution is small, then the integer value (25, 14) will not be able to query the value of the true cell I want.

This may be a pretty bad question cause I am so new to this, but it has really been frustrating my understating and use of the ROS costmap2D.

Thanks ahead of time!

JJB