Skip to content

Commit

Permalink
GM: implement allow throttle/brakes (commaai#1185)
Browse files Browse the repository at this point in the history
implement allow gnb for GM
  • Loading branch information
sshane authored Aug 27, 2024
1 parent 46790af commit 8e20376
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion opendbc/car/gm/carcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions opendbc/car/structs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8e20376

Please sign in to comment.