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: