This commit is contained in:
Jason Wen
2025-03-17 23:02:35 -04:00
parent 73196a1371
commit 9d8460f85e
2 changed files with 4 additions and 4 deletions
@@ -10,7 +10,7 @@ import numpy as np
from openpilot.sunnypilot.selfdrive.controls.lib.nnlc.helpers import ACTIVATION_FUNCTION_NAMES
class NeuralNetworkFeedForwardModel:
class NNTorqueModel:
def __init__(self, params_file, zero_bias=False):
with open(params_file) as f:
params = load(f)
@@ -13,7 +13,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.latcontrol_torque_ext_base import LatControlTorqueExtBase
from openpilot.sunnypilot.selfdrive.controls.lib.nnlc.model import NeuralNetworkFeedForwardModel
from openpilot.sunnypilot.selfdrive.controls.lib.nnlc.model import NNTorqueModel
# At a given roll, if pitch magnitude increases, the
@@ -37,8 +37,8 @@ class NeuralNetworkLateralControl(LatControlTorqueExtBase):
# NN model takes current v_ego, lateral_accel, lat accel/jerk error, roll, and past/future/planned data
# of lat accel and roll
# Past value is computed using previous desired lat accel and observed roll
# Only initialize NeuralNetworkFeedForwardModel if enabled
self.model = NeuralNetworkFeedForwardModel(CP_SP.neuralNetworkLateralControl.modelPath) if self.enabled else None
# Only initialize NNTorqueModel if enabled
self.model = NNTorqueModel(CP_SP.neuralNetworkLateralControl.modelPath) if self.enabled else None
self.torque_from_lateral_accel = lac_torque.torque_from_lateral_accel
self.torque_params = lac_torque.torque_params