Ask Your Question
1

what does origin represent in a costmap?

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

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
2

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

DimitriProsser gravatar image

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

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

Comments

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 imagejxl ( 2014-10-07 21:42:52 -0500 )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 imageashish ( 2017-01-25 02:38:18 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

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

Seen: 1,013 times

Last updated: Sep 30 '11