Record motion sensors, raw GPS and clocks for sensor fusion, and add Ride settings
Phase 1 of GNSS/IMU sensor fusion: record what the filter needs, so it can be built and tuned offline against real rides before it changes anything on air (docs/07-sensor-fusion-logging.md). Settings > Ride replaces Units, whose metric switch did nothing (the app is metric throughout). It holds the phone position (handlebar, bag or pocket), written into every V2X log as meta.phone_mount, and "Record motion sensors", off by default. With that switch on when a V2X log starts, the log (schema 2, file name ending in _imu-<mount>) also records: - accelerometer, gyroscope and gravity at 100 Hz into a new imu table, each sample with its own SensorEvent timestamp, collected on a background thread; - raw GPS_PROVIDER fixes as gnss source phone_gps, next to the fused location, and for every phone fix its monotonic time, speed and bearing accuracy and provider; - the monotonic, wall and GNSS clocks once a second into a new clock table, to line all timestamps up afterwards and show any phone clock step; - the sensors' names and rates and the GNSS chip in meta. Both settings are read once at the start, so one log is one mount and one mode. The logger screen shows the mount, the motion sensor row count and the raw GPS fix age while it runs. tools/fusion_log_check.py checks a recorded log (sensor rates and gaps, both phone sources, clock alignment and steps) and ends in PASS, WARN or FAIL. Tested on synthetic logs built from V2xLogWriter's own table definitions; the bench and ride checks on the Pixel 9 Pro are in TODO.
This commit is contained in:
@@ -82,7 +82,9 @@ Both paths converge at `CamUseCaseRepository`, which normalises whatever arrived
|
||||
|
||||
**OBU status**; the ESP32-C5 card shows the link in use, signing (tickets, signed, refused, on air) and the board's battery voltage with a low/critical warning, which also appears in the top bar.
|
||||
|
||||
**V2X data logger**; Settings > Developer. Records every V2X message received on either path, with the phone's GNSS fix, the OBU's fix where there is one, and RSSI, into one SQLite file per run (`files/v2x_logs/`). The UPER bytes are kept as received; CAM, DENM, SPATEM and MAPEM get a few fields decoded alongside.
|
||||
**V2X data logger**; Settings > Developer. Records every V2X message received on either path, with the phone's GNSS fix, the OBU's fix where there is one, and RSSI, into one SQLite file per run (`files/v2x_logs/`). The UPER bytes are kept as received; CAM, DENM, SPATEM and MAPEM get a few fields decoded alongside. With Settings > Ride > Record motion sensors on, a log also records accelerometer, gyroscope and gravity at 100 Hz, raw GPS fixes next to the fused location, and the phone's clocks, for sensor fusion; `tools/fusion_log_check.py` checks such a log. See `docs/07-sensor-fusion-logging.md`.
|
||||
|
||||
**Ride settings**; Settings > Ride. Where the phone rides (handlebar, bag or pocket), recorded in every V2X log for sensor fusion, and the motion sensor recording switch above.
|
||||
|
||||
**Trip recording**; foreground service records all sensor streams and detects cycling manoeuvres (braking, turning, stopping) using orientation-independent signal processing. Works fully offline with no OBU connected. The detected manoeuvres are neither shown nor stored - their only effect is to raise the CAM transmit rate through the manoeuvre on the ESP32-C5 path.
|
||||
|
||||
@@ -98,13 +100,13 @@ MVVM with Repository pattern throughout. Jetpack Compose for all UI (no XML layo
|
||||
app/src/main/java/com/hawhamburg/micr0bu/
|
||||
ui/screens/ Compose screens (Dashboard, Record, Trips, V2X Monitor and map, Settings, V2X logger...)
|
||||
ui/navigation/ Navigation graph and bottom nav bar
|
||||
viewmodel/ MqttViewModel (V2X state, traffic lights), SensorViewModel, TripRecordingViewModel, V2xLogViewModel
|
||||
viewmodel/ MqttViewModel (V2X state, traffic lights), SensorViewModel, TripRecordingViewModel, V2xLogViewModel, RideSettingsViewModel
|
||||
data/mqtt/ MQTT repository, Paho client, exponential-backoff reconnection, CiT One protobuf envelope
|
||||
data/transport/ Esp32Link (station session), StationLink (link codec), UsbSerialTransport, BleLinkTransport
|
||||
data/cam/ CamUseCaseRepository, where both hardware paths converge; PseudonymManager
|
||||
data/log/ V2xLogger, V2xLogWriter (the V2X data logger)
|
||||
data/db/ Room database (sessions, trips, V2X messages)
|
||||
data/ SensorRepository, GnssTimeSource, TripRepository, CsvExporter, TripExporter
|
||||
data/ SensorRepository, GnssTimeSource, RidePreferences, TripRepository, CsvExporter, TripExporter
|
||||
domain/asn1/ BitReader/BitWriter, ItsTime, and the CAM, DENM, SPATEM, MAPEM and VAM UPER codecs
|
||||
domain/map/ MAPEM intersection geometry: lanes, nodes, connections, maneuvers
|
||||
domain/spat/ SPATEM signal state, and TrafficLights (SPATEM on MAPEM lanes, the rider's approach)
|
||||
@@ -112,6 +114,7 @@ app/src/main/java/com/hawhamburg/micr0bu/
|
||||
domain/usecase/ UseCaseDetectionEngine, UseCaseDetectionConfig, AlertLevel, GeoMath
|
||||
domain/detection/ EventDetector, RunningStats sliding window (orientation-independent)
|
||||
domain/cam/ Cam, CamParser, PhoneCamBuilder, CamTransmitConfig, Pseudonym
|
||||
domain/fusion/ Sensor fusion: YawRateEstimator (yaw rate about the vertical), PhoneMount
|
||||
service/ TripRecordingService, CamTransmitLoop, CamPinger, V2xLogService
|
||||
|
||||
obu-firmware/ ESP32-C5 OBU on Niklas Dathe's microbu-firmware (station, signing, BTP, GeoNetworking,
|
||||
@@ -205,6 +208,7 @@ Never regenerate a golden fixture from this project's own encoder output. See `a
|
||||
| [docs/MicrOBU-Technical-Documentation.docx](docs/MicrOBU-Technical-Documentation.docx) | Supervisors and stakeholders. Architecture, message path, verification, results, decisions |
|
||||
| [docs/01-requirements-traceability.md](docs/01-requirements-traceability.md) | Requirements chapters 0 to 13 mapped to implementation and evidence |
|
||||
| [docs/06-signed-its-vam-ble.md](docs/06-signed-its-vam-ble.md) | Signed ITS messages, VAM and the BLE link: who does what, link protocol, recovery, verification |
|
||||
| [docs/07-sensor-fusion-logging.md](docs/07-sensor-fusion-logging.md) | Sensor fusion phases 0 and 1: yaw rate and GNSS time inputs, Ride settings, the fusion log schema, `tools/fusion_log_check.py`, test rides |
|
||||
| [docs/Architecture-signed-its.drawio.png](docs/Architecture-signed-its.drawio.png) | Block diagram of the signed-ITS architecture |
|
||||
| [05-obu-bench-test-2026-08-25.md](05-obu-bench-test-2026-08-25.md) | Bench campaign T1 to T9, measured results |
|
||||
| [04-transmit-setup.md](04-transmit-setup.md) | Transmitter bring-up, radio configuration diagnosis, the TX bypass |
|
||||
|
||||
Reference in New Issue
Block a user