update name and expose toggle

This commit is contained in:
Jason Wen
2025-03-20 16:11:49 -04:00
parent 46d29d10af
commit 7d75f4bfc0
6 changed files with 12 additions and 6 deletions
+1 -1
View File
@@ -125,7 +125,7 @@ inline static std::unordered_map<std::string, uint32_t> keys = {
{"CarParamsSPPersistent", PERSISTENT},
{"CarPlatformBundle", PERSISTENT},
{"EnableGithubRunner", PERSISTENT | BACKUP},
{"LateralTorqueControlLateralJerk", PERSISTENT | BACKUP},
{"LateralTorqueControlEnhancedLateralAccel", PERSISTENT | BACKUP},
{"ModelRunnerTypeCache", CLEAR_ON_ONROAD_TRANSITION},
{"OffroadMode", CLEAR_ON_MANAGER_START},
{"OffroadMode_Status", CLEAR_ON_MANAGER_START},
+4
View File
@@ -118,6 +118,10 @@ class Controls:
if not CC.longActive:
self.LoC.reset()
# Neural Network Lateral Control
if self.CP_SP.neuralNetworkLateralControl.enabled or self.params.get_bool("LateralTorqueControlEnhancedLateralAccel"):
self.LaC.extension.update_model_v2(model_v2)
# accel PID loop
pid_accel_limits = self.CI.get_pid_accel_limits(self.CP, CS.vEgo, CS.vCruise * CV.KPH_TO_MS)
actuators.accel = float(self.LoC.update(CC.longActive, CS, long_plan.aTarget, long_plan.shouldStop, pid_accel_limits))
@@ -60,6 +60,8 @@ DeveloperPanel::DeveloperPanel(SettingsWindow *parent) : ListWidget(parent) {
#if SUNNYPILOT
neuralNetworkLateralControlToggle = neuralNetworkLateralControl.toggle;
addItem(neuralNetworkLateralControlToggle);
auto latControlTorqueCustomLatAccel = new ParamControl("LateralTorqueControlEnhancedLateralAccel", tr("Enhanced Lateral Acceleration"), "", "");
addItem(latControlTorqueCustomLatAccel);
#endif
enableGithubRunner = new ParamControl("EnableGithubRunner", tr("Enable GitHub runner service"), tr("Enables or disables the github runner service."), "");
@@ -5,11 +5,11 @@ This file is part of sunnypilot and is licensed under the MIT License.
See the LICENSE.md file in the root directory for more details.
"""
from openpilot.sunnypilot.selfdrive.controls.lib.latcontrol_torque_lat_accel import LatControlTorqueCustomLateralAccel
from openpilot.sunnypilot.selfdrive.controls.lib.latcontrol_torque_lat_accel import LatControlTorqueEnhancedLateralAccel
from openpilot.sunnypilot.selfdrive.controls.lib.nnlc.nnlc import NeuralNetworkLateralControl
class LatControlTorqueExt(NeuralNetworkLateralControl, LatControlTorqueCustomLateralAccel):
class LatControlTorqueExt(NeuralNetworkLateralControl, LatControlTorqueEnhancedLateralAccel):
def __init__(self, lac_torque, CP, CP_SP):
super().__init__(lac_torque, CP, CP_SP)
@@ -10,11 +10,11 @@ from openpilot.common.params import Params
from openpilot.sunnypilot.selfdrive.controls.lib.latcontrol_torque_ext_base import LatControlTorqueExtBase
class LatControlTorqueCustomLateralAccel(LatControlTorqueExtBase):
class LatControlTorqueEnhancedLateralAccel(LatControlTorqueExtBase):
def __init__(self, lac_torque, CP, CP_SP):
super().__init__(lac_torque, CP, CP_SP)
self.params = Params() # TODO-SP: unused after moving the param to cereal
self.use_lateral_jerk: bool = self.params.get_bool("LateralTorqueControlLateralJerk") # TODO-SP: move this to cereal
self.use_lateral_jerk: bool = self.params.get_bool("LateralTorqueControlEnhancedLateralAccel") # TODO-SP: move this to cereal
def update_custom_lateral_acceleration(self, CS, roll_compensation, gravity_adjusted_lateral_accel):
if not self.use_lateral_jerk:
+1 -1
View File
@@ -44,7 +44,7 @@ def manager_init() -> None:
sunnypilot_default_params: list[tuple[str, str | bytes]] = [
("DynamicExperimentalControl", "0"),
("LateralTorqueControlLateralJerk", "0"),
("LateralTorqueControlEnhancedLateralAccel", "0"),
("Mads", "1"),
("MadsMainCruiseAllowed", "1"),
("MadsSteeringMode", "0"),