Skip to content

Commit

Permalink
Try brake hack for DoA, remove accEnabled cancellation logic
Browse files Browse the repository at this point in the history
  • Loading branch information
carleeno committed Aug 7, 2024
1 parent 534de90 commit 7de7600
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion selfdrive/car/tesla/carcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def update(self, CC, CS, now_nanos):
can_sends.append(self.tesla_can.create_steering_control(apply_angle, lkas_enabled, (self.frame // 2) % 16, use_lka_mode))


self.pcm_cancel_cmd = CC.cruiseControl.cancel or not CS.accEnabled or self.pcm_cancel_cmd
self.pcm_cancel_cmd = CC.cruiseControl.cancel or self.pcm_cancel_cmd

if not self.virtual_blending:
# Cancel on user steering override when blending and MADS are disabled
Expand Down
8 changes: 3 additions & 5 deletions selfdrive/car/tesla/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,10 @@ def _update(self, c):

self.CS.accEnabled = ret.cruiseState.enabled # ACC state is controlled by the car itself

if not self.CP.pcmCruise or (self.CP.pcmCruise and self.CP.minEnableSpeed > 0) or not self.CP.pcmCruiseSpeed:
if any(b.type == ButtonType.cancel for b in self.CS.button_events):
self.CS.madsEnabled, self.CS.accEnabled = self.get_sp_cancel_cruise_state(self.CS.madsEnabled)
if self.get_sp_pedal_disengage(ret):
self.CS.madsEnabled, self.CS.accEnabled = self.get_sp_cancel_cruise_state(self.CS.madsEnabled)
ret.cruiseState.enabled = ret.cruiseState.enabled if not self.enable_mads else False if self.CP.pcmCruise else self.CS.accEnabled
self.CS.madsEnabled, _ = self.get_sp_cancel_cruise_state(self.CS.madsEnabled)
# TEMP HACK: trying to find a way to set CC.cruiseControl.cancel
ret.brakePressed = True

ret, self.CS = self.get_sp_common_state(ret, self.CS)

Expand Down

0 comments on commit 7de7600

Please sign in to comment.