How can i get the height value of a particular cell
Ion1811 opened this issue · 0 comments
Ion1811 commented
I'm trying to get the heigth value of a cell with the next function, but i'm always getting the whole array on screen.
My code is this:
index_x = int((x - self.grid_map.info.pose.position.x) / self.grid_map.info.resolution)
index_y = int((y - self.grid_map.info.pose.position.x) / self.grid_map.info.resolution)
if 0 <= index_x < self.grid_map.info.length_x and 0 <= index_y < self.grid_map.info.length_y:
height_index = int(index_y * self.grid_map.info.length_x + index_x)
if len(self.grid_map.data) > 0:
height = self.grid_map.data[height_index]
return height