Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can i get the height value of a particular cell #260

Open
Ion1811 opened this issue Mar 19, 2024 · 0 comments
Open

How can i get the height value of a particular cell #260

Ion1811 opened this issue Mar 19, 2024 · 0 comments

Comments

@Ion1811
Copy link

Ion1811 commented Mar 19, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant