Skip to content

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

Merged
tipoman9 merged 9 commits into
mainfrom
gs-offline-map
Sep 23, 2026
Merged

tipoman9 merged 9 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 4 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
…clean checkout

leaflet.js/css and the marker images were gitignored and only fetched by
fetch-leaflet.sh, so build.bat/CI on a fresh clone produced a binary whose
viewer 404s on leaflet.* ("L is not defined"). Commit the files, guard the
PyInstaller spec against a missing copy, and whitelist the images/ set that
leaflet.css references.

Also on Windows: swallow ConnectionAbortedError (WinError 10053, the browser
cancelling a tile or SSE stream) like BrokenPipe/Reset by catching the common
ConnectionError base, and log the reason when a live tile fetch fails instead
of silently answering 204, so blank basemaps can be diagnosed from the console.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
tipoman9 and others added 5 commits September 19, 2026 23:25
- map.sh: fall back to the default port when config.ini is absent
- mapserver.py: on Windows, verify TLS with certifi's root bundle (OpenTopoMap
  failed with an expired cross-cert in the Windows store), bind without
  SO_REUSEADDR so a relaunch reuses the running server instead of starting a
  second one, and report reserved ports clearly
- run-map.bat: native Windows launcher; build.bat requires Python 3.12+ and
  bundles certifi; CI installs certifi
- docs: Windows notes

Linux behaviour unchanged (all changes gated on win32).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…S AHI draw not throttled

- Camera: poll MSP_ATTITUDE first in the tick and read the UART once more
  15 ms later, so the reply is forwarded in the same tick (~49 ms -> ~19 ms).
- Camera: flush attitude to UDP without the 10 ms gate; a DRAW_SCREEN flush
  in the same read no longer holds it a full tick. DisplayPort frames are
  aggregated for 2 refresh intervals to keep the datagram rate unchanged.
- GS: attitude-driven AHI redraw bypasses the screen refresh throttle so no
  sample is skipped. Air units keep the throttle.
- Stats: AttitMSGs(ms) is now a true per-second average.
…cess. Added a new offline map image to the pics directory.
@tipoman9
tipoman9 merged commit ea08020 into main Sep 23, 2026
9 checks passed
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