How is map data analyzed?

asked 2019-07-18 11:18:53 -0500

Cero10 gravatar image

updated 2019-07-18 12:29:03 -0500

Hello I would like to make sure the way I am reading Occupancy grid maps is right.

based on info on the message type I know the data array is in row-major order.

The question is the width number increase from left to right? height increases from bottom to top?

For example, if self.map_data.info.width = 600 self.map_data.info.height = 400 self.map_data.info.resolution = 0.05 self.map_data.info.origin.position.x = -15 self.map_data.info.origin.position.y = -10 position xy(0,0)

whats the map_data array number for position x=0,y=0?

I have this code in Python but I am not sure if its right:

xx = (abs(self.map_data.info.origin.position.x - x)/(self.map_data.info.width*self.map_data.info.resolution))*self.map_data.info.width
xx = round(xx,0)
yy = (abs(self.map_data.info.origin.position.y - y)/(self.map_data.info.height*self.map_data.info.resolution))*self.map_data.info.height
yy = round(yy,0)
listno = ((self.map_data.info.height-yy)*self.map_data.info.width)+xx
edit retag flag offensive close merge delete