Conversation
|
The problem i see it conflicts with existing plugin, also there requirement to pull curl into main process. |
|
yes thanks for the feedback, will change up the framework |
|
I'd done more precise review together with Copilot and also suggest how to improve architecture: Bugs / blockers:
Integration items:
Architecture suggestion: The plugin is doing a lot — SRTM parsing, LRU caching, bilinear
This keeps the SRTM code testable, makes the server independently reusable |
|
did you review after I refactored to your original suggestions? |
|
@zekesarosi not yet. Not expected that fast...
|
| request_pub_ = node->create_publisher<mavros_msgs::msg::TerrainRequest>( | ||
| "~/request", 10); | ||
|
|
||
| data_sub_ = node->create_subscription<mavros_msgs::msg::TerrainData>( |
There was a problem hiding this comment.
New docs extractor gets the descrption from the comment above node->create_*(),
So please move it here.
|
|
||
| _MAP: bytes = zlib.decompress(base64.b64decode( | ||
| {data_literal} | ||
| )) |
There was a problem hiding this comment.
Where are that compress/b64 came from? It doesn't looks like we really needs that, but makes check harder.
| int32 lon # Longitude degE7 | ||
| uint16 grid_spacing # Grid spacing in meters | ||
| uint8 gridbit # Index of the 4x4 block inside the grid | ||
| int16[16] data # Terrain elevation values in meters |
There was a problem hiding this comment.
I'm a bit unsure about almost raw mavlink message repr, e.g. int32 lat/lon when in most of other places we use GeoPoint/float64.
|
thank you again for the feedback. Let me know again about this revision. |
| 'ce905e5ba3834408946be595611a48e879595323abe8ea65f0148d01efe56a22e5dc19970f8381' | ||
| '8135078a9ec89cde271d6b2ad107e7b86d9aa549d2ff002e1e877d' | ||
| ) | ||
| ) |
There was a problem hiding this comment.
About base64 - i mean, do we really need to store that as a compressed blob?
|
|
||
| from mavros_extras.terrain_server_node import main | ||
|
|
||
| main() |
There was a problem hiding this comment.
Just thought - maybe good to have some script to preload tiles?
I.e. give some rectangle (two coordinates pair) and script will download absent data.
Or maybe like a cache management commands, like preload / update (check and load changed data) / validate (i.e. ready for offline work).
Also regarding loading of the data, good to support http(s) proxy.
Is there a checksum files available on the source? If so - possible to get those files via https and tiles via http, so proxy like a Squid can cache the data in your local site.
If not, well, there nginx, but setup a little bit harder.
The Terrain Server plugin implements the companion-computer side of the MAVLink Terrain Protocol, allowing a ROS 2 system to supply real-world elevation data to a flight controller over MAVLink. When an autopilot like ArduPilot needs to know the ground height beneath it — for terrain-following flight, safe altitude planning, or landing — it sends a TERRAIN_REQUEST message asking for elevation data over a grid of coordinates. This plugin catches those requests and responds with the corresponding altitude values, sourced from NASA's Shuttle Radar Topography Mission (SRTM) dataset.
If a tile isn't available locally, the plugin can automatically download it. When auto-download is enabled, background worker threads fetch the missing .hgt.zip from ArduPilot's terrain server (or a custom host), extract it, and slot it into the cache — all without blocking the main request-serving loop. A continent lookup table avoids wasting time on ocean tiles that don't exist.