Ford: show longitudinal personality in IPC (#31796)

* Ford: show longitudinal personality in IPC

Adjust the time gap to 2, 3 or 4 bars for openpilot long.

TODO: set AccTGap_D_Dsply when value changes so that the popup appears
with the new time gap

Depends on #31760.

* ACC UI: show time gap popup when distance changes

* Revert "ACC UI: show time gap popup when distance changes"

This reverts commit c4e8e10970.

* ACC UI: send on distance bars change

* don't need this check - just send on first frame
pull/31766/head^2
Cameron Clough 1 year ago committed by GitHub
parent 78d72d7dc3
commit 011eed0daf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 9
      selfdrive/car/ford/carcontroller.py
  2. 2
      selfdrive/car/ford/fordcan.py

@ -35,6 +35,7 @@ class CarController(CarControllerBase):
self.main_on_last = False
self.lkas_enabled_last = False
self.steer_alert_last = False
self.lead_distance_bars_last = None
def update(self, CC, CS, now_nanos):
can_sends = []
@ -98,15 +99,19 @@ class CarController(CarControllerBase):
# send lkas ui msg at 1Hz or if ui state changes
if (self.frame % CarControllerParams.LKAS_UI_STEP) == 0 or send_ui:
can_sends.append(fordcan.create_lkas_ui_msg(self.packer, self.CAN, main_on, CC.latActive, steer_alert, hud_control, CS.lkas_status_stock_values))
# send acc ui msg at 5Hz or if ui state changes
if hud_control.leadDistanceBars != self.lead_distance_bars_last:
send_ui = True
if (self.frame % CarControllerParams.ACC_UI_STEP) == 0 or send_ui:
can_sends.append(fordcan.create_acc_ui_msg(self.packer, self.CAN, self.CP, main_on, CC.latActive,
fcw_alert, CS.out.cruiseState.standstill, hud_control,
CS.acc_tja_status_stock_values))
fcw_alert, CS.out.cruiseState.standstill, hud_control,
CS.acc_tja_status_stock_values))
self.main_on_last = main_on
self.lkas_enabled_last = CC.latActive
self.steer_alert_last = steer_alert
self.lead_distance_bars_last = hud_control.leadDistanceBars
new_actuators = actuators.copy()
new_actuators.curvature = self.apply_curvature_last

@ -212,7 +212,7 @@ def create_acc_ui_msg(packer, CAN: CanBus, CP, main_on: bool, enabled: bool, fcw
"AccFllwMde_B_Dsply": 1 if hud_control.leadVisible else 0, # Lead indicator
"AccStopMde_B_Dsply": 1 if standstill else 0,
"AccWarn_D_Dsply": 0, # ACC warning
"AccTGap_D_Dsply": 4, # Fixed time gap in UI
"AccTGap_D_Dsply": hud_control.leadDistanceBars + 1, # Time gap
})
# Forwards FCW alert from IPMA

Loading…
Cancel
Save