Compare commits

...

90 Commits

Author SHA1 Message Date
Jason Wen fa6111ba0b no submodule for this 2025-03-21 15:20:05 -04:00
Jason Wen 0a54888d5c just Enhanced Lat Accel only 2025-03-21 15:15:14 -04:00
Jason Wen ccc2912e91 all in one place 2025-03-21 14:49:45 -04:00
Jason Wen 7f1c4ade05 simplify checks 2025-03-21 11:43:57 -04:00
Jason Wen c251efd9a0 bump opendbc 2025-03-21 01:24:38 -04:00
Jason Wen 63f5269130 Merge remote-tracking branch 'sunnypilot/sunnypilot/master-new' into nnlc-new 2025-03-21 01:02:23 -04:00
Jason Wen 57bdc9aaad cereal changes 2025-03-21 00:58:59 -04:00
Jason Wen 877b06b18f another ui 2025-03-21 00:24:20 -04:00
Jason Wen 0a69529e9c no longer needed 2025-03-21 00:02:02 -04:00
Jason Wen 29558685c3 more ui 2025-03-20 23:58:44 -04:00
Jason Wen e6231f6552 more flexible 2025-03-20 23:43:32 -04:00
Jason Wen d860f06a8b more ui 2025-03-20 23:35:55 -04:00
Jason Wen b8fb6fb8e2 new structs 2025-03-20 23:03:12 -04:00
Jason Wen e2440d1384 no live for now 2025-03-20 18:41:09 -04:00
Jason Wen 722ecffe18 live params in a thread 2025-03-20 18:16:01 -04:00
Jason Wen cffd56a753 no need for this 2025-03-20 18:04:13 -04:00
Jason Wen f2fc599b41 move to steering panel 2025-03-20 17:54:45 -04:00
Jason Wen 0623927a28 Merge remote-tracking branch 'sunnypilot/sunnypilot/master-new' into nnlc-new
# Conflicts:
#	selfdrive/ui/sunnypilot/SConscript
2025-03-20 17:02:18 -04:00
Jason Wen d637568056 merge 2025-03-20 16:48:52 -04:00
Jason Wen b7b4b533a0 Merge branch 'ui-lat-long-split' into nnlc-new
# Conflicts:
#	selfdrive/ui/sunnypilot/SConscript
#	selfdrive/ui/sunnypilot/qt/offroad/settings/lateral/neural_network_lateral_control.cc
#	selfdrive/ui/sunnypilot/qt/offroad/settings/lateral/neural_network_lateral_control.h
2025-03-20 16:47:09 -04:00
Jason Wen 8bb511db27 Update selfdrive/ui/sunnypilot/qt/offroad/settings/lateral_panel.h 2025-03-20 16:31:16 -04:00
Jason Wen c6e47a2e71 ui: sunnypilot Panel -> Steering Panel 2025-03-20 16:27:24 -04:00
Jason Wen 7d75f4bfc0 update name and expose toggle 2025-03-20 16:11:49 -04:00
Jason Wen 46d29d10af update regardless, it's an extension now 2025-03-20 16:03:29 -04:00
Jason Wen 7df06df6b2 Merge remote-tracking branch 'sunnypilot/sunnypilot/master-new' into nnlc-new
# Conflicts:
#	selfdrive/controls/lib/latcontrol_torque.py
#	sunnypilot/selfdrive/controls/lib/latcontrol_torque_ext.py
#	sunnypilot/selfdrive/controls/lib/latcontrol_torque_ext_base.py
2025-03-20 16:02:55 -04:00
Jason Wen 0338e4570c Merge remote-tracking branch 'sunnypilot/sunnypilot/master-new' into nnlc-new
# Conflicts:
#	opendbc_repo
#	selfdrive/ui/qt/offroad/developer_panel.cc
#	selfdrive/ui/qt/offroad/developer_panel.h
2025-03-20 13:50:48 -04:00
Jason Wen e851dd250d TODO-SP 2025-03-20 13:50:04 -04:00
Jason Wen bacf54d22a TODO-SP 2025-03-20 13:14:18 -04:00
Jason Wen d15a5ce300 fix 2025-03-20 12:35:18 -04:00
Jason Wen 0c60e8a4e8 space 2025-03-18 01:59:17 -04:00
Jason Wen 6e73f48f59 Merge remote-tracking branch 'sunnypilot/sunnypilot/master-new' into nnlc-new
# Conflicts:
#	opendbc_repo
#	selfdrive/controls/lib/tests/test_latcontrol.py
2025-03-18 01:25:05 -04:00
Jason Wen 43fa7e3446 move around 2025-03-18 00:04:37 -04:00
Jason Wen 1c93f1578b time to split out custom lateral acceleration 2025-03-18 00:03:30 -04:00
Jason Wen 871d7e29e8 rename 2025-03-17 23:57:01 -04:00
Jason Wen 9b49d3da64 child class for additional controllers 2025-03-17 23:56:30 -04:00
Jason Wen 0f475dfae8 move it 2025-03-17 23:04:11 -04:00
Jason Wen 9d8460f85e rename 2025-03-17 23:02:35 -04:00
Jason Wen 73196a1371 more explicit 2025-03-17 22:55:10 -04:00
Jason Wen 73a83a204b try this 2025-03-17 22:41:40 -04:00
Jason Wen 08eef47ce2 just use file name 2025-03-17 22:31:59 -04:00
Jason Wen 102e21f15a less 2025-03-17 20:34:40 -04:00
Jason Wen 52fcfb081c Merge remote-tracking branch 'sunnypilot/sunnypilot/master-new' into nnlc-new
# Conflicts:
#	opendbc_repo
2025-03-17 19:24:30 -04:00
Jason Wen 265e4837fe NeuralNetworkFeedForwardModel 2025-03-17 19:07:39 -04:00
Jason Wen 360e252b43 rename 2025-03-17 18:51:25 -04:00
Jason Wen 8bb4e8b939 space 2025-03-17 18:37:25 -04:00
Jason Wen 62de0b9c60 split base and child 2025-03-17 15:11:53 -04:00
Jason Wen 7c8ce56768 unused 2025-03-17 14:31:43 -04:00
Jason Wen ce688ae38b return stock values if not enabled 2025-03-17 14:19:35 -04:00
Jason Wen 6b4ac127df share the same friction input calculation 2025-03-17 14:16:21 -04:00
Jason Wen 4eb6ae6ee1 align 2025-03-17 13:54:29 -04:00
Jason Wen 7c6841465c make it 33 to match 2025-03-16 20:32:33 -04:00
Jason Wen c20a178de6 validate if it's not None 2025-03-16 20:07:33 -04:00
Jason Wen 19da249fac Merge branch 'master-new' into nnlc-new 2025-03-16 19:54:02 -04:00
Jason Wen 9cd94b7f4a try this out 2025-03-16 19:32:06 -04:00
Jason Wen 5feb7fca12 capnp test 2025-03-16 17:25:20 -04:00
Jason Wen 0a65a94aae fix more test 2025-03-16 16:58:25 -04:00
Jason Wen a802cda85e lint 2025-03-16 16:42:48 -04:00
Jason Wen 8e44d3622c fix tests 2025-03-16 16:39:11 -04:00
Jason Wen 66b6ab7109 fix toggle param 2025-03-16 16:08:12 -04:00
Jason Wen 14c2bb7c29 only allow engage if nnlc is off 2025-03-16 15:56:46 -04:00
Jason Wen 45e259f438 fix initialization 2025-03-16 15:51:39 -04:00
Jason Wen 8a4b3659a0 oops 2025-03-16 15:47:08 -04:00
Jason Wen 815afba5f4 only initialize if NNLC is enabled or allow to enable 2025-03-16 15:46:03 -04:00
Jason Wen 914d5af2eb debug 2025-03-16 15:37:28 -04:00
Jason Wen 19a58920b3 fixes 2025-03-16 15:19:53 -04:00
Jason Wen 6e6f351491 convert to capnp 2025-03-16 15:11:18 -04:00
Jason Wen ac66357bb4 fix import 2025-03-16 15:04:12 -04:00
Jason Wen acfbd9a2ec in structs 2025-03-16 15:00:46 -04:00
Jason Wen e2f7feea53 remove debug 2025-03-16 13:55:11 -04:00
Jason Wen 99177813bc codespell 2025-03-16 13:41:51 -04:00
Jason Wen b424fe759c static 2025-03-16 13:35:50 -04:00
Jason Wen 2f95c1ae28 Merge branch 'master-new' into nnlc-new 2025-03-16 13:30:16 -04:00
Jason Wen 54d52f7024 decouple even more 2025-03-16 13:29:47 -04:00
DevTekVE e80a415daf Add Neural Network Lateral Control toggle to developer panel
This introduces a new toggle for enabling Neural Network Lateral Control (NNLC), providing detailed descriptions of its functionality and compatibility. It includes UI integration, car compatibility checks, and feedback links for unsupported vehicles.
2025-03-16 12:13:43 +01:00
Jason Wen 63d27f574c introduce params 2025-03-16 05:51:23 -04:00
Jason Wen 3810f99189 bump 2025-03-16 05:44:57 -04:00
Jason Wen 112704ed30 dump 2025-03-16 05:44:24 -04:00
Jason Wen 83c098fb56 bump 2025-03-16 05:43:44 -04:00
Jason Wen 48918f426a update submodule path 2025-03-16 05:41:13 -04:00
Jason Wen ef85a849d7 update submodule path 2025-03-16 05:41:00 -04:00
Jason Wen a47d8e9a1a spacing??? 2025-03-16 05:34:01 -04:00
Jason Wen 7768eb7a6c update path to submodule 2025-03-16 05:29:56 -04:00
Jason Wen 6f539e5f79 bump submodule 2025-03-16 05:20:13 -04:00
Jason Wen 9bb4a3a973 new submodule for nn data 2025-03-16 05:09:57 -04:00
Jason Wen 941b2ab929 more fix 2025-03-16 04:44:46 -04:00
Jason Wen 1518495e96 more fixes 2025-03-16 04:36:36 -04:00
Jason Wen e00a7c6e8b fixes 2025-03-16 04:17:36 -04:00
Jason Wen 4b4f1569d1 keep it alive 2025-03-16 04:01:25 -04:00
Jason Wen e2a2cb184a more init 2025-03-16 02:27:29 -04:00
Jason Wen 187ed1a6e3 init 2025-03-16 01:02:54 -04:00
7 changed files with 51 additions and 5 deletions
+1
View File
@@ -125,6 +125,7 @@ inline static std::unordered_map<std::string, uint32_t> keys = {
{"CarParamsSPPersistent", PERSISTENT},
{"CarPlatformBundle", PERSISTENT},
{"EnableGithubRunner", PERSISTENT | BACKUP},
{"LatTorqueControlEnhancedLateralAccel", PERSISTENT | BACKUP},
{"ModelRunnerTypeCache", CLEAR_ON_ONROAD_TRANSITION},
{"OffroadMode", CLEAR_ON_MANAGER_START},
{"OffroadMode_Status", CLEAR_ON_MANAGER_START},
@@ -42,8 +42,11 @@ LateralPanel::LateralPanel(SettingsWindowSP *parent) : QFrame(parent) {
});
list->addItem(madsSettingsButton);
latControlTorqueCustomLatAccel = new ParamControl("LatTorqueControlEnhancedLateralAccel", tr("Enhanced Lateral Acceleration"), "", "");
list->addItem(latControlTorqueCustomLatAccel);
toggleOffroadOnly = {
madsToggle,
madsToggle, latControlTorqueCustomLatAccel,
};
QObject::connect(uiState(), &UIState::offroadTransition, this, &LateralPanel::updateToggles);
@@ -37,4 +37,5 @@ private:
ParamControl *madsToggle;
PushButtonSP *madsSettingsButton;
MadsSettings *madsWidget = nullptr;
ParamControl *latControlTorqueCustomLatAccel = nullptr;
};
@@ -4,10 +4,11 @@ Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors.
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_ext_base import LatControlTorqueExtBase
from openpilot.sunnypilot.selfdrive.controls.lib.latcontrol_torque_lat_accel import LatControlTorqueEnhancedLateralAccel
class LatControlTorqueExt(LatControlTorqueExtBase):
class LatControlTorqueExt(LatControlTorqueEnhancedLateralAccel):
def __init__(self, lac_torque, CP, CP_SP):
super().__init__(lac_torque, CP, CP_SP)
@@ -22,5 +23,6 @@ class LatControlTorqueExt(LatControlTorqueExtBase):
self._actual_lateral_accel = actual_lateral_accel
self.update_calculations(CS, VM, desired_lateral_accel)
self.update_custom_lateral_acceleration(CS, roll_compensation, gravity_adjusted_lateral_accel)
return self._ff, self._pid_log
@@ -0,0 +1,38 @@
"""
Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors.
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 opendbc.car.interfaces import LatControlInputs
from openpilot.common.params import Params
from openpilot.sunnypilot.selfdrive.controls.lib.latcontrol_torque_ext_base import LatControlTorqueExtBase
class LatControlTorqueEnhancedLateralAccel(LatControlTorqueExtBase):
def __init__(self, lac_torque, CP, CP_SP):
super().__init__(lac_torque, CP, CP_SP)
self.params = Params()
self.enabled = self.params.get_bool("LatTorqueControlEnhancedLateralAccel")
def update_custom_lateral_acceleration(self, CS, roll_compensation, gravity_adjusted_lateral_accel):
if not self.enabled:
return
friction_input = self.update_friction_input(self._desired_lateral_accel, self._actual_lateral_accel)
torque_from_setpoint = self.torque_from_lateral_accel(
LatControlInputs(self._setpoint, roll_compensation, CS.vEgo, CS.aEgo), self.torque_params,
self.lateral_jerk_setpoint, self._lateral_accel_deadzone, friction_compensation=self.enabled, gravity_adjusted=False
)
torque_from_measurement = self.torque_from_lateral_accel(
LatControlInputs(self._measurement, roll_compensation, CS.vEgo, CS.aEgo), self.torque_params,
self.lateral_jerk_measurement, self._lateral_accel_deadzone, friction_compensation=self.enabled, gravity_adjusted=False
)
self._pid_log.error = float(torque_from_setpoint - torque_from_measurement)
self._ff = self.torque_from_lateral_accel(LatControlInputs(gravity_adjusted_lateral_accel, roll_compensation, CS.vEgo, CS.aEgo), self.torque_params,
friction_input, self._lateral_accel_deadzone, friction_compensation=True,
gravity_adjusted=True)
+2 -1
View File
@@ -44,12 +44,13 @@ def manager_init() -> None:
sunnypilot_default_params: list[tuple[str, str | bytes]] = [
("DynamicExperimentalControl", "0"),
("LatTorqueControlEnhancedLateralAccel", "0"),
("Mads", "1"),
("MadsMainCruiseAllowed", "1"),
("MadsSteeringMode", "0"),
("MadsUnifiedEngagementMode", "1"),
("ModelManager_LastSyncTime", "0"),
("ModelManager_ModelsCache", "")
("ModelManager_ModelsCache", ""),
]
if params.get_bool("RecordFrontLock"):