Files
svc-core/docs/GUIDELINES.md
T
mikkeli 6a7de03773 obd-poller: OBD-II mode 01, the single CAN writer; recorder keeps its values
obd-poller asks 0x7DF for the nine obd2 signals, only while the bus is alive,
and publishes envelopes stamped with the reply's kernel time. The recorder
subscribes to yukart/vehicle/* and writes vehicle.ndjson beside the frames.
Tested against a fake ECU on vcan0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DDwfd6Ki8UfG4hK6W5YpJz
2026-10-12 23:25:03 +09:00

37 lines
1.6 KiB
Markdown

---
type: guidelines
---
# Core services guidelines
## 1. One CAN writer: `obd-poller`
- `obd-poller` is the only thing that transmits on the car's bus (project-yukart
decision 3): OBD-II requests, one at a time, only while the bus is visibly
alive. Anything else that transmits is a bug; the recorder only reads.
- `can_pcan` is no longer listen-only (2026-10-12), so the adapter acknowledges
frames like any scan tool. Going back is one line in orin-nano-env-setup's
`/etc/default/can-can_pcan`.
## 2. Capture never waits
- A frame missed is gone. Producers hand frames to the writer without blocking;
what doesn't fit is **counted**, recorded as an event, and never silently lost.
- Capture reads SocketCAN and gpsd directly. It does not depend on the broker, a
display, or any other service being up.
## 3. Every failure leaves complete files
- Append, flush and `fdatasync` about once a second. Power loss costs at most the
last second.
- Replace files by write-temp, fsync, rename. Never rewrite in place.
- Anything found half-done at startup is repaired or marked, not deleted.
## 4. Raw stays raw
- Recordings are `candump -L` text plus the gpsd JSON as received, so `can-utils`,
`canplayer` and anything already written against the first captures keep working.
- Decoding happens downstream of the recording, never instead of it.
## 5. Time is evidence, not truth
- The car unit's clock can boot stale and be stepped mid-drive. Record what is
needed to correct it later (sync state, monotonic time, observed steps, GNSS
time beside local receive time) rather than trusting it.
## 6. To be added