Decode MAPEM and show traffic lights per lane
MapemUperCodec decodes MAPEM (MapData) from the ESP32-C5 (BTP port 2003) and the CiT One's v2x/rx/mapem topic: intersection and lane names, the reference point, lane types and directions, all node offset sizes and node attributes, and each lane's connections with their signal groups. It returns null on what it cannot size (extensions, regional data, computed lanes) rather than guess. TrafficLights.join places SPATEM signal groups on the MAPEM's ingress lanes, gives each connection its turn (its maneuver, else the lane's, else the angle between the lanes), picks the MAPEM whose revision the SPATEM names when two are on air, and matches the rider to an ingress lane from position and heading. The dashboard card then names the intersection and shows the rider's lane, the distance to its stop line and one chip per signal group with its turn arrows; the V2X map puts the light on the reference point and draws the lanes in their signal colours. Tested on recorded messages only: every distinct MAPEM on record (17 from the 2026-03-18 drive, 288-1348 bytes, plus the bench RSU's) decodes field for field like asn1tools; with a recorded SPATEM of the same intersection and revision, 340 of 341 signalled exits find their movement (3/165's group 65 never appears in its SPATEMs), and the geometric turn agrees with 198 of 201 stated maneuvers. tools/mapem_corpus.py rebuilds the fixtures.
This commit is contained in:
@@ -5,6 +5,29 @@ Engineering to-do list. The reviewer-facing open items live in
|
||||
|
||||
## Waiting on hardware
|
||||
|
||||
### MAPEM decoder and traffic lights per lane (added 2026-10-28)
|
||||
|
||||
`MapemUperCodec` decodes every recorded MAPEM (17 from the 2026-03-18 drive + the bench RSU's)
|
||||
field-for-field like asn1tools (`MapemUperCodecTest`, fixture from `tools/mapem_corpus.py`).
|
||||
`TrafficLights.join` puts SPATEM signal groups on MAPEM lanes: on the recorded pairs, 340 of 341
|
||||
signalled exits find their SPATEM movement (3/165's group 65 is never in its SPATEMs), and the
|
||||
geometric turn fallback agrees with 198 of 201 stated maneuvers (`TrafficLightsTest`). 132 unit
|
||||
tests pass. Installed on the Pixel 2026-10-28 16:38 (from Android Studio); not yet seen live, the
|
||||
RSU was switched off.
|
||||
|
||||
Needs the Pixel (new APK), the XIAO on COM10 and the bench RSU sending CAM + SPATEM + MAPEM:
|
||||
|
||||
- [ ] Dashboard: the signal card says "MicrOBU test crossroads" instead of "Traffic light -1/23".
|
||||
- [ ] Walk or ride toward the bench crossroads along an ingress lane (the RSU's refPoint is
|
||||
53.554698, 10.022548; lanes run 12-72 m out N/E/S/W): the card shows "North in · N m to the
|
||||
stop line" (or the lane you are on) and chips with arrows (↑←→) in the group's colour.
|
||||
- [ ] V2X map: the light stands on the reference point (no RSU CAM needed), 4 ingress lanes in
|
||||
their signal colour, the rider's lane thicker, 4 egress lanes grey.
|
||||
- [ ] logcat `handleMapUper[serial]: decoded station=... -1/23 rev 1 (8 lanes)` about 1 Hz, and no
|
||||
"unexpected BTP port 2003" lines.
|
||||
- [ ] V2X data logger: `MAPEM` rows with `source='esp32'`, `lat/lon` = the reference point and a
|
||||
summary naming the intersection.
|
||||
|
||||
### XIAO ESP32-C5 battery: voltage, low-battery warning, shutdown (added 2026-10-05)
|
||||
|
||||
The production board is now a Seeed XIAO ESP32-C5 on COM10 (8 MB flash), on a LiPo with no protection
|
||||
@@ -62,8 +85,9 @@ Settings > Developer > V2X data logger. 110 unit tests pass. ESP32-C5 path check
|
||||
SPATEM (58 B), 472 CAM in 90 s, 0 oversize. COM10 app-flashed 2026-10-28 (d0fcb45-dirty, NVS
|
||||
kept; STATUS 106 octets, 3999 mV). BLE reconnected to the Pixel on the bond it already had
|
||||
(16:38, bond state 12, ATT MTU 517, credentials loaded, 1 ticket). Still to do (RSU off): a V2X
|
||||
log shows `MAPEM` rows with `source='esp32'`. App side: `CamUseCaseRepository` logs "unexpected BTP
|
||||
port" for 2003/2018 (no decoder there yet). On the CiT One, MAPEM arrives via `v2x/rx/mapem` (subscribed now) or
|
||||
log shows `MAPEM` rows with `source='esp32'`. App side: MAPEM is decoded since 2026-10-28 (see
|
||||
"MAPEM decoder and traffic lights per lane"); VAM (2018) still gets "unexpected BTP port" from
|
||||
`CamUseCaseRepository`. On the CiT One, MAPEM arrives via `v2x/rx/mapem` (subscribed now) or
|
||||
the processed `v2x-uca/output/json/map` topic; the API lists no VAM topic, so no VAM rows are
|
||||
expected there.
|
||||
- [ ] **Signed SPATEM/MAPEM on air.** On 2026-10-28 the bench RSU sent CAM, SPATEM and MAPEM all
|
||||
|
||||
Reference in New Issue
Block a user