Toyota: only send gas interceptor message when openpilot controls longitudinal (#23357)

* Toyota: gate enableGasInterceptor behind openpilotLongitudinalControl

* fix carcontroller typo

* Revert "Toyota: gate enableGasInterceptor behind openpilotLongitudinalControl"

This reverts commit a974e8f8cf.

* put condition in carcontroller

* gate building can messages

Co-authored-by: Willem Melching <willem.melching@gmail.com>
old-commit-hash: a6aa094461
commatwo_master
cydia2020 4 years ago committed by GitHub
parent 10ce89d1ae
commit 733a139646
  1. 4
      selfdrive/car/toyota/carcontroller.py

@ -89,7 +89,7 @@ class CarController():
# we can spam can to cancel the system even if we are using lat only control
if (frame % 3 == 0 and CS.CP.openpilotLongitudinalControl) or pcm_cancel_cmd:
lead = lead or CS.out.vEgo < 12. # at low speed we always assume the lead is present do ACC can be engaged
lead = lead or CS.out.vEgo < 12. # at low speed we always assume the lead is present so ACC can be engaged
# Lexus IS uses a different cancellation message
if pcm_cancel_cmd and CS.CP.carFingerprint in [CAR.LEXUS_IS, CAR.LEXUS_RC]:
@ -100,7 +100,7 @@ class CarController():
else:
can_sends.append(create_accel_command(self.packer, 0, pcm_cancel_cmd, False, lead, CS.acc_type))
if frame % 2 == 0 and CS.CP.enableGasInterceptor:
if frame % 2 == 0 and CS.CP.enableGasInterceptor and CS.CP.openpilotLongitudinalControl:
# send exactly zero if gas cmd is zero. Interceptor will send the max between read value and gas cmd.
# This prevents unexpected pedal range rescaling
can_sends.append(create_gas_interceptor_command(self.packer, interceptor_gas_cmd, frame // 2))

Loading…
Cancel
Save