Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

Commit 0601735

Browse files
committed
changes from op master branch
1 parent fa1f0ba commit 0601735

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

selfdrive/controls/lib/drive_helpers.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
V_CRUISE_MAX = 145
1414
V_CRUISE_UNSET = 255
1515
V_CRUISE_INITIAL = 40
16-
V_CRUISE_INITIAL_EXPERIMENTAL_MODE = 40
16+
V_CRUISE_INITIAL_EXPERIMENTAL_MODE = 55
1717
IMPERIAL_INCREMENT = 1.6 # should be CV.MPH_TO_KPH, but this causes rounding errors
1818

1919
MIN_SPEED = 1.0
@@ -22,7 +22,6 @@
2222

2323
# EU guidelines
2424
MAX_LATERAL_JERK = 5.0
25-
2625
MAX_VEL_ERR = 5.0
2726

2827
ButtonEvent = car.CarState.ButtonEvent
@@ -200,6 +199,16 @@ def get_lag_adjusted_curvature(CP, v_ego, psis, curvatures, curvature_rates):
200199
return safe_desired_curvature, safe_desired_curvature_rate
201200

202201

202+
# rick - we dont need this as it is for the latest model (0.9.5+) + controlsd
203+
def clip_curvature(v_ego, prev_curvature, new_curvature):
204+
v_ego = max(MIN_SPEED, v_ego)
205+
max_curvature_rate = MAX_LATERAL_JERK / (v_ego**2) # inexact calculation, check https://github.com/commaai/openpilot/pull/24755
206+
safe_desired_curvature = clip(new_curvature,
207+
prev_curvature - max_curvature_rate * DT_CTRL,
208+
prev_curvature + max_curvature_rate * DT_CTRL)
209+
210+
return safe_desired_curvature
211+
203212
def get_friction(lateral_accel_error: float, lateral_accel_deadzone: float, friction_threshold: float,
204213
torque_params: car.CarParams.LateralTorqueTuning, friction_compensation: bool) -> float:
205214
friction_interp = interp(

0 commit comments

Comments
 (0)