diff --git a/selfdrive/car/gm/carcontroller.py b/selfdrive/car/gm/carcontroller.py index 14b165dc6a..5d86c0605b 100644 --- a/selfdrive/car/gm/carcontroller.py +++ b/selfdrive/car/gm/carcontroller.py @@ -10,7 +10,7 @@ from selfdrive.can.packer import CANPacker class CarControllerParams(): def __init__(self, car_fingerprint): - if car_fingerprint in (CAR.VOLT, CAR.MALIBU): + if car_fingerprint in (CAR.VOLT, CAR.MALIBU, CAR.HOLDEN_ASTRA): self.STEER_MAX = 300 self.STEER_STEP = 2 # how often we update the steer cmd self.STEER_DELTA_UP = 7 # ~0.75s time to peak torque (255/50hz/0.75s) @@ -104,7 +104,7 @@ class CarController(object): self.apply_steer_last = apply_steer idx = (frame / P.STEER_STEP) % 4 - if self.car_fingerprint in (CAR.VOLT, CAR.MALIBU): + if self.car_fingerprint in (CAR.VOLT, CAR.MALIBU, CAR.HOLDEN_ASTRA): can_sends.append(gmcan.create_steering_control(self.packer_pt, canbus.powertrain, apply_steer, idx, lkas_enabled)) if self.car_fingerprint == CAR.CADILLAC_CT6: @@ -113,7 +113,7 @@ class CarController(object): ### GAS/BRAKE ### - if self.car_fingerprint in (CAR.VOLT, CAR.MALIBU): + if self.car_fingerprint in (CAR.VOLT, CAR.MALIBU, CAR.HOLDEN_ASTRA): # no output if not enabled, but keep sending keepalive messages # treat pedals as one final_pedal = actuators.gas - actuators.brake diff --git a/selfdrive/car/gm/carstate.py b/selfdrive/car/gm/carstate.py index 6d5b3a9d50..94aa09c957 100644 --- a/selfdrive/car/gm/carstate.py +++ b/selfdrive/car/gm/carstate.py @@ -34,12 +34,15 @@ def get_powertrain_can_parser(CP, canbus): if CP.carFingerprint in (CAR.VOLT, CAR.MALIBU): signals += [ ("RegenPaddle", "EBCMRegenPaddle", 0), + ] + if CP.carFingerprint in (CAR.VOLT, CAR.MALIBU, CAR.HOLDEN_ASTRA): + signals += [ ("TractionControlOn", "ESPStatus", 0), ("EPBClosed", "EPBStatus", 0), ("CruiseMainOn", "ECMEngineStatus", 0), ("CruiseState", "AcceleratorPedal2", 0), ] - elif CP.carFingerprint == CAR.CADILLAC_CT6: + if CP.carFingerprint == CAR.CADILLAC_CT6: signals += [ ("ACCCmdActive", "ASCMActiveCruiseControlStatus", 0) ] @@ -117,14 +120,17 @@ class CarState(object): self.left_blinker_on = pt_cp.vl["BCMTurnSignals"]['TurnSignals'] == 1 self.right_blinker_on = pt_cp.vl["BCMTurnSignals"]['TurnSignals'] == 2 - if self.car_fingerprint in (CAR.VOLT, CAR.MALIBU): + if self.car_fingerprint in (CAR.VOLT, CAR.MALIBU, CAR.HOLDEN_ASTRA): self.park_brake = pt_cp.vl["EPBStatus"]['EPBClosed'] self.main_on = pt_cp.vl["ECMEngineStatus"]['CruiseMainOn'] self.acc_active = False self.esp_disabled = pt_cp.vl["ESPStatus"]['TractionControlOn'] != 1 - self.regen_pressed = bool(pt_cp.vl["EBCMRegenPaddle"]['RegenPaddle']) self.pcm_acc_status = pt_cp.vl["AcceleratorPedal2"]['CruiseState'] - else: + if self.car_fingerprint in (CAR.VOLT, CAR.MALIBU): + self.regen_pressed = bool(pt_cp.vl["EBCMRegenPaddle"]['RegenPaddle']) + else: + self.regen_pressed = False + if self.car_fingerprint == CAR.CADILLAC_CT6: self.park_brake = False self.main_on = False self.acc_active = pt_cp.vl["ASCMActiveCruiseControlStatus"]['ACCCmdActive'] diff --git a/selfdrive/car/gm/interface.py b/selfdrive/car/gm/interface.py index 9de3873818..f421f73dca 100755 --- a/selfdrive/car/gm/interface.py +++ b/selfdrive/car/gm/interface.py @@ -68,7 +68,7 @@ class CarInterface(object): if candidate == CAR.VOLT: # supports stop and go, but initial engage must be above 18mph (which include conservatism) ret.minEnableSpeed = 18 * CV.MPH_TO_MS - # kg of standard extra cargo to count for drive, gas, etc... + # kg of standard extra cargo to count for driver, gas, etc... ret.mass = 1607 + std_cargo ret.safetyModel = car.CarParams.SafetyModels.gm ret.wheelbase = 2.69 @@ -86,10 +86,21 @@ class CarInterface(object): ret.steerRatioRear = 0. ret.centerToFront = ret.wheelbase * 0.4 # wild guess + elif candidate == CAR.HOLDEN_ASTRA: + # kg of standard extra cargo to count for driver, gas, etc... + ret.mass = 1363 + std_cargo + ret.wheelbase = 2.662 + # Remaining parameters copied from Volt for now + ret.centerToFront = ret.wheelbase * 0.4 + ret.minEnableSpeed = 18 * CV.MPH_TO_MS + ret.safetyModel = car.CarParams.SafetyModels.gm + ret.steerRatio = 15.7 + ret.steerRatioRear = 0. + elif candidate == CAR.CADILLAC_CT6: # engage speed is decided by pcm ret.minEnableSpeed = -1 - # kg of standard extra cargo to count for drive, gas, etc... + # kg of standard extra cargo to count for driver, gas, etc... ret.mass = 4016. * CV.LB_TO_KG + std_cargo ret.safetyModel = car.CarParams.SafetyModels.cadillac ret.wheelbase = 3.11 @@ -255,8 +266,7 @@ class CarInterface(object): if ret.seatbeltUnlatched: events.append(create_event('seatbeltNotLatched', [ET.NO_ENTRY, ET.SOFT_DISABLE])) - if self.CS.car_fingerprint in (CAR.VOLT, CAR.MALIBU): - + if self.CS.car_fingerprint in (CAR.VOLT, CAR.MALIBU, CAR.HOLDEN_ASTRA): if self.CS.brake_error: events.append(create_event('brakeUnavailable', [ET.NO_ENTRY, ET.IMMEDIATE_DISABLE, ET.PERMANENT])) if not self.CS.gear_shifter_valid: diff --git a/selfdrive/car/gm/radar_interface.py b/selfdrive/car/gm/radar_interface.py index 8e564b1b92..56c2c7ca40 100755 --- a/selfdrive/car/gm/radar_interface.py +++ b/selfdrive/car/gm/radar_interface.py @@ -22,7 +22,7 @@ LAST_RADAR_MSG = RADAR_HEADER_MSG + NUM_SLOTS def create_radard_can_parser(canbus, car_fingerprint): dbc_f = DBC[car_fingerprint]['radar'] - if car_fingerprint in (CAR.VOLT, CAR.MALIBU): + if car_fingerprint in (CAR.VOLT, CAR.MALIBU, CAR.HOLDEN_ASTRA): # C1A-ARS3-A by Continental radar_targets = range(SLOT_1_MSG, SLOT_1_MSG + NUM_SLOTS) signals = zip(['FLRRNumValidTargets', diff --git a/selfdrive/car/gm/values.py b/selfdrive/car/gm/values.py index b4f8d90601..021c02ebef 100644 --- a/selfdrive/car/gm/values.py +++ b/selfdrive/car/gm/values.py @@ -4,6 +4,7 @@ from selfdrive.car import dbc_dict AudibleAlert = car.CarControl.HUDControl.AudibleAlert class CAR: + HOLDEN_ASTRA = "HOLDEN ASTRA RS-V BK 2017" VOLT = "CHEVROLET VOLT PREMIER 2017" CADILLAC_CT6 = "CADILLAC CT6 SUPERCRUISE 2018" MALIBU = "CHEVROLET MALIBU PREMIER 2017" @@ -36,7 +37,7 @@ AUDIO_HUD = { def is_eps_status_ok(eps_status, car_fingerprint): valid_eps_status = [] - if car_fingerprint in (CAR.VOLT, CAR.MALIBU): + if car_fingerprint in (CAR.VOLT, CAR.MALIBU, CAR.HOLDEN_ASTRA): valid_eps_status += [0, 1] elif car_fingerprint == CAR.CADILLAC_CT6: valid_eps_status += [0, 1, 4, 5, 6] @@ -55,6 +56,10 @@ def parse_gear_shifter(can_gear): return car.CarState.GearShifter.unknown FINGERPRINTS = { + # Astra BK MY17, ASCM unplugged + CAR.HOLDEN_ASTRA: [{ + 190: 8, 193: 8, 197: 8, 199: 4, 201: 8, 209: 7, 211: 8, 241: 6, 249: 8, 288: 5, 298: 8, 304: 1, 309: 8, 311: 8, 313: 8, 320: 3, 328: 1, 352: 5, 381: 6, 386: 8, 388: 8, 393: 8, 398: 8, 401: 8, 413: 8, 417: 8, 419: 8, 422: 1, 426: 7, 431: 8, 442: 8, 451: 8, 452: 8, 453: 8, 455: 7, 456: 8, 458: 5, 479: 8, 481: 7, 485: 8, 489: 8, 497: 8, 499: 3, 500: 8, 501: 8, 508: 8, 528: 5, 532: 6, 554: 3, 560: 8, 562: 8, 563: 5, 564: 5, 565: 5, 567: 5, 647: 5, 707: 8, 723: 8, 753: 5, 761: 7, 806: 1, 810: 8, 840: 5, 842: 5, 844: 8, 866: 4, 961: 8, 969: 8, 977: 8, 979: 8, 985: 5, 1001: 8, 1009: 8, 1011: 6, 1017: 8, 1019: 3, 1020: 8, 1105: 6, 1217: 8, 1221: 5, 1225: 8, 1233: 8, 1249: 8, 1257: 6, 1259: 8, 1261: 7, 1263: 4, 1265: 8, 1267: 8, 1280: 4, 1300: 8, 1328: 4, 1417: 8, 1906: 7, 1907: 7, 1908: 7, 1912: 7, 1919: 7, + }], CAR.VOLT: [ # Volt Premier w/ ACC 2017 { @@ -77,12 +82,14 @@ FINGERPRINTS = { STEER_THRESHOLD = 1.0 STOCK_CONTROL_MSGS = { + CAR.HOLDEN_ASTRA: [384, 715], CAR.VOLT: [384, 715], # 384 = "ASCMLKASteeringCmd", 715 = "ASCMGasRegenCmd" CAR.MALIBU: [384, 715], # 384 = "ASCMLKASteeringCmd", 715 = "ASCMGasRegenCmd" CAR.CADILLAC_CT6: [], # Cadillac does not require ASCMs to be disconnected } DBC = { + CAR.HOLDEN_ASTRA: dbc_dict('gm_global_a_powertrain', 'gm_global_a_object', chassis_dbc='gm_global_a_chassis'), CAR.VOLT: dbc_dict('gm_global_a_powertrain', 'gm_global_a_object', chassis_dbc='gm_global_a_chassis'), CAR.MALIBU: dbc_dict('gm_global_a_powertrain', 'gm_global_a_object', chassis_dbc='gm_global_a_chassis'), CAR.CADILLAC_CT6: dbc_dict('cadillac_ct6_powertrain', 'cadillac_ct6_object', chassis_dbc='cadillac_ct6_chassis'),