Skip to content

Add ground-station only offline moving-map overlay + preflight tool t… - #104

Open
tipoman9 wants to merge 3 commits into
mainfrom
gs-offline-map
Open

tipoman9 wants to merge 3 commits into
mainfrom
gs-offline-map

Conversation

@tipoman9

Copy link
Copy Markdown
Collaborator

Native OSD moving-map renderer (GS builds only, _x86/ROCKCHIP) drawn into the OSD with Cairo, over the video: follow modes (plane/north/center/fit), rounded window frame, ini-configurable position/size, on-screen status messages, POI direction markers, home/target from state.ini + landmarks DB. All new rendering is guarded, so air-unit builds (goke/hisi/star6*) are unaffected.
Ground-station preflight tool (gs/): Python mapserver + WebKit viewer to browse/download tiles into per-basemap MBTiles, set targets, and build a standalone preflight binary (gs/pack). Keyed-provider (Thunderforest) support with the API key kept out of git.
native/rockchip now link sqlite3 (CI dep added). Docs under documentation/ and gs/README.md.

tipoman9 and others added 3 commits July 21, 2026 23:25
…o predownload it.

Native OSD moving-map renderer (GS builds only, _x86/__ROCKCHIP__) drawn into the OSD with Cairo, over the video: follow modes (plane/north/center/fit), rounded window frame, ini-configurable position/size, on-screen status messages, POI direction markers, home/target from state.ini + landmarks DB. All new rendering is guarded, so air-unit builds (goke/hisi/star6*) are unaffected.

Ground-station preflight tool (gs/): Python mapserver + WebKit viewer to browse/download tiles into per-basemap MBTiles, set targets, and build a standalone preflight binary (gs/pack). Keyed-provider (Thunderforest) support with the API key kept out of git.

native/rockchip now link sqlite3 (CI dep added). Docs under documentation/ and gs/README.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Extends the ground-station moving map and its preflight tool. Ground-side
only: the new C sources go in GS_SRCS and are compiled into the native and
rockchip targets, so camera builds are unaffected.

Terrain elevation
- Preflight stores a terrain height grid alongside the tiles in
  maps/elevation.db (AWS "terrarium" tiles decoded to int16 metres at z12,
  ~28 m/sample). On by default, capped at 1000 tiles.
- mapserver.py gains a stdlib-only PNG decoder, so no new dependency.
- osd/util/terrain_elevation.c mirrors the Python lookup in C; terrain_agl.c
  calibrates GPS altitude against terrain at the armed transition and feeds
  AGL to the map and to the new !AGL! OSD keyword.
- tests/terrain_{elevation,agl}_test.c, run by `make test-terrain` under
  ASan/UBSan.

Link horizon
- New /viewshed endpoint and preflight panel: given an antenna height and a
  flight altitude, draws where terrain stops blocking line of sight. Models
  4/3-earth refraction and reproduces the textbook horizon over flat ground.
  It is a terrain-only upper bound; the DEM is bare earth, so trees, masts
  and buildings are not in it.

Map packs
- Each download is allocated a name and never overwrites an existing pack;
  the panel lists downloaded packs and can delete them.
- The OSD map cycles packs at runtime with 'h', and falls back to the first
  pack in the folder when the configured one is missing.

Downloads
- Tile fetches reuse a kept-alive connection per host instead of a fresh TLS
  handshake per tile; the handshake was ~125 ms of a ~220 ms tile.
- Progress is reported per phase (tiles -> POIs -> elevation), so the bar no
  longer sits at 100% while elevation is still downloading.

OSD map rendering
- JPEG tiles decode via vendored stb_image, so imagery basemaps render.
- Track vector: an arrow along the GPS ground course drawn over the plane
  marker, showing the drift angle when the aircraft crabs. Configurable
  length and opacity; hidden below a ground-speed threshold, which also
  suppresses it when no GPS data is arriving.
- Up to 5 named waypoints instead of a single target.
- Pack filename banner and a key guide shown briefly when the map appears.
- Fix: in center (track-up) mode the plane icon was drawn at a fixed angle,
  so it showed the ground track rather than the heading. Icon and vector now
  both derive their screen angle from the rotation the tiles were rendered
  with, making all four follow modes consistent.

Preflight UI
- Detail zoom selectable z12-z18, per-zoom basemap sources, an Advanced
  section for pack naming, terrain height under the pointer, waypoint
  editing and cached-coverage shading.
- map.sh/run-map.sh open the system browser by default; --GTK selects the
  WebKitGTK window.

Docs
- New documentation/terrain-elevation.md and gs-map-internals.md; gs/README.md
  rewritten around capabilities.
- msposd.ini is gitignored, so add a tracked msposd.ini.example documenting
  every [poi] and [map] key, including the new ones. Per-FC sections that
  msposd writes at runtime are excluded. Fixes the dangling ../msposd.ini
  link in map_control_via_RC.md.

Co-Authored-By: Claude Opus 5
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

Successfully merging this pull request may close these issues.

1 participant