From 5c7d505270f28304ca76053484495c77506a4dd3 Mon Sep 17 00:00:00 2001 From: Thomas Helms Date: Wed, 25 Jul 2018 07:39:14 -0700 Subject: [PATCH 1/3] at_full_stop is actually want_full_stop --- selfdrive/car/gm/carcontroller.py | 8 ++++---- selfdrive/car/gm/gmcan.py | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/selfdrive/car/gm/carcontroller.py b/selfdrive/car/gm/carcontroller.py index d3c8ee1967308d..37b138b87798b5 100644 --- a/selfdrive/car/gm/carcontroller.py +++ b/selfdrive/car/gm/carcontroller.py @@ -141,12 +141,12 @@ 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 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)) + want_full_stop = enabled and CS.standstill + 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. From e83de3389bb4ff3e24c50448e213ee8dc80ab586 Mon Sep 17 00:00:00 2001 From: Thomas Helms Date: Wed, 25 Jul 2018 07:40:14 -0700 Subject: [PATCH 2/3] Volt: Only request full stop when we need it. Need to release when we wanna go --- selfdrive/car/gm/carcontroller.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/selfdrive/car/gm/carcontroller.py b/selfdrive/car/gm/carcontroller.py index 37b138b87798b5..915732eb6b732c 100644 --- a/selfdrive/car/gm/carcontroller.py +++ b/selfdrive/car/gm/carcontroller.py @@ -141,11 +141,10 @@ def update(self, sendcan, enabled, CS, frame, actuators, \ if (frame % 4) == 0: idx = (frame / 4) % 4 - want_full_stop = enabled and CS.standstill + want_full_stop = enabled and CS.standstill and apply_gas < 1 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, want_full_stop)) - want_full_stop = enabled and CS.standstill 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 From a9732ece24ea1c23a0675efc202c84e4f92734a2 Mon Sep 17 00:00:00 2001 From: Jamezz Date: Sat, 28 Jul 2018 15:53:25 -0700 Subject: [PATCH 3/3] Only release when acceleration is less than ZERO_GAS --- selfdrive/car/gm/carcontroller.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/gm/carcontroller.py b/selfdrive/car/gm/carcontroller.py index 915732eb6b732c..1cfb79c00295ad 100644 --- a/selfdrive/car/gm/carcontroller.py +++ b/selfdrive/car/gm/carcontroller.py @@ -141,7 +141,7 @@ def update(self, sendcan, enabled, CS, frame, actuators, \ if (frame % 4) == 0: idx = (frame / 4) % 4 - want_full_stop = enabled and CS.standstill and apply_gas < 1 + 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, want_full_stop))