[controlsd] Refactor apply_deadzone in Lateral Torque Control (#26626)

rename apply_slack to apply_center_deadzone, remove unused prius offline values
pull/26625/head^2
Vivek Aithal 2 years ago committed by GitHub
parent 860f441e2f
commit 3a4f19f0ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      selfdrive/car/interfaces.py
  2. 1
      selfdrive/car/torque_data/params.yaml
  3. 2
      selfdrive/controls/lib/drive_helpers.py

@ -11,7 +11,7 @@ from common.kalman.simple_kalman import KF1D
from common.numpy_fast import interp
from common.realtime import DT_CTRL
from selfdrive.car import apply_hysteresis, gen_empty_fingerprint, scale_rot_inertia
from selfdrive.controls.lib.drive_helpers import V_CRUISE_MAX, apply_slack
from selfdrive.controls.lib.drive_helpers import V_CRUISE_MAX, apply_center_deadzone
from selfdrive.controls.lib.events import Events
from selfdrive.controls.lib.vehicle_model import VehicleModel
@ -127,7 +127,7 @@ class CarInterfaceBase(ABC):
def torque_from_lateral_accel_linear(lateral_accel_value, torque_params, lateral_accel_error, lateral_accel_deadzone, friction_compensation):
# The default is a linear relationship between torque and lateral acceleration (accounting for road roll and steering friction)
friction_interp = interp(
apply_slack(lateral_accel_error, lateral_accel_deadzone),
apply_center_deadzone(lateral_accel_error, lateral_accel_deadzone),
[-FRICTION_THRESHOLD, FRICTION_THRESHOLD],
[-torque_params.friction, torque_params.friction]
)

@ -78,7 +78,6 @@ TOYOTA HIGHLANDER HYBRID 2018: [1.752033, 1.6433903296845025, 0.144600]
TOYOTA HIGHLANDER HYBRID 2020: [1.901174, 2.104015182965606, 0.14447040132184993]
TOYOTA MIRAI 2021: [2.506899832157829, 1.7417213930750164, 0.20182618449440565]
TOYOTA PRIUS 2017: [1.60, 1.5023147650693636, 0.151515]
TOYOTA PRIUS 2017 x060: [1.746445, 1.5023147650693636, 0.17]
TOYOTA PRIUS TSS2 2021: [1.972600, 1.9104337425537743, 0.170968]
TOYOTA RAV4 2017: [2.085695074355425, 2.2142832316984733, 0.13339165270103975]
TOYOTA RAV4 2019: [2.331293, 2.0993589721530252, 0.129822]

@ -149,7 +149,7 @@ def apply_deadzone(error, deadzone):
return error
def apply_slack(error, deadzone):
def apply_center_deadzone(error, deadzone):
if (error > - deadzone) and (error < deadzone):
error = 0.
return error

Loading…
Cancel
Save