Compare commits

..

1 Commits

Author SHA1 Message Date
discountchubbs 89881bd50b 6d42b5fc5ac6292796a204ff2288fe04/6000 2026-12-02 08:06:07 -08:00
4 changed files with 7 additions and 16 deletions
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:962396e7909556af6a9c7bfb7ad6db01a8d2c8da0760379eb71efda004cb3548
size 69699272
oid sha256:546ae4ccc03b1ef7cf08c971eb78a8ae46976d79078e5296e49a466736ed3773
size 89833676
@@ -18,6 +18,7 @@ class LatControlTorqueExt(NeuralNetworkLateralControl, LatControlTorqueExtOverri
desired_lateral_accel, actual_lateral_accel, lateral_accel_deadzone, gravity_adjusted_lateral_accel,
desired_curvature, actual_curvature, steer_limited_by_safety, output_torque):
self._ff = ff
self._pid = pid
self._pid_log = pid_log
self._setpoint = setpoint
self._measurement = measurement
@@ -63,7 +63,7 @@ class LatControlTorqueExtBase:
self.torque_params = lac_torque.torque_params
self._ff = 0.0
self._pid = PIDController(KP, KI, pos_limit=lac_torque.steer_max, neg_limit=-lac_torque.steer_max, rate=1 / lac_torque.dt)
self._pid = PIDController(KP, KI)
self._pid_log = log.ControlsState.LateralTorqueState.new_message()
self._setpoint = 0.0
self._measurement = 0.0
@@ -4,7 +4,6 @@ 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.
"""
import math
import numpy as np
from openpilot.cereal import log, messaging
@@ -60,9 +59,9 @@ def _make_model_v2():
return model
def _run_update(controller, VM, v_ego=30, desired_curvature=0.5):
def _run_update(controller, VM):
CS = car.CarState.new_message()
CS.vEgo = v_ego
CS.vEgo = 30
CS.steeringPressed = False
lp = generate_deviceMotion()
pose = Pose.from_device_motion(lp.deviceMotion)
@@ -70,7 +69,7 @@ def _run_update(controller, VM, v_ego=30, desired_curvature=0.5):
model_v2 = _make_model_v2().modelV2
controller.extension.update_model_v2(model_v2)
controller.extension.update_lateral_lag(0.2)
return controller.update(True, CS, VM, params, False, desired_curvature, pose, False, 0.2)
return controller.update(True, CS, VM, params, False, 0.5, pose, False, 0.2)
class TestLatControlTorqueExt(OpenpilotTestCase):
@@ -108,12 +107,3 @@ class TestLatControlTorqueExt(OpenpilotTestCase):
controller, VM, _ = _make_controller(enhanced=True, nnlc=True)
output_torque, _, pid_log = _run_update(controller, VM)
assert pid_log.active
def test_low_speed_gain_bounded(self):
for kwargs in ({"nnlc": True}, {"enhanced": True}):
controller, VM, _ = _make_controller(**kwargs)
one_degree = -VM.calc_curvature(math.radians(1.0), 2.0, 0.0)
output_torque, _, _ = _run_update(controller, VM, v_ego=2.0, desired_curvature=one_degree)
assert controller.extension._nnlc_enabled or controller.extension._jerk_aware_enabled
assert controller.extension._pid is not controller.pid
assert abs(output_torque) < 0.3, kwargs