Latcontrol: type annotate update inputs and clip_curvature output (#36282)

pull/36281/head
felsager 3 days ago committed by GitHub
parent e62781cccb
commit 9f32f217e6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      selfdrive/controls/lib/drive_helpers.py
  2. 2
      selfdrive/controls/lib/latcontrol.py

@ -22,7 +22,7 @@ def smooth_value(val, prev_val, tau, dt=DT_MDL):
alpha = 1 - np.exp(-dt/tau) if tau > 0 else 1
return alpha * val + (1 - alpha) * prev_val
def clip_curvature(v_ego, prev_curvature, new_curvature, roll):
def clip_curvature(v_ego, prev_curvature, new_curvature, roll) -> tuple[float, bool]:
# This function respects ISO lateral jerk and acceleration limits + a max curvature
v_ego = max(v_ego, MIN_SPEED)
max_curvature_rate = MAX_LATERAL_JERK / (v_ego ** 2) # inexact calculation, check https://github.com/commaai/openpilot/pull/24755

@ -15,7 +15,7 @@ class LatControl(ABC):
self.steer_max = 1.0
@abstractmethod
def update(self, active, CS, VM, params, steer_limited_by_safety, desired_curvature, calibrated_pose, curvature_limited):
def update(self, active: bool, CS, VM, params, steer_limited_by_safety: bool, desired_curvature: float, calibrated_pose, curvature_limited: bool):
pass
def reset(self):

Loading…
Cancel
Save