@ -14,6 +14,7 @@ class CarState(CarStateBase):
self . shifter_values = can_define . dv [ " Getriebe_11 " ] [ " GE_Fahrstufe " ]
elif CP . transmissionType == TransmissionType . direct :
self . shifter_values = can_define . dv [ " EV_Gearshift " ] [ " GearPosition " ]
self . hca_status_values = can_define . dv [ " LH_EPS_03 " ] [ " EPS_HCA_Status " ]
self . buttonStates = BUTTON_STATES . copy ( )
def update ( self , pt_cp , cam_cp , trans_type ) :
@ -37,6 +38,11 @@ class CarState(CarStateBase):
ret . steeringPressed = abs ( ret . steeringTorque ) > CarControllerParams . STEER_DRIVER_ALLOWANCE
ret . yawRate = pt_cp . vl [ " ESP_02 " ] [ " ESP_Gierrate " ] * ( 1 , - 1 ) [ int ( pt_cp . vl [ " ESP_02 " ] [ " ESP_VZ_Gierrate " ] ) ] * CV . DEG_TO_RAD
# Verify EPS readiness to accept steering commands
hca_status = self . hca_status_values . get ( pt_cp . vl [ " LH_EPS_03 " ] [ " EPS_HCA_Status " ] )
ret . steerError = hca_status in [ " DISABLED " , " FAULT " ]
ret . steerWarning = hca_status in [ " INITIALIZING " , " REJECTED " ]
# Update gas, brakes, and gearshift.
ret . gas = pt_cp . vl [ " Motor_20 " ] [ " MO_Fahrpedalrohwert_01 " ] / 100.0
ret . gasPressed = ret . gas > 0
@ -141,10 +147,6 @@ class CarState(CarStateBase):
# later cruise-control button spamming.
self . graMsgBusCounter = pt_cp . vl [ " GRA_ACC_01 " ] [ " COUNTER " ]
# Check to make sure the electric power steering rack is configured to
# accept and respond to HCA_01 messages and has not encountered a fault.
self . steeringFault = not pt_cp . vl [ " LH_EPS_03 " ] [ " EPS_HCA_Status " ]
# Additional safety checks performed in CarInterface.
self . parkingBrakeSet = bool ( pt_cp . vl [ " Kombi_01 " ] [ " KBI_Handbremse " ] ) # FIXME: need to include an EPB check as well
ret . espDisabled = pt_cp . vl [ " ESP_21 " ] [ " ESP_Tastung_passiv " ] != 0
@ -181,7 +183,7 @@ class CarState(CarStateBase):
( " MO_Kuppl_schalter " , " Motor_14 " , 0 ) , # Clutch switch
( " EPS_Lenkmoment " , " LH_EPS_03 " , 0 ) , # Absolute driver torque input
( " EPS_VZ_Lenkmoment " , " LH_EPS_03 " , 0 ) , # Driver torque input sign
( " EPS_HCA_Status " , " LH_EPS_03 " , 0 ) , # Steering rack HCA support configured
( " EPS_HCA_Status " , " LH_EPS_03 " , 3 ) , # EPS HCA control status
( " ESP_Tastung_passiv " , " ESP_21 " , 0 ) , # Stability control disabled
( " KBI_MFA_v_Einheit_02 " , " Einheiten_01 " , 0 ) , # MPH vs KMH speed display
( " KBI_Handbremse " , " Kombi_01 " , 0 ) , # Manual handbrake applied