CANopen diagnostics and map data over HTTPS: /can.html (interfaces, nodes with heartbeat state and last EMCY, decoded signals, every COB-ID with role, count, rate and last data); signals can mark an invalid raw value (esphome-canopen's unknown) and NaN gives no value; the CAN reader never dies and a broken can.json only turns CAN off; the GNSS node mcu-stm32-xiao-c5-2 (0x21) and host networking for the car's server in docs; bin/pull-maps.sh pulls map data from GET /api/sync/maps(/file) with SYNC_TOKEN instead of rsync over SSH, resuming cut-off downloads
This commit is contained in:
1 parent
a3e5fefaf1
commit
6a0d6194fe
9 files changed
+365
-43
No files matched your search
+56
-8
@@ -202,17 +202,65 @@ server's `GET /api/sync/changes`, `GET`/`PUT /api/sync/source/:id`,
|
||||
`data/sync_state.json`. Over the public URL, so no VPN is needed for it.
|
||||
On brick the CI deploy writes `SYNC_TOKEN` (a Gitea secret) into `.env`.
|
||||
|
||||
=== CAN (GNSS node)
|
||||
|
||||
SocketCAN interfaces live in the host's network namespace, so on the car's
|
||||
server maptool runs with host networking: a `docker-compose.override.yaml`
|
||||
next to the compose symlink (podman-compose picks it up), with kiwix and
|
||||
Valhalla published on loopback since their service names no longer resolve
|
||||
from maptool:
|
||||
|
||||
----
|
||||
services:
|
||||
maptool:
|
||||
network_mode: host
|
||||
environment:
|
||||
KIWIX_URL: "http://127.0.0.1:8080"
|
||||
VALHALLA_URL: "http://127.0.0.1:8002"
|
||||
kiwix:
|
||||
ports: ["127.0.0.1:8080:8080"]
|
||||
valhalla:
|
||||
ports: ["127.0.0.1:8002:8002"]
|
||||
----
|
||||
|
||||
`data/can.json` (`lib/maptool/can.rb`) decodes the GNSS node
|
||||
`mcu-stm32-xiao-c5-2` (CANopen node 0x21, esphome-canopen's
|
||||
`canopen_entities`; layout in its `OBJECT_DICTIONARY.md`): TPDO2 (0x3A1)
|
||||
carries latitude/longitude as REAL32, TPDO3 (0x4A1) altitude, speed (km/h)
|
||||
and HDOP as Sensor16 over their `min_value..max_value` (`value = wire *
|
||||
(max - min) / 65534 + min`, 65535 unknown) and satellites as Sensor8; TPDO1 (0x2A1) the on-board IMU's pitch, roll
|
||||
(-180..180°) and temperature, Sensor16 too. The compass (HMC5883L on the
|
||||
same node) isn't in the firmware yet:
|
||||
|
||||
----
|
||||
{ "interfaces": ["can0"],
|
||||
"signals": [
|
||||
{ "name": "gnss.lat", "id": "0x3A1", "byte": 0, "type": "f32" },
|
||||
{ "name": "gnss.lon", "id": "0x3A1", "byte": 4, "type": "f32" },
|
||||
{ "name": "gnss.alt", "id": "0x4A1", "byte": 0, "type": "u16", "scale": 0.14496292001098665, "offset": -500, "invalid": 65535, "unit": "m" },
|
||||
{ "name": "gnss.speed", "id": "0x4A1", "byte": 2, "type": "u16", "scale": 0.001271604561499883, "invalid": 65535, "unit": "m/s" },
|
||||
{ "name": "gnss.hdop", "id": "0x4A1", "byte": 4, "type": "u16", "scale": 0.0007629627368999298, "invalid": 65535 },
|
||||
{ "name": "gnss.satellites", "id": "0x4A1", "byte": 6, "type": "u8", "scale": 1.0039370078740157, "invalid": 255 },
|
||||
{ "name": "imu.pitch", "id": "0x2A1", "byte": 0, "type": "u16", "scale": 0.005493331705679495, "offset": -180, "invalid": 65535, "unit": "°" },
|
||||
{ "name": "imu.roll", "id": "0x2A1", "byte": 2, "type": "u16", "scale": 0.005493331705679495, "offset": -180, "invalid": 65535, "unit": "°" },
|
||||
{ "name": "imu.temperature", "id": "0x2A1", "byte": 4, "type": "u16", "scale": 0.0025177770317697684, "offset": -40, "invalid": 65535, "unit": "°C" } ] }
|
||||
----
|
||||
|
||||
Speed's scale also converts km/h to m/s (`300 / 65534 / 3.6`). The node
|
||||
goes operational by itself, so no `nmt_start`.
|
||||
|
||||
=== Map data (one way)
|
||||
|
||||
`bin/pull-maps.sh`, run by `maptool-pull-maps.timer` (10 min after boot,
|
||||
then every 6 h) as `randy`: rsyncs the pmtiles, routing, places, hiking
|
||||
trails, the ZIM and the NPS maps from brick while brick is reachable, and
|
||||
restarts maptool when something changed. Its key is limited on brick
|
||||
(`~randy/.ssh/authorized_keys`) to a read-only rsync of the data dir:
|
||||
|
||||
----
|
||||
command="python3 /usr/share/doc/packages/rsync/support/rrsync -ro /srv/podman/maptool/data",restrict ssh-ed25519 AAAA… rpi-dev maptool map sync
|
||||
----
|
||||
then every 6 h) as `randy`: pulls the pmtiles, routing, places, hiking
|
||||
trails, the ZIM and the NPS maps from brick over HTTPS — the same public
|
||||
URL and `SYNC_TOKEN` as the library sync (read from `.env`), so no SSH or
|
||||
VPN. brick lists them (`GET /api/sync/maps`: size, mtime, path; the list
|
||||
of files is app.rb's `MAP_SYNC_FILES`/`MAP_SYNC_DIRS`) and serves each
|
||||
(`GET /api/sync/maps/file?path=`); a cut-off download resumes (Range) on
|
||||
the next try or run, files gone on brick are removed, maptool restarts
|
||||
when something changed. They're GBs, so only at home by default (brick's
|
||||
LAN address `HOME_HOST` answers); `HOME_HOST=` pulls anywhere.
|
||||
|
||||
== Garmin LiveTrack session webhook
|
||||
|
||||
|
||||
Reference in new issue
Block a user