Ford: add alert for steering wheel angle not ready (#28140)

* add event for steering angle calibrating

* how about this

how about this

* rename

* more openpilot-y

* add comment to code

* move to top

* better wording

* more general

* fix

* ?

* above

* bump cereal to master

* add more comms
pull/28146/head
Shane Smiskol 2 years ago committed by GitHub
parent e24d28fd45
commit fb29d0f3bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      cereal
  2. 7
      selfdrive/car/ford/carstate.py
  3. 3
      selfdrive/car/ford/interface.py
  4. 6
      selfdrive/controls/lib/events.py

@ -1 +1 @@
Subproject commit feef4530affd31b3c1816eebb52e8a684d8c7329 Subproject commit 8902e7a77815ca08e795b3006274d02379da7ca6

@ -16,9 +16,15 @@ class CarState(CarStateBase):
if CP.transmissionType == TransmissionType.automatic: if CP.transmissionType == TransmissionType.automatic:
self.shifter_values = can_define.dv["Gear_Shift_by_Wire_FD1"]["TrnRng_D_RqGsm"] self.shifter_values = can_define.dv["Gear_Shift_by_Wire_FD1"]["TrnRng_D_RqGsm"]
self.vehicle_sensors_valid = False
def update(self, cp, cp_cam): def update(self, cp, cp_cam):
ret = car.CarState.new_message() ret = car.CarState.new_message()
# Occasionally on startup, the ABS module recalibrates the steering pinion offset, so we need to block engagement
# The vehicle usually recovers out of this state within a minute of normal driving
self.vehicle_sensors_valid = cp.vl["SteeringPinion_Data"]["StePinCompAnEst_D_Qf"] == 3
# car speed # car speed
ret.vEgoRaw = cp.vl["BrakeSysFeatures"]["Veh_V_ActlBrk"] * CV.KPH_TO_MS ret.vEgoRaw = cp.vl["BrakeSysFeatures"]["Veh_V_ActlBrk"] * CV.KPH_TO_MS
ret.vEgo, ret.aEgo = self.update_speed_kf(ret.vEgoRaw) ret.vEgo, ret.aEgo = self.update_speed_kf(ret.vEgoRaw)
@ -106,6 +112,7 @@ class CarState(CarStateBase):
("AccStopMde_D_Rq", "EngBrakeData"), # PCM ACC standstill ("AccStopMde_D_Rq", "EngBrakeData"), # PCM ACC standstill
("AccEnbl_B_RqDrv", "Cluster_Info1_FD1"), # PCM ACC enable ("AccEnbl_B_RqDrv", "Cluster_Info1_FD1"), # PCM ACC enable
("StePinComp_An_Est", "SteeringPinion_Data"), # PSCM estimated steering angle (deg) ("StePinComp_An_Est", "SteeringPinion_Data"), # PSCM estimated steering angle (deg)
("StePinCompAnEst_D_Qf", "SteeringPinion_Data"), # PSCM estimated steering angle (quality flag)
# Calculates steering angle (and offset) from pinion # Calculates steering angle (and offset) from pinion
# angle and driving measurements. # angle and driving measurements.
# StePinRelInit_An_Sns is the pinion angle, initialised # StePinRelInit_An_Sns is the pinion angle, initialised

@ -76,6 +76,9 @@ class CarInterface(CarInterfaceBase):
ret = self.CS.update(self.cp, self.cp_cam) ret = self.CS.update(self.cp, self.cp_cam)
events = self.create_common_events(ret, extra_gears=[GearShifter.manumatic]) events = self.create_common_events(ret, extra_gears=[GearShifter.manumatic])
if not self.CS.vehicle_sensors_valid:
events.add(car.CarEvent.EventName.vehicleSensorsInvalid)
ret.events = events.to_msg() ret.events = events.to_msg()
return ret return ret

@ -945,4 +945,10 @@ EVENTS: Dict[int, Dict[str, Union[Alert, AlertCallbackType]]] = {
ET.NO_ENTRY: NoEntryAlert("LKAS Disabled"), ET.NO_ENTRY: NoEntryAlert("LKAS Disabled"),
}, },
EventName.vehicleSensorsInvalid: {
ET.IMMEDIATE_DISABLE: ImmediateDisableAlert("Vehicle Sensors Invalid"),
ET.PERMANENT: NormalPermanentAlert("Vehicle Sensors Calibrating", "Drive to Calibrate"),
ET.NO_ENTRY: NoEntryAlert("Vehicle Sensors Calibrating"),
},
} }

Loading…
Cancel
Save