From 8e2037651e51ac63f4e92dfd65e416241b8cf9be Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Mon, 26 Aug 2024 21:47:18 -0700 Subject: [PATCH] GM: implement allow throttle/brakes (#1185) implement allow gnb for GM --- opendbc/car/gm/carcontroller.py | 5 ++++- opendbc/car/structs.py | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/opendbc/car/gm/carcontroller.py b/opendbc/car/gm/carcontroller.py index 0d006f8673..77f4ac9cde 100644 --- a/opendbc/car/gm/carcontroller.py +++ b/opendbc/car/gm/carcontroller.py @@ -94,9 +94,12 @@ def update(self, CC, CS, now_nanos): self.apply_brake = int(round(interp(actuators.accel, self.params.BRAKE_LOOKUP_BP, self.params.BRAKE_LOOKUP_V))) # Don't allow any gas above inactive regen while stopping # FIXME: brakes aren't applied immediately when enabling at a stop - if stopping: + if stopping or not actuators.allowThrottle: self.apply_gas = self.params.INACTIVE_REGEN + if not actuators.allowBrake: + self.apply_brake = 0 + idx = (self.frame // 4) % 4 at_full_stop = CC.longActive and CS.out.standstill diff --git a/opendbc/car/structs.py b/opendbc/car/structs.py index c375468353..c5a7dfa72b 100644 --- a/opendbc/car/structs.py +++ b/opendbc/car/structs.py @@ -220,6 +220,9 @@ class Actuators: steerOutputCan: float = auto_field() steeringAngleDeg: float = auto_field() + allowBrake: bool = auto_field() + allowThrottle: bool = auto_field() + curvature: float = auto_field() speed: float = auto_field() # m/s