Skip to content

Commit

Permalink
controls: only send cruise cancel while cruise is enabled (commaai#22359
Browse files Browse the repository at this point in the history
)

* controls: only send cruise cancel while cruise is enabled

* cleanup

* might actually do something

* update refs

* update refs again

* update refs
  • Loading branch information
adeebshihadeh authored Sep 28, 2021
1 parent d95641a commit 3b8fa4b
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 12 deletions.
9 changes: 0 additions & 9 deletions selfdrive/car/honda/carcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,6 @@ def update(self, enabled, CS, frame, actuators, pcm_cancel_cmd,
# *** apply brake hysteresis ***
pre_limit_brake, self.braking, self.brake_steady = actuator_hystereses(brake, self.braking, self.brake_steady, CS.out.vEgo, CS.CP.carFingerprint)

# *** no output if not enabled ***
if not enabled and CS.out.cruiseState.enabled:
# send pcm acc cancel cmd if drive is disabled but pcm is still on, or if the system can't be activated
pcm_cancel_cmd = True

# Never send cancel command if we never enter cruise state (no cruise if pedal)
# Cancel cmd causes brakes to release at a standstill causing grinding
pcm_cancel_cmd = pcm_cancel_cmd and CS.CP.pcmCruise

# *** rate limit after the enable check ***
self.brake_last = rate_limit(pre_limit_brake, self.brake_last, -2., DT_CTRL)

Expand Down
3 changes: 2 additions & 1 deletion selfdrive/car/toyota/carcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@ def update(self, enabled, CS, frame, actuators, pcm_cancel_cmd, hud_alert,
else:
apply_steer_req = 1

# TODO: probably can delete this. CS.pcm_acc_status uses a different signal
# than CS.cruiseState.enabled. confirm they're not meaningfully different
if not enabled and CS.pcm_acc_status:
# send pcm acc cancel cmd if drive is disabled but pcm is still on, or if the system can't be activated
pcm_cancel_cmd = 1

# on entering standstill, send standstill request
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/controls/controlsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ def publish_logs(self, CS, start_time, actuators, lac_log):
CC.enabled = self.enabled
CC.actuators = actuators

CC.cruiseControl.cancel = not self.CP.pcmCruise or (not self.enabled and CS.cruiseState.enabled)
CC.cruiseControl.cancel = CS.cruiseState.enabled and (not self.enabled or not self.CP.pcmCruise)
if self.joystick_mode and self.sm.rcv_frame['testJoystick'] > 0 and self.sm['testJoystick'].buttons[0]:
CC.cruiseControl.cancel = True

Expand Down
2 changes: 1 addition & 1 deletion selfdrive/test/process_replay/ref_commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2282e3f208438237fe61d7bf636d6ad6b507c571
859486fc7698fc2c0de0b52854a38e6c08954204

0 comments on commit 3b8fa4b

Please sign in to comment.