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

# what does origin represent in a costmap?

i am using costmap_2d c++ api. In the constructor one can set an origin of the costmap. what does this origin represent? it is a point or a cell? if i set origin e.g. (10,10) does it mean the cell to the left and below origin will have a negative index?

edit retag close merge delete

Sort by ยป oldest newest most voted

By resetting the costmap origin, you are telling the costmap that its position in the world frame has changed. The costmap_2d object uses the origin that you specify when calling the mapToWorld() method (among others) to determine the translation from world coordinates to individual costmap cells. You can set the origin in whatever frame you want.

So, if you set (10, 10) as the origin, and you sent a goal of (15, 15), when you look up the costmap grid space corresponding to your goal, the grid space would be ( (15-10) / resolution, (15-10) / resolution) ). So if your resolution was 0.1 meters/pixel, your costmap index for that goal would be (50, 50).

Additionally, the costmap grid spaces can never have a negative index (they're all unsigned int). You can find the API here if you're interested.

more

hello,@DimitriProsser,if i set(10,10)as the map origin,sent a goal of (5,5),then the goal coordinate in the /map would be (-5/resolution,-5/resolution),then calling getIndex()method,it will return negative index,conflict with the return typeunsigned int,where i mistake ?

( 2014-10-07 21:42:52 -0600 )edit

@jxl : Goal of (5,5) would be out of the map's bounds as the map's origin is set to (10,10). Goal's x,y coordinates must be >= origin's x,y coordinates respectively.

( 2017-01-25 02:38:18 -0600 )edit