Skip to content

feat(tesla/preap): Bosch radar VIN learning, upside-down radar orientation support, and pedal calibration fixes - #33

Merged
SloPOS merged 5 commits into
NotAutopilot:naponsp-alpha-prebuiltfrom
IRIT-able:vinlearn
Oct 14, 2026
Merged

SloPOS merged 5 commits into
NotAutopilot:naponsp-alpha-prebuiltfrom
IRIT-able:vinlearn

Conversation

@IRIT-able

Copy link
Copy Markdown

Summary

This PR adds end-to-end Bosch MRR radar VIN learning, support for physically inverted (upside-down) radar mounts with a reboot prompt, and resolves multiple timing and state issues in the Comma Pedal calibration tool for Tesla Pre-AP vehicles.


Changes

1. Bosch Radar VIN Learning

  • Tool (vin_learn_radar.py): Automates Gateway CAN feed spoofing (0x405 / 0x398) to program donor vehicle VIN and configuration data into retrofit Bosch radars.
  • Dynamic Configuration: Reads the configured NAPRadarPosition directly from openpilot Params and sets the appropriate 2WD/AWD drive-type bits dynamically to prevent radar configuration mismatch DTCs.
  • UI Integration: Added a one-touch "VIN Learn Radar" button under Settings → Radar.

2. Invert Radar Orientation (Upside-Down Mount Support)

  • UI Toggle: Added "Invert Radar Orientation (Upside Down)" under Settings → Radar with an automatic reboot prompt upon change.
  • Coordinate Inversion: Corrects both lateral position (yRel = -yRel) and lateral velocity (yvRel = -yvRel) in radar_interface.py to ensure stable tracking when the radar is mounted inverted.

3. Comma Pedal Calibration Fixes

  • Panda Heartbeat Keepalive: Added send_heartbeat(False, False) calls to transport.py during pedal calibration to prevent modern Panda safety firmware from dropping into SAFETY_SILENT after 1 second.
  • Interceptor State Check: Fixed a bug in calibrate_pedal.py where active throttle actuation (pedal_interceptor_state == 1) in Stage 3 (Detecting Pedal Max) was treated as a fault, eliminating the false "Pedal communication timeout" error.

Verification & Testing

  • Tested live on Comma 3X on a Tesla Model S Pre-AP.
  • Verified radar VIN learning successfully pairs the radar without GTW DTCs.
  • Verified tracks mirror accurately on the Radar HUD when the upside-down toggle is enabled.
  • Verified Comma Pedal calibration completes all stages successfully without Panda watchdog timeouts.

Copilot AI balanced review requested due to automatic review settings October 12, 2026 18:16

This comment was marked as spam.

Panda permission can arrive after the first stalk event. Distinguish a pending grant from permission loss so hands-on pause does not immediately undo engagement, while keeping acquisition bounded and real permission loss immediate.
@SloPOS
SloPOS merged commit 7eb09d2 into NotAutopilot:naponsp-alpha-prebuilt Oct 14, 2026
1 check passed
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.

4 participants