Drop gpsd support and the GNSS simulator service: the car's GNSS comes over CAN later; /api/gnss/position and the GNSS control stay, fed through GNSS_LATEST
This commit is contained in:
1 parent
09a9d8baba
commit
49900c1703
10 files changed
+22
-133
No files matched your search
+7
-13
@@ -238,8 +238,7 @@ may not even read the same way there.
|
||||
`GeolocateControl` — same button, reusing its exact CSS classes/icon
|
||||
(`.maplibregl-ctrl-geolocate`) rather than a new one, so it's a visual
|
||||
drop-in — but sourced differently. This app has its own GNSS receiver
|
||||
(gpsd, possibly `bin/gnss_simulator.rb`'s simulated one — see
|
||||
`docs/development.adoc`/`docs/deployment.adoc`), and "find my
|
||||
(over CAN in the car, to come; see TODO.adoc), and "find my
|
||||
location" should mean that receiver, not a device's separate (and
|
||||
often less accurate, e.g. wifi-based) location service — but only
|
||||
once it's actually turned on, via the sidebar's "GNSS" icon
|
||||
@@ -695,23 +694,18 @@ toggling is a cheap re-render of just that strip.
|
||||
== Live GNSS position
|
||||
|
||||
A "GNSS" map control (`public/js/gnss.js`) shows the fix from a local
|
||||
GNSS receiver (a real one, plugged into the machine running the
|
||||
server, or `bin/gnss_simulator.rb`'s simulated one — distinct from
|
||||
GNSS receiver (the car's, over CAN, to come — distinct from
|
||||
`LocateControl`'s browser-geolocation fallback, `navigator.geolocation`,
|
||||
which the OS may or may not derive from such a receiver at all —
|
||||
see "Finding your location" above).
|
||||
|
||||
`lib/maptool/gpsd_client.rb` is a small client for
|
||||
https://gpsd.io[gpsd]'s JSON protocol over TCP (port 2947 by default):
|
||||
it watches for TPV — "time-position-velocity", gpsd's term for a fix —
|
||||
reports and yields each as a plain hash, reconnecting on any I/O error
|
||||
so a receiver that isn't plugged in yet (or gpsd not running) is not
|
||||
fatal. `app.rb` runs one of these in a background thread for the
|
||||
whole process and keeps the latest fix in `GNSS_LATEST`, guarded by a
|
||||
mutex since the HTTP threads read it concurrently.
|
||||
Nothing feeds it for now: gpsd support was dropped in favor of the
|
||||
car's GNSS over CAN. Whatever reads the receiver keeps the latest fix
|
||||
in `app.rb`'s `GNSS_LATEST`, guarded by a mutex since the HTTP threads
|
||||
read it concurrently.
|
||||
|
||||
`GET /api/gnss/position`, polled by the frontend every 1.5s, is a
|
||||
deliberate choice over a push channel (SSE/WebSocket): gpsd itself
|
||||
deliberate choice over a push channel (SSE/WebSocket): a receiver
|
||||
only reports at roughly 1Hz, so a push channel buys nothing here, and
|
||||
it sidesteps a real problem — Sinatra's `stream(:keep_open)` helper,
|
||||
absent an EventMachine reactor (i.e. under plain threaded Puma, as
|
||||
|
||||
Reference in new issue
Block a user