ros-infrastructure / rosindex

The source code for generating index.ros.org
https://index.ros.org
GNU General Public License v3.0
12 stars 23 forks source link

How can I get the value of a particular cell? #360

Closed Ion1811 closed 3 months ago

Ion1811 commented 3 months ago

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

clalancette commented 3 months ago

Please open questions like this on https://robotics.stackexchange.com/questions/tagged/ros, which is our central Question and Answer site. You'll get a better answer there, and it will be searchable for the future.

Make sure to include a lot of information on what platform you are using, which ROS distribution you are using, and the exact steps you took.