Skip to content

radar: port 3-tier lead tracking + vision-coast + Rivian yRel correction#2

Open
rawsignal wants to merge 1 commit into
devfrom
radar-lead-tracking
Open

radar: port 3-tier lead tracking + vision-coast + Rivian yRel correction#2
rawsignal wants to merge 1 commit into
devfrom
radar-lead-tracking

Conversation

@rawsignal

Copy link
Copy Markdown
Contributor

Ports the radard lead-tracking work from the sunnypilot fork (spicysapling/sunnypilot @ fix/lead-track-switching, through aa23300729) into this Rivian fork. User-selectable via a new "Radar Lead Tracking" cruise-panel selector (LeadTrackingMode, default = Stable Lead / Tier 2):

  • Tier 1 (Stock): stock per-frame greedy vision<->radar match.
  • Tier 2 (Stable Lead): lateral-weighted id hysteresis biases the held radar track, killing per-frame lead flicker where track ids are stable.
  • Tier 3 (Stable + Vision Coast): also holds the last-good lead through a sudden close/slow radar phantom the camera doesn't corroborate (chosen track-id changed, or radar lateral jump while vision held still), bounded by a 1 s cap, with a 40 m close-cut-in failsafe that never coasts past a near lead.

Rivian radar lateral correction: the opendbc Mando interface computes yRel = 0.5 * -sin(az) * dist; the 0.5 over-compresses the lateral offset so prob_y can't separate an adjacent-lane car from the in-path lead. Corrected brand-gated at radar-point ingestion to a 0.70 effective scale (x1.4) so the matcher, the stored Track, and the emitted lead all see the same lateral; dRel/vRel untouched, non-Rivian brands are a no-op. Validated on the sunnypilot corpus (tier-2 brake-jumps -4.7%, 0 gross-streak regressions).

Observability: new radarStateSP cereal message (leadOne/leadTwoCoasting) drives an opt-in per-chevron coast tint + dev-UI COAST element, gated by ShowVisionCoastOnChevron (default off).

Validated on macOS: 23 unit tests pass (test_radard_tiers.py), cereal and params_pyx rebuilt, radarStateSP round-trips, new param keys resolve.

(cherry picked from commit 9f0e77c)

Ports the radard lead-tracking work from the sunnypilot fork
(spicysapling/sunnypilot @ fix/lead-track-switching, through aa23300729)
into this Rivian fork. User-selectable via a new "Radar Lead Tracking"
cruise-panel selector (LeadTrackingMode, default = Stable Lead / Tier 2):

  - Tier 1 (Stock): stock per-frame greedy vision<->radar match.
  - Tier 2 (Stable Lead): lateral-weighted id hysteresis biases the held
    radar track, killing per-frame lead flicker where track ids are stable.
  - Tier 3 (Stable + Vision Coast): also holds the last-good lead through a
    sudden close/slow radar phantom the camera doesn't corroborate (chosen
    track-id changed, or radar lateral jump while vision held still), bounded
    by a 1 s cap, with a 40 m close-cut-in failsafe that never coasts past a
    near lead.

Rivian radar lateral correction: the opendbc Mando interface computes
yRel = 0.5 * -sin(az) * dist; the 0.5 over-compresses the lateral offset so
prob_y can't separate an adjacent-lane car from the in-path lead. Corrected
brand-gated at radar-point ingestion to a 0.70 effective scale (x1.4) so the
matcher, the stored Track, and the emitted lead all see the same lateral;
dRel/vRel untouched, non-Rivian brands are a no-op. Validated on the
sunnypilot corpus (tier-2 brake-jumps -4.7%, 0 gross-streak regressions).

Observability: new radarStateSP cereal message (leadOne/leadTwoCoasting)
drives an opt-in per-chevron coast tint + dev-UI COAST element, gated by
ShowVisionCoastOnChevron (default off).

Validated on macOS: 23 unit tests pass (test_radard_tiers.py), cereal and
params_pyx rebuilt, radarStateSP round-trips, new param keys resolve.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
(cherry picked from commit 9f0e77c)
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