mirror of
https://github.com/infiniteCable2/opendbc.git
synced 2026-06-08 10:54:51 +08:00
Nissan: fix driver override fault by winding down torque more (#3407)
* see if fix * add ego accel * add ego accel * add stock dm * revert * clean up * simple * param it
This commit is contained in:
@@ -37,12 +37,11 @@ class CarController(CarControllerBase):
|
||||
if not bool(CS.out.steeringPressed):
|
||||
lkas_max_torque = CarControllerParams.LKAS_MAX_TORQUE
|
||||
else:
|
||||
# Scale max torque based on how much torque the driver is applying to the wheel
|
||||
# Scale max torque based on how much torque the driver is applying to the wheel.
|
||||
# Start scaling torque at STEER_THRESHOLD down to 0.2. If we don't scale this low, EPS will temp fault from high driver and LKAS torque
|
||||
lkas_max_torque = max(
|
||||
# Scale max torque down to half LKAX_MAX_TORQUE as a minimum
|
||||
CarControllerParams.LKAS_MAX_TORQUE * 0.5,
|
||||
# Start scaling torque at STEER_THRESHOLD
|
||||
CarControllerParams.LKAS_MAX_TORQUE - 0.6 * max(0, abs(CS.out.steeringTorque) - CarControllerParams.STEER_THRESHOLD)
|
||||
CarControllerParams.LKAS_MIN_TORQUE,
|
||||
CarControllerParams.LKAS_MAX_TORQUE - 0.6 * max(0, abs(CS.out.steeringTorque) - CarControllerParams.STEER_THRESHOLD),
|
||||
)
|
||||
|
||||
if self.CP.carFingerprint in (CAR.NISSAN_ROGUE, CAR.NISSAN_XTRAIL, CAR.NISSAN_ALTIMA) and pcm_cancel_cmd:
|
||||
|
||||
@@ -19,6 +19,7 @@ class CarControllerParams:
|
||||
([0., 5., 15.], [5., 3.5, 0.4]),
|
||||
)
|
||||
|
||||
LKAS_MIN_TORQUE = 0.2 # Adequate torque when overriding without faulting
|
||||
LKAS_MAX_TORQUE = 1 # A value of 1 is easy to overpower
|
||||
STEER_THRESHOLD = 1.0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user