diff --git a/selfdrive/car/gm/carcontroller.py b/selfdrive/car/gm/carcontroller.py index d3c8ee1967308d..1cfb79c00295ad 100644 --- a/selfdrive/car/gm/carcontroller.py +++ b/selfdrive/car/gm/carcontroller.py @@ -141,12 +141,11 @@ def update(self, sendcan, enabled, CS, frame, actuators, \ if (frame % 4) == 0: idx = (frame / 4) % 4 - at_full_stop = enabled and CS.standstill + want_full_stop = enabled and CS.standstill and apply_gas < P.ZERO_GAS near_stop = enabled and (CS.v_ego < P.NEAR_STOP_BRAKE_PHASE) - can_sends.append(gmcan.create_friction_brake_command(self.packer_ch, canbus.chassis, apply_brake, idx, near_stop, at_full_stop)) + can_sends.append(gmcan.create_friction_brake_command(self.packer_ch, canbus.chassis, apply_brake, idx, near_stop, want_full_stop)) - at_full_stop = enabled and CS.standstill - can_sends.append(gmcan.create_gas_regen_command(self.packer_pt, canbus.powertrain, apply_gas, idx, enabled, at_full_stop)) + can_sends.append(gmcan.create_gas_regen_command(self.packer_pt, canbus.powertrain, apply_gas, idx, enabled, want_full_stop)) # Send dashboard UI commands (ACC status), 25hz if (frame % 4) == 0: diff --git a/selfdrive/car/gm/gmcan.py b/selfdrive/car/gm/gmcan.py index 0c84df422f9031..bd285397801923 100644 --- a/selfdrive/car/gm/gmcan.py +++ b/selfdrive/car/gm/gmcan.py @@ -39,13 +39,13 @@ def create_adas_keepalive(bus): dat = "\x00\x00\x00\x00\x00\x00\x00" return [[0x409, 0, dat, bus], [0x40a, 0, dat, bus]] -def create_gas_regen_command(packer, bus, throttle, idx, acc_engaged, at_full_stop): +def create_gas_regen_command(packer, bus, throttle, idx, acc_engaged, want_full_stop): values = { "GasRegenCmdActive": acc_engaged, "RollingCounter": idx, "GasRegenCmdActiveInv": 1 - acc_engaged, "GasRegenCmd": throttle, - "GasRegenFullStopActive": at_full_stop, + "GasRegenFullStopActive": want_full_stop, "GasRegenAlwaysOne": 1, "GasRegenAlwaysOne2": 1, "GasRegenAlwaysOne3": 1, @@ -58,14 +58,14 @@ def create_gas_regen_command(packer, bus, throttle, idx, acc_engaged, at_full_st return packer.make_can_msg("ASCMGasRegenCmd", bus, values) -def create_friction_brake_command(packer, bus, apply_brake, idx, near_stop, at_full_stop): +def create_friction_brake_command(packer, bus, apply_brake, idx, near_stop, want_full_stop): if apply_brake == 0: mode = 0x1 else: mode = 0xa - if at_full_stop: + if want_full_stop: mode = 0xd # TODO: this is to have GM bringing the car to complete stop, # but currently it conflicts with OP controls, so turned off.