Skip to content

gr26: sync CAN models with firmware GRCAN#155

Open
jacobjurek wants to merge 4 commits into
jake/ingestfrom
jake/grcan-sync
Open

gr26: sync CAN models with firmware GRCAN#155
jacobjurek wants to merge 4 commits into
jake/ingestfrom
jake/grcan-sync

Conversation

@jacobjurek
Copy link
Copy Markdown
Contributor

Syncs gr26/model with the Firmware GRCAN autogen artifacts (Autogen/CAN/Inc/GRCAN_*_ID.h + Doc/GRCAN_*.dbc) and adds the tooling that produced this sync.

Applied (1)

  • ECU_STATUS_3: added the missing relay_states field — firmware dlc is 5, the model stopped at 4 bytes. Confirmed in-sync after the change.

Flagged for firmware confirmation — TODO(grcan-sync), no behavior change

  • DTI_DATA_1–5: DBC says LittleEndian/unsigned/scale-1; models use BigEndian/signed/scaling. Third-party inverter — hand-tuned values likely correct, DBC may be a placeholder. Do not conform without a datasheet/live-frame check.
  • DTI_DATA_5: DBC has a richer layout (8 digital-IO bits, 8 named limit bits, rpm/power limits, can_version) vs the model's reserved bytes.
  • INV_STATUS_3: DBC puts fault_bits at byte 1 (byte 2 unused); model has padding at byte 1, fault_bits at byte 2.
  • GPS_ALT: DBC is one 8-byte ALT (likely float64); model decodes a float32 altitude + gps_status.

No action (intentional)

  • DASH_STATUS / DASH_CONFIG: model explodes bytes into per-bit boolean signals (documented in dash.go).
  • TCM_STATUS / TCM_RESOURCE_UTILIZATION: no DBC layout exists (firmware-C-only).
  • Naming differences (e.g. ts_voltage vs tractive_system_voltage) are intentional abbreviations.

Tooling included

gr26/tools/grcan/grcan_sync.py (parse / diff / reconcile), fetch.sh, committed firmware snapshot/, and the sync-grcan skill. Full audit in gr26/tools/grcan/AUDIT-20260530.md.

Net model change is +27 lines, all additive (one field + four comment blocks).

🤖 Generated with Claude Code

jacobjurek and others added 4 commits May 30, 2026 13:34
Tooling to keep gr26/model in sync with the Firmware GRCAN autogen
artifacts (Inc/GRCAN_*_ID.h + Doc/GRCAN_*.dbc):

- grcan_sync.py: stdlib parser/differ with three modes — parse, diff
  (firmware-vs-firmware), reconcile (models-vs-firmware audit). Joins by
  CAN ID via composite base-ID extraction with name-match fallback.
- fetch.sh: pull the 5 source artifacts from Firmware via gh.
- snapshot/: committed baseline for diffing future firmware changes.
- .claude/skills/sync-grcan: orchestration skill (audit -> apply -> PR).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ructural

reconcile was false-flagging dash messages (which build signals via the
bit(v,n,"name") helper, not Signal{Name:...} literals) as having 0 signals.
Also: when the model exposes MORE signals than the DBC (e.g. dash explodes a
byte into per-bit booleans) that's intentional enrichment, not drift -
demote it from structural to naming.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Ran grcan_sync reconcile against Firmware@main. Applied the one clearly-safe
structural fix and flagged the judgment cases with TODO(grcan-sync) for
firmware confirmation rather than blindly conforming to the DBC.

Applied:
- ECU_STATUS_3: add missing relay_states field (firmware dlc 5, byte 4)

Flagged (no behavior change):
- DTI_DATA_1-5: DBC endianness/signedness/scale disagree with the hand-tuned
  third-party layout; DTI_DATA_5 also has a richer DBC layout
- INV_STATUS_3: fault_bits byte position differs from DBC
- GPS_ALT: DBC 8-byte ALT vs model float32 + gps_status

See gr26/tools/grcan/AUDIT-20260530.md for the full report.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Adds message definitions and messageMap entries for firmware nodes that were
never modeled (untracked firmware messages: 49 -> 15):

- Tire temp thermal arrays: TireTempFrame0..23 (0x37-0x4E), 64-byte CAN-FD,
  768 pixels (global pixel0..767) via a tireTempFrame() factory
- Brake node: BrakeTemp (0x4F), WheelSpeed (0x50)
- SuspensionIMUMagData (0x51), InboardFloorIMUToFData (0x52)
- Energy Meter: EMMeas/EMStatus/EMTeamData1/EMTeamData2/EMTemp
- IMDGeneral (0x18FF01F4)

These are >8-byte CAN-FD frames; verified the mapache-go decoder sizes match
and a 64-byte tire frame decodes correctly. Layouts generated from the DBC via
grcan_sync; judgment items (IEEE-float vs raw, bit-packed fields, the
mag_status DLC overrun, J1939-multiplexed IMD frames) carry TODO(grcan-sync)
flags. Remaining untracked (debug, DTI control commands, charger, IMD_RESPONSE)
intentionally not modeled.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant