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

what does origin represent in a costmap?

asked 2011-09-30 00:27:17 -0600

harmish gravatar image

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 flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2011-09-30 02:03:07 -0600

DimitriProsser gravatar image

updated 2011-09-30 02:06:37 -0600

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.

edit flag offensive delete link 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 ?

jxl gravatar image jxl  ( 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.

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

Question Tools

1 follower


Asked: 2011-09-30 00:27:17 -0600

Seen: 1,821 times

Last updated: Sep 30 '11