Skip to content

Firmware Controller: modeld says where the steering comes from; the Civics get their own measured delay schedules - #26

Closed
JamesL787 wants to merge 3 commits into
nrdr:nrdr-developmentfrom
JamesL787:nrdr-model-source-command-delay
Closed

JamesL787 wants to merge 3 commits into
nrdr:nrdr-developmentfrom
JamesL787:nrdr-model-source-command-delay

Conversation

@JamesL787

Copy link
Copy Markdown

Depends on #24: stacked on it (its commit is the first one here) and should merge after it; only the last two commits are new.

What it does

  • modeld (both runtimes) records where the steering came from: modelV2.action.lateralSource is plan, actionHead or curvatureHead. delayInput records how the told delay reached the model.
  • On a plan model (Pop v2, TCP v3) the Firmware Controller's command delay becomes max(0.3 - lateralActionTime, 0). That undoes the MIN_STABLE_DELAY floor and nothing else. Action heads keep the calibration's delay. The delay slews at 0.3 s/s when the model changes.
  • The TEG-A010 and the C020 get their own prediction schedules:
    • TEG: 0.20 s flat.
    • C020: 0.28 s in town, 0.26 s on the highway (provisional).
  • The cars PR Firmware Controller: corrected-PTM calibrations, R6 from Table A, each EPS's own E4 #24 adds take their measured sibling's schedule: the A030 the TEG's, the C120 and TGG the C020's. The CR-Vs keep live/manual delay; no CR-V timing has been measured.
  • With a schedule set, lagd is locked out for those cars, as it already is on the Clarity and the Insight.
  • The Clarity's command delay defaults to 0.125 s above 15 m/s (was 0.025): on an action-head model it ran 0.10–0.14 s early there without it (routes 3f1/3f5). A saved value is kept.
  • The Civic command delay (0.175 s) now holds above 15 m/s. The Insight's and the CR-Vs' still fade out there.

Why (measured by speed band on every local route)

  • TEG (its owner's routes 12e–13d, Pop v2):
    • The plan is read at lagd + 0.075 ≈ 0.44 s, but the car reaches a command 0.26–0.31 s after the frame.
    • So it turned in early, and above 15 m/s, where the delay faded out, it ran 0.13–0.17 s early.
  • C020 (route 380): 0.16 s early at 20–40 m/s.

Not yet confirmed

  • The C020 schedule comes from a drive on an older controller, corrected for this one's output filter. It should be re-measured on a drive with this controller.
  • No drive has been made on this change yet.

Tests: new test_model_source.py, plus updates to the Civic profile, starting-calibration, runtime and timing-metadata tests. No new failures. Three tests read the opendbc submodule's files from disk and need #24's opendbc pin checked out. settings_ui.json was recompiled for the delay text. The NrdrYawCommandDelayHigh default changed, so the params registry is regenerated (a native rebuild picks it up).

🤖 Generated with Claude Code

JamesL787 and others added 3 commits October 18, 2026 11:40
…uted from Table A, and each image's own E4 scale

Every PTM EPS image runs the same firmware control law with its own tables. This brings nrdr's Firmware Controller to
the corrected (2026-10-16, revision b) build of every image, models R6 the way the firmware computes it, and sends each
image the E4 scale its rows were built for. Each needs its corrected build (REQUIRED in its profile): older builds
report the same EPS version.

Calibrations carry their own key clamp, P/I trims, fixed command delay and required build. New starting calibrations,
ported from JamesL787 ns-bosch-radar-testing:
- Civic Bosch TBA-C120, Civic hatch TGG-A120, Civic TBA-A030, CR-V TLA-A040, CR-V TLA-A220. Each corrected build puts
  the Clarity's R5 for each command key on rows 0-5 (each row keeps its own key axis) and the Clarity's P knots on
  rows 0-5, scaled to the image's E4, so which variant row a car runs no longer changes its command. Firmware fields
  are read from each corrected image; load, trims and command delay are carried from the nearest measured car until
  the owner's drives measure them. The A220 gets its own envelope (1330 from 150 km/h) and is recognized on the
  A040's Table A (byte-identical).
- TEG-A010 has been driven on its corrected build (0000013d), so it is no longer provisional.
- C020: the P row's key axis is the image's own (0, 223, 441, 665, 883, ...), not the Clarity's knots.

R6, the firmware's rate feedback, is computed from each image's Table A, and clamped: -122 x A[0]/16384 per published
deg/s at centre (NORM 1650, the same motor-to-angle constant in every image), shaped by Table A's slope (+/-10 deg
chords), clamped at +/-32765 as the firmware does (firmware_r6 did not, so past the rail the feedforward over-modelled
damping up to ~2.5x on fast crawl turn-ins and unwinds). Checked against the telemetry R6 word on unrailed frames: mean
error 0.7% Clarity, 1.9% C020, 0.8% TEG-A010. The C020's flat -173 (an angle average against 0x14A, ~12% strong at
centre) and the C020/TEG telemetry shapes (fitted with railed frames, 4-7% low past 150 deg) are replaced.

E4 per unit: every Civic Bosch image (C020, C120, TGG-A120) and the Insight's clamp their command input at key 1663 =
E4 3840, in stock firmware as well as the PTM builds (which keep the stock decode). They were sent 4096, so the last ~6%
of the output range did nothing and the output-based thresholds were 6.7% off the firmware. nrdr/opendbc (efd32b6f4)
now sends HONDA_CIVIC_BOSCH and HONDA_INSIGHT 3840, as the Clarity and Nidec Civic already were, and these
calibrations follow in this commit so the inversion and the sent scale cannot drift apart. The C020 and TGG-A120 maps
were built for 4096, so per unit of output they now ask 0.94x the R5 they did and reach the clamp at full output; the
Firmware Controller's targets are unchanged, the PID path gets ~6% less. The request only shrinks; no limit grows.

Checked in every corrected image: the P row runs to 1774 (3840 cars) or 1892 (4096 cars), the key input clamps at
1663 (CR-V 1774), and Kp is a flat 265 at the clamp on every car.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t their own measured delay schedules

modelV2.action gains lateralSource (plan / actionHead / curvatureHead) and delayInput (actionT / lateralControlParams /
none), set by both modeld runtimes from the output get_action_from_model steers with.

On a scheduled profile a plan model's command delay is max(MIN_STABLE_DELAY - lateralActionTime, 0): the schedule
tells the model the car's own lag and this undoes only the 0.3 s floor. Action heads keep the calibration's delay.
The applied delay slews at 0.3 s/s, so a model change never steps it.

The TEG-A010 and the C020 get prediction schedules, measured by speed band on the local routes (2026-10-18): TEG
0.20 s flat (its owner's 12e-13d: the car reaches a command 0.26-0.31 s after the frame while lagd told it 0.37-0.39),
C020 0.28 / 0.26 s, provisional (route 380, an older controller). Their command delay holds 0.175 s above 15 m/s,
where both ran as early as in town; the Insight keeps its fade.

On top of the corrected-PTM calibrations (PR nrdr#24): the A030 takes the TEG's schedule and the C120 and TGG the C020's,
with the same flat Civic delay; the CR-Vs keep live/manual delay and the fading delay until a CR-V drive is measured.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The high end was 0.025 s (the source's none plus the port's 0.025 s compensation), set from 5-12 m/s turns only. By
speed band on routes 3f1 / 3f5 (an action-head model, no command delay above 15 m/s) the Clarity ran 0.12 / 0.14 /
0.10 s early at 17 / 16 / 25 m/s, so the default is 0.10 + 0.025. A saved NrdrYawCommandDelayHigh is kept. The
Insight keeps its own 0.025 s; plan models take the floor formula either way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nrdr

nrdr commented Nov 5, 2026

Copy link
Copy Markdown
Owner

Already picked up in nrdr-development: dd3daff and 92fab80 match the two changes here. The later model-source fix is also in db87bbb. Closing this one so it doesn't look like we're still missing it. Thanks!

@nrdr nrdr closed this Nov 5, 2026
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.

2 participants