-
Notifications
You must be signed in to change notification settings - Fork 19
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
Dynamically load terrain files at runtime #35
Comments
@Ryanf55 How do you envision the request for terrain be generated? Would the connection to the terrain server be generated from grid_map_geo itself? |
A key constraint of grid_map, assuming you only have one grid_map object, is that the loaded terrain is contiguous, and cannot exceed the memory limit of the application. The current behavior of grid_map_geo violates this by trying to load the entire dataset in memory, even though it only needs a"smaller" area. For a dataset like the full SRTM1 dataset, attempting to load a grid_map of that size causes a memory allocation exception and crash. Regarding where the terrain comes from, the current behavior is for the user to pre-load the terrain onto the device because they know in advance where they will fly. There's two key concepts proposed, which could be broken up into separate issues.
The request for terrain load/unload could be automatic and based on some heuristics:
|
@Ryanf55 One thing that I realized is that the SRTM1 is in the WGS84 coordinate system. This means that we would need to reproject the DEM into a metric coordinate system (e.g. UTM) to use it as an elevation map for paths, that would be defined in meters. Not sure whether we want to enforce this with the navigation end application in mind, or we keep it general in this repository, and we check the type of projection in the end application. |
Yup. Since this repository can be used outside of terrain navigation, I'm weighing towards the side of keeping it generic. As long as users can get the WKT, then it can be generic. Do you think adding a new function to expose a Another reason to keep the transform logic here rather than in terrain navigation is to avoid adding a dependency on GDAL in the navigation repo. |
Purpose
This issue is to capture the desire and design, for dynamically loading terrain.
Current Behavior
Currently, grid_map_geo supports loading a single
.tif
file. Before flight, a user must create the.tif
file for the region they plan to fly, and then modify their launch or parameter to point to the correct file. While this works great for small tests where the user is familiar with terrain generation and flies areas known well in advance, it doesn't work for casual users who just want terrain data working wherever they fly automatically.Furthermore, it only works with tif files, so users can't use any terrain data supplied by other tools.
Desired Behavior
A user can fetch terrain using a common terrain server, such as ArduPilot Terrain Generator. A processing step occurs onboard, and then the terrain tile(s) are suitable for use in grid_map_geo. grid_map_geo should be able to work with more than just
.tif
files. If the user requests color data loaded, the color data may be in a different datum/resolution/raster size than the DEM data.Proposed Design
Utilize GDAL's VRT format as the pre-processing step for terrain. This would allow loading multiple terrain tiles, either to cover more area, or to allow overlapping tiles of differing resolution. While the VRT generation could be done manually with a call to gdalbuildvrt, it could be automated in the future, or generated server-side.
Next, modify the grid_map_geo implementation to work off either a single
.tif
file, or also given a path to a.vrt
file.Finally, allow grid_map_geo to support loading partial terrain, instead of the entire vrt dataset, and then allow dynamic unload/load of regions through additional API calls.
Using GDAL tools with the ArduPilot terrain database
Fetching terrain
One can fetch terrain from the ArduPilot terrain server like so:
Building a VRT
For a single file:
Or, for multiple:
Query height of a single point at CMAC, which returns 467m elevation
Further References
The text was updated successfully, but these errors were encountered: