mirror of
https://github.com/MoreTore/openpilot.git
synced 2026-07-26 12:22:04 +08:00
fix ti command
This commit is contained in:
@@ -39,7 +39,7 @@ class CarController(CarControllerBase):
|
||||
if self.CP.flags & MazdaSafetyFlags.TORQUE_INTERCEPTOR:
|
||||
if CS.ti_lkas_allowed:
|
||||
ti_new_torque = int(round(CC.actuators.steer * self.ccp.STEER_MAX))
|
||||
ti_apply_torque = apply_driver_steer_torque_limits(ti_new_torque, self.ti_apply_steer_last,
|
||||
ti_apply_torque = apply_driver_steer_torque_limits(ti_new_torque, self.apply_torque_last,
|
||||
CS.out.steeringTorque, self.ccp)
|
||||
|
||||
self.apply_torque_last = apply_torque
|
||||
@@ -117,8 +117,9 @@ class CarController(CarControllerBase):
|
||||
|
||||
|
||||
# send steering command
|
||||
can_sends.extend(mazdacan.create_steering_control(self.packer, self.CP,
|
||||
self.frame, apply_torque, CS.cam_lkas))
|
||||
can_sends.extend(mazdacan.create_steering_control(
|
||||
self.packer, self.CP, self.frame, apply_torque, CS.cam_lkas,
|
||||
ti_apply_torque if CP.flags & MazdaSafetyFlags.TORQUE_INTERCEPTOR else None))
|
||||
|
||||
new_actuators = CC.actuators.as_builder()
|
||||
new_actuators.torque = apply_torque / self.ccp.STEER_MAX
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from opendbc.car.mazda.values import Buttons, MazdaSafetyFlags
|
||||
from numpy import clip
|
||||
|
||||
def create_steering_control(packer, CP, frame, apply_torque, lkas):
|
||||
def create_steering_control(packer, CP, frame, apply_torque, lkas, ti_apply_torque = None):
|
||||
msgs = []
|
||||
if CP.flags & MazdaSafetyFlags.GEN1:
|
||||
if not CP.flags & MazdaSafetyFlags.NO_FSC:
|
||||
@@ -60,10 +60,10 @@ def create_steering_control(packer, CP, frame, apply_torque, lkas):
|
||||
}
|
||||
msgs.append(packer.make_can_msg("CAM_LKAS", 0, values))
|
||||
|
||||
if CP.flags & MazdaSafetyFlags.TORQUE_INTERCEPTOR:
|
||||
if ti_apply_torque is not None:
|
||||
values = {
|
||||
"LKAS_REQUEST" : apply_torque,
|
||||
"CHKSUM" : apply_torque,
|
||||
"LKAS_REQUEST" : ti_apply_torque,
|
||||
"CHKSUM" : ti_apply_torque,
|
||||
"KEY" : 3294744160
|
||||
}
|
||||
msgs.append(packer.make_can_msg("CAM_LKAS2", 1, values))
|
||||
|
||||
Reference in New Issue
Block a user