Closed
Description
Hi,
While debugging an issue, I ended up looking at the getSizeInMetersX() and getSizeInMetersY() of Costmap2D [1].
double Costmap2D::getSizeInMetersX() const
{
return (size_x_ - 1 + 0.5) * resolution_;
}
double Costmap2D::getSizeInMetersY() const
{
return (size_y_ - 1 + 0.5) * resolution_;
}
I don't get the purpose of the - 1 + 0.5
. In my understanding, the size of the costmap in meters should be the number of cells multiplied by the resolution, nothing more. I tried to find the original commit adding those lines to look for an explanation, but those lines have been there since the origin of navigation 1.
Can someone help me understand this? If it's correct, an extra comment in the code would be appreciated.
[1] https://github.com/ros-navigation/navigation2/blob/main/nav2_costmap_2d/src/costmap_2d.cpp#L558