This commit is contained in:
Jason Wen
2025-03-17 18:51:25 -04:00
parent 8bb4e8b939
commit 360e252b43
2 changed files with 5 additions and 5 deletions
@@ -35,7 +35,7 @@ def get_lookahead_value(future_vals, current_val):
return min_val
class NeuralNetworkLateralControlBase:
class LatControlTorqueExtBase:
def __init__(self, lac_torque, CP):
self.model_v2 = None
self.model_valid = False
@@ -60,7 +60,7 @@ class NeuralNetworkLateralControlBase:
# Scaling the lateral acceleration "friction response" could be helpful for some.
# Increase for a stronger response, decrease for a weaker response.
self.lat_jerk_friction_factor = 0.4
self.lat_accel_friction_factor = 0.7 # in [0, 3], in 0.05 increments. 3 is arbitrary safety limit
self.lat_accel_friction_factor = 0.7 # in [0, 3], in 0.05 increments. 3 is arbitrary safety limit
# precompute time differences between ModelConstants.T_IDXS
self.t_diffs = np.diff(ModelConstants.T_IDXS)
@@ -32,7 +32,7 @@ from openpilot.common.params import Params
from openpilot.common.filter_simple import FirstOrderFilter
from openpilot.selfdrive.modeld.constants import ModelConstants
from openpilot.sunnypilot.selfdrive.controls.lib.nnlc.flux_model import FluxModel
from openpilot.sunnypilot.selfdrive.controls.lib.nnlc.nnlc_base import NeuralNetworkLateralControlBase
from openpilot.sunnypilot.selfdrive.controls.lib.latcontrol_torque_ext_base import LatControlTorqueExtBase
# At a given roll, if pitch magnitude increases, the
@@ -44,9 +44,9 @@ def roll_pitch_adjust(roll, pitch):
return roll * math.cos(pitch)
class NeuralNetworkLateralControl(NeuralNetworkLateralControlBase):
class NeuralNetworkLateralControl(LatControlTorqueExtBase):
def __init__(self, lac_torque, CP, CP_SP):
NeuralNetworkLateralControlBase.__init__(self, lac_torque, CP)
LatControlTorqueExtBase.__init__(self, lac_torque, CP)
self.lac_torque = lac_torque
self.params = Params()