NNLC: fix friction not being applied to error (#1113)

* params: fix type

* NNLC: fix friction not being applied to error

* another PR

* apply suggestions

* lint
This commit is contained in:
Jason Wen
2025-08-09 16:56:37 -04:00
committed by GitHub
parent 6ae668e987
commit 6ef386da3d
@@ -8,7 +8,7 @@ from collections import deque
import math
import numpy as np
from opendbc.car.interfaces import LatControlInputs
from opendbc.car import FRICTION_THRESHOLD, get_friction
from openpilot.common.filter_simple import FirstOrderFilter
from openpilot.common.params import Params
from openpilot.selfdrive.modeld.constants import ModelConstants
@@ -126,7 +126,5 @@ class NeuralNetworkLateralControl(LatControlTorqueExtBase):
self._ff = self.model.evaluate(nn_input)
# apply friction override for cars with low NN friction response
# TODO-SP: verify with twilsonco if this change is appropriate
if self.model.friction_override:
self._pid_log.error += self.torque_from_lateral_accel(LatControlInputs(0.0, 0.0, CS.vEgo, CS.aEgo), self.torque_params,
gravity_adjusted=False)
self._pid_log.error += get_friction(friction_input, self._lateral_accel_deadzone, FRICTION_THRESHOLD, self.torque_params)