ANYbotics / grid_map

Universal grid map library for mobile robotic mapping
BSD 3-Clause "New" or "Revised" License
2.56k stars 800 forks source link

Occupancy grid map to elevation map #385

Open valli96 opened 1 year ago

valli96 commented 1 year ago

For a future path planning through uneven terrain, I am trying to convert a 2D occupancy map into an elevation map and then save it as a grid map. Which one to use as a starting point. Is it possible to use "grid_map_costmap_2d" to do this? And if so, can someone give an example?

My 2D occupancy grid maps saved as a .pgm and .yaml file and use noetic

Or is this the wrong approach? Thanks in advance

ivrolan commented 1 year ago

Hi Valentin,

I'm trying to incorporate grid_maps to nav2_map_server of Nav2, so I had to do something similar to this. Basically, the function fromOccupancyGrid() of GridMapROSConverter takes the 2D occupancy msg and creates a layer with its data in the specified grid_map. If you want to save the grid_map to load it later, you can convert it to a OccupancyGrid and use the same function the map_server uses to create a .pgm map from a OccupancyGrid.

Take a look to my modification of nav2_map_server, mainly the map_io.cpp. I hope it helps!