Subaru Pre-Global: Rename ES_CruiseThrottle to ES_Distance (#23024)

* Rename preglobal ES_CruiseThrottle to ES_Distance

* bump opendbc

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
pull/23103/head^2
martinl 4 years ago committed by GitHub
parent b27a19e9d1
commit 345fe48338
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      opendbc
  2. 7
      selfdrive/car/subaru/carcontroller.py
  3. 41
      selfdrive/car/subaru/carstate.py
  4. 8
      selfdrive/car/subaru/subarucan.py

@ -1 +1 @@
Subproject commit 61534fd13162d714432c5685f2c59fafe7a96823 Subproject commit 2bab99fd861786312bde676823e21d80eeeb01fa

@ -8,7 +8,6 @@ class CarController():
def __init__(self, dbc_name, CP, VM): def __init__(self, dbc_name, CP, VM):
self.apply_steer_last = 0 self.apply_steer_last = 0
self.es_distance_cnt = -1 self.es_distance_cnt = -1
self.es_accel_cnt = -1
self.es_lkas_cnt = -1 self.es_lkas_cnt = -1
self.cruise_button_prev = 0 self.cruise_button_prev = 0
self.steer_rate_limited = False self.steer_rate_limited = False
@ -44,7 +43,7 @@ class CarController():
# *** alerts and pcm cancel *** # *** alerts and pcm cancel ***
if CS.CP.carFingerprint in PREGLOBAL_CARS: if CS.CP.carFingerprint in PREGLOBAL_CARS:
if self.es_accel_cnt != CS.es_accel_msg["Counter"]: if self.es_distance_cnt != CS.es_distance_msg["Counter"]:
# 1 = main, 2 = set shallow, 3 = set deep, 4 = resume shallow, 5 = resume deep # 1 = main, 2 = set shallow, 3 = set deep, 4 = resume shallow, 5 = resume deep
# disengage ACC when OP is disengaged # disengage ACC when OP is disengaged
if pcm_cancel_cmd: if pcm_cancel_cmd:
@ -60,8 +59,8 @@ class CarController():
cruise_button = 0 cruise_button = 0
self.cruise_button_prev = cruise_button self.cruise_button_prev = cruise_button
can_sends.append(subarucan.create_es_throttle_control(self.packer, cruise_button, CS.es_accel_msg)) can_sends.append(subarucan.create_preglobal_es_distance(self.packer, cruise_button, CS.es_distance_msg))
self.es_accel_cnt = CS.es_accel_msg["Counter"] self.es_distance_cnt = CS.es_distance_msg["Counter"]
else: else:
if self.es_distance_cnt != CS.es_distance_msg["Counter"]: if self.es_distance_cnt != CS.es_distance_msg["Counter"]:

@ -65,14 +65,13 @@ class CarState(CarStateBase):
ret.steerError = cp.vl["Steering_Torque"]["Steer_Error_1"] == 1 ret.steerError = cp.vl["Steering_Torque"]["Steer_Error_1"] == 1
if self.car_fingerprint in PREGLOBAL_CARS: if self.car_fingerprint in PREGLOBAL_CARS:
self.cruise_button = cp_cam.vl["ES_CruiseThrottle"]["Cruise_Button"] self.cruise_button = cp_cam.vl["ES_Distance"]["Cruise_Button"]
self.ready = not cp_cam.vl["ES_DashStatus"]["Not_Ready_Startup"] self.ready = not cp_cam.vl["ES_DashStatus"]["Not_Ready_Startup"]
self.es_accel_msg = copy.copy(cp_cam.vl["ES_CruiseThrottle"])
else: else:
ret.steerWarning = cp.vl["Steering_Torque"]["Steer_Warning"] == 1 ret.steerWarning = cp.vl["Steering_Torque"]["Steer_Warning"] == 1
ret.cruiseState.nonAdaptive = cp_cam.vl["ES_DashStatus"]["Conventional_Cruise"] == 1 ret.cruiseState.nonAdaptive = cp_cam.vl["ES_DashStatus"]["Conventional_Cruise"] == 1
self.es_distance_msg = copy.copy(cp_cam.vl["ES_Distance"])
self.es_lkas_msg = copy.copy(cp_cam.vl["ES_LKAS_State"]) self.es_lkas_msg = copy.copy(cp_cam.vl["ES_LKAS_State"])
self.es_distance_msg = copy.copy(cp_cam.vl["ES_Distance"])
return ret return ret
@ -168,28 +167,28 @@ class CarState(CarStateBase):
("Cruise_Set_Speed", "ES_DashStatus", 0), ("Cruise_Set_Speed", "ES_DashStatus", 0),
("Not_Ready_Startup", "ES_DashStatus", 0), ("Not_Ready_Startup", "ES_DashStatus", 0),
("Throttle_Cruise", "ES_CruiseThrottle", 0), ("Cruise_Throttle", "ES_Distance", 0),
("Signal1", "ES_CruiseThrottle", 0), ("Signal1", "ES_Distance", 0),
("Cruise_Activated", "ES_CruiseThrottle", 0), ("Car_Follow", "ES_Distance", 0),
("Signal2", "ES_CruiseThrottle", 0), ("Signal2", "ES_Distance", 0),
("Brake_On", "ES_CruiseThrottle", 0), ("Brake_On", "ES_Distance", 0),
("Distance_Swap", "ES_CruiseThrottle", 0), ("Distance_Swap", "ES_Distance", 0),
("Standstill", "ES_CruiseThrottle", 0), ("Standstill", "ES_Distance", 0),
("Signal3", "ES_CruiseThrottle", 0), ("Signal3", "ES_Distance", 0),
("Close_Distance", "ES_CruiseThrottle", 0), ("Close_Distance", "ES_Distance", 0),
("Signal4", "ES_CruiseThrottle", 0), ("Signal4", "ES_Distance", 0),
("Standstill_2", "ES_CruiseThrottle", 0), ("Standstill_2", "ES_Distance", 0),
("Cruise_Fault", "ES_CruiseThrottle", 0), ("Cruise_Fault", "ES_Distance", 0),
("Signal5", "ES_CruiseThrottle", 0), ("Signal5", "ES_Distance", 0),
("Counter", "ES_CruiseThrottle", 0), ("Counter", "ES_Distance", 0),
("Signal6", "ES_CruiseThrottle", 0), ("Signal6", "ES_Distance", 0),
("Cruise_Button", "ES_CruiseThrottle", 0), ("Cruise_Button", "ES_Distance", 0),
("Signal7", "ES_CruiseThrottle", 0), ("Signal7", "ES_Distance", 0),
] ]
checks = [ checks = [
("ES_DashStatus", 20), ("ES_DashStatus", 20),
("ES_CruiseThrottle", 20), ("ES_Distance", 20),
] ]
else: else:
signals = [ signals = [

@ -80,11 +80,11 @@ def create_preglobal_steering_control(packer, apply_steer, frame, steer_step):
return packer.make_can_msg("ES_LKAS", 0, values) return packer.make_can_msg("ES_LKAS", 0, values)
def create_es_throttle_control(packer, cruise_button, es_accel_msg): def create_preglobal_es_distance(packer, cruise_button, es_distance_msg):
values = copy.copy(es_accel_msg) values = copy.copy(es_distance_msg)
values["Cruise_Button"] = cruise_button values["Cruise_Button"] = cruise_button
values["Checksum"] = subaru_preglobal_checksum(packer, values, "ES_CruiseThrottle") values["Checksum"] = subaru_preglobal_checksum(packer, values, "ES_Distance")
return packer.make_can_msg("ES_CruiseThrottle", 0, values) return packer.make_can_msg("ES_Distance", 0, values)

Loading…
Cancel
Save