Skip to content

Commit c9dd7fe

Browse files
AlexHillrbiasini
authored andcommitted
Add initial support for Holden/Opel Astra BK (#431)
1 parent e32463e commit c9dd7fe

File tree

5 files changed

+36
-13
lines changed

5 files changed

+36
-13
lines changed

selfdrive/car/gm/carcontroller.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
class CarControllerParams():
1212
def __init__(self, car_fingerprint):
13-
if car_fingerprint in (CAR.VOLT, CAR.MALIBU):
13+
if car_fingerprint in (CAR.VOLT, CAR.MALIBU, CAR.HOLDEN_ASTRA):
1414
self.STEER_MAX = 300
1515
self.STEER_STEP = 2 # how often we update the steer cmd
1616
self.STEER_DELTA_UP = 7 # ~0.75s time to peak torque (255/50hz/0.75s)
@@ -104,7 +104,7 @@ def update(self, sendcan, enabled, CS, frame, actuators, \
104104
self.apply_steer_last = apply_steer
105105
idx = (frame / P.STEER_STEP) % 4
106106

107-
if self.car_fingerprint in (CAR.VOLT, CAR.MALIBU):
107+
if self.car_fingerprint in (CAR.VOLT, CAR.MALIBU, CAR.HOLDEN_ASTRA):
108108
can_sends.append(gmcan.create_steering_control(self.packer_pt,
109109
canbus.powertrain, apply_steer, idx, lkas_enabled))
110110
if self.car_fingerprint == CAR.CADILLAC_CT6:
@@ -113,7 +113,7 @@ def update(self, sendcan, enabled, CS, frame, actuators, \
113113

114114
### GAS/BRAKE ###
115115

116-
if self.car_fingerprint in (CAR.VOLT, CAR.MALIBU):
116+
if self.car_fingerprint in (CAR.VOLT, CAR.MALIBU, CAR.HOLDEN_ASTRA):
117117
# no output if not enabled, but keep sending keepalive messages
118118
# treat pedals as one
119119
final_pedal = actuators.gas - actuators.brake

selfdrive/car/gm/carstate.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,15 @@ def get_powertrain_can_parser(CP, canbus):
3434
if CP.carFingerprint in (CAR.VOLT, CAR.MALIBU):
3535
signals += [
3636
("RegenPaddle", "EBCMRegenPaddle", 0),
37+
]
38+
if CP.carFingerprint in (CAR.VOLT, CAR.MALIBU, CAR.HOLDEN_ASTRA):
39+
signals += [
3740
("TractionControlOn", "ESPStatus", 0),
3841
("EPBClosed", "EPBStatus", 0),
3942
("CruiseMainOn", "ECMEngineStatus", 0),
4043
("CruiseState", "AcceleratorPedal2", 0),
4144
]
42-
elif CP.carFingerprint == CAR.CADILLAC_CT6:
45+
if CP.carFingerprint == CAR.CADILLAC_CT6:
4346
signals += [
4447
("ACCCmdActive", "ASCMActiveCruiseControlStatus", 0)
4548
]
@@ -117,14 +120,17 @@ def update(self, pt_cp):
117120
self.left_blinker_on = pt_cp.vl["BCMTurnSignals"]['TurnSignals'] == 1
118121
self.right_blinker_on = pt_cp.vl["BCMTurnSignals"]['TurnSignals'] == 2
119122

120-
if self.car_fingerprint in (CAR.VOLT, CAR.MALIBU):
123+
if self.car_fingerprint in (CAR.VOLT, CAR.MALIBU, CAR.HOLDEN_ASTRA):
121124
self.park_brake = pt_cp.vl["EPBStatus"]['EPBClosed']
122125
self.main_on = pt_cp.vl["ECMEngineStatus"]['CruiseMainOn']
123126
self.acc_active = False
124127
self.esp_disabled = pt_cp.vl["ESPStatus"]['TractionControlOn'] != 1
125-
self.regen_pressed = bool(pt_cp.vl["EBCMRegenPaddle"]['RegenPaddle'])
126128
self.pcm_acc_status = pt_cp.vl["AcceleratorPedal2"]['CruiseState']
127-
else:
129+
if self.car_fingerprint in (CAR.VOLT, CAR.MALIBU):
130+
self.regen_pressed = bool(pt_cp.vl["EBCMRegenPaddle"]['RegenPaddle'])
131+
else:
132+
self.regen_pressed = False
133+
if self.car_fingerprint == CAR.CADILLAC_CT6:
128134
self.park_brake = False
129135
self.main_on = False
130136
self.acc_active = pt_cp.vl["ASCMActiveCruiseControlStatus"]['ACCCmdActive']

selfdrive/car/gm/interface.py

+14-4
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def get_params(candidate, fingerprint):
6868
if candidate == CAR.VOLT:
6969
# supports stop and go, but initial engage must be above 18mph (which include conservatism)
7070
ret.minEnableSpeed = 18 * CV.MPH_TO_MS
71-
# kg of standard extra cargo to count for drive, gas, etc...
71+
# kg of standard extra cargo to count for driver, gas, etc...
7272
ret.mass = 1607 + std_cargo
7373
ret.safetyModel = car.CarParams.SafetyModels.gm
7474
ret.wheelbase = 2.69
@@ -86,10 +86,21 @@ def get_params(candidate, fingerprint):
8686
ret.steerRatioRear = 0.
8787
ret.centerToFront = ret.wheelbase * 0.4 # wild guess
8888

89+
elif candidate == CAR.HOLDEN_ASTRA:
90+
# kg of standard extra cargo to count for driver, gas, etc...
91+
ret.mass = 1363 + std_cargo
92+
ret.wheelbase = 2.662
93+
# Remaining parameters copied from Volt for now
94+
ret.centerToFront = ret.wheelbase * 0.4
95+
ret.minEnableSpeed = 18 * CV.MPH_TO_MS
96+
ret.safetyModel = car.CarParams.SafetyModels.gm
97+
ret.steerRatio = 15.7
98+
ret.steerRatioRear = 0.
99+
89100
elif candidate == CAR.CADILLAC_CT6:
90101
# engage speed is decided by pcm
91102
ret.minEnableSpeed = -1
92-
# kg of standard extra cargo to count for drive, gas, etc...
103+
# kg of standard extra cargo to count for driver, gas, etc...
93104
ret.mass = 4016. * CV.LB_TO_KG + std_cargo
94105
ret.safetyModel = car.CarParams.SafetyModels.cadillac
95106
ret.wheelbase = 3.11
@@ -255,8 +266,7 @@ def update(self, c):
255266
if ret.seatbeltUnlatched:
256267
events.append(create_event('seatbeltNotLatched', [ET.NO_ENTRY, ET.SOFT_DISABLE]))
257268

258-
if self.CS.car_fingerprint in (CAR.VOLT, CAR.MALIBU):
259-
269+
if self.CS.car_fingerprint in (CAR.VOLT, CAR.MALIBU, CAR.HOLDEN_ASTRA):
260270
if self.CS.brake_error:
261271
events.append(create_event('brakeUnavailable', [ET.NO_ENTRY, ET.IMMEDIATE_DISABLE, ET.PERMANENT]))
262272
if not self.CS.gear_shifter_valid:

selfdrive/car/gm/radar_interface.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
def create_radard_can_parser(canbus, car_fingerprint):
2323

2424
dbc_f = DBC[car_fingerprint]['radar']
25-
if car_fingerprint in (CAR.VOLT, CAR.MALIBU):
25+
if car_fingerprint in (CAR.VOLT, CAR.MALIBU, CAR.HOLDEN_ASTRA):
2626
# C1A-ARS3-A by Continental
2727
radar_targets = range(SLOT_1_MSG, SLOT_1_MSG + NUM_SLOTS)
2828
signals = zip(['FLRRNumValidTargets',

selfdrive/car/gm/values.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
AudibleAlert = car.CarControl.HUDControl.AudibleAlert
55

66
class CAR:
7+
HOLDEN_ASTRA = "HOLDEN ASTRA RS-V BK 2017"
78
VOLT = "CHEVROLET VOLT PREMIER 2017"
89
CADILLAC_CT6 = "CADILLAC CT6 SUPERCRUISE 2018"
910
MALIBU = "CHEVROLET MALIBU PREMIER 2017"
@@ -36,7 +37,7 @@ class CM:
3637

3738
def is_eps_status_ok(eps_status, car_fingerprint):
3839
valid_eps_status = []
39-
if car_fingerprint in (CAR.VOLT, CAR.MALIBU):
40+
if car_fingerprint in (CAR.VOLT, CAR.MALIBU, CAR.HOLDEN_ASTRA):
4041
valid_eps_status += [0, 1]
4142
elif car_fingerprint == CAR.CADILLAC_CT6:
4243
valid_eps_status += [0, 1, 4, 5, 6]
@@ -55,6 +56,10 @@ def parse_gear_shifter(can_gear):
5556
return car.CarState.GearShifter.unknown
5657

5758
FINGERPRINTS = {
59+
# Astra BK MY17, ASCM unplugged
60+
CAR.HOLDEN_ASTRA: [{
61+
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,
62+
}],
5863
CAR.VOLT: [
5964
# Volt Premier w/ ACC 2017
6065
{
@@ -77,12 +82,14 @@ def parse_gear_shifter(can_gear):
7782
STEER_THRESHOLD = 1.0
7883

7984
STOCK_CONTROL_MSGS = {
85+
CAR.HOLDEN_ASTRA: [384, 715],
8086
CAR.VOLT: [384, 715], # 384 = "ASCMLKASteeringCmd", 715 = "ASCMGasRegenCmd"
8187
CAR.MALIBU: [384, 715], # 384 = "ASCMLKASteeringCmd", 715 = "ASCMGasRegenCmd"
8288
CAR.CADILLAC_CT6: [], # Cadillac does not require ASCMs to be disconnected
8389
}
8490

8591
DBC = {
92+
CAR.HOLDEN_ASTRA: dbc_dict('gm_global_a_powertrain', 'gm_global_a_object', chassis_dbc='gm_global_a_chassis'),
8693
CAR.VOLT: dbc_dict('gm_global_a_powertrain', 'gm_global_a_object', chassis_dbc='gm_global_a_chassis'),
8794
CAR.MALIBU: dbc_dict('gm_global_a_powertrain', 'gm_global_a_object', chassis_dbc='gm_global_a_chassis'),
8895
CAR.CADILLAC_CT6: dbc_dict('cadillac_ct6_powertrain', 'cadillac_ct6_object', chassis_dbc='cadillac_ct6_chassis'),

0 commit comments

Comments
 (0)