This commit is contained in:
Kumar
2024-10-27 18:51:23 -07:00
committed by GitHub
parent 9e77b88ae9
commit 804aabf77f
3 changed files with 14 additions and 14 deletions
+4 -4
View File
@@ -164,12 +164,12 @@ class CarInterface(CarInterfaceBase):
def custom_tss2_longitudinal_tuning():
ret.vEgoStopping = 0.25
ret.vEgoStarting = 0.01
ret.stoppingDecelRate = 0.002
ret.stoppingDecelRate = 0.001
def default_tss2_longitudinal_tuning():
ret.vEgoStopping = 0.25
ret.vEgoStarting = 0.25
ret.stoppingDecelRate = 0.006 # reach stopping target smoothly
ret.stoppingDecelRate = 0.002 # reach stopping target smoothly
def default_longitudinal_tuning():
tune.kiBP = [0., 5., 35.]
@@ -178,8 +178,8 @@ class CarInterface(CarInterfaceBase):
tune = ret.longitudinalTuning
if candidate in TSS2_CAR or ret.enableGasInterceptorDEPRECATED:
if sp_tss2_long_tune:
tune.kiBP = [0., 1., 5., 12., 20., 27.]
tune.kiV = [0.351, 0.331, 0.245, 0.215, 0.17, 0.10]
tune.kiBP = [0., 0.5, 1., 1.5, 5., 12., 20., 27.]
tune.kiV = [0.33, 0.33, 0.31, 0.31, 0.22, 0.215, 0.17, 0.10]
custom_tss2_longitudinal_tuning()
else:
tune.kpV = [0.0]
@@ -55,11 +55,11 @@ T_IDXS = np.array(T_IDXS_LST)
FCW_IDXS = T_IDXS < 5.0
T_DIFFS = np.diff(T_IDXS, prepend=[0.])
COMFORT_BRAKE = 2.5
STOP_DISTANCE = 6.0
STOP_DISTANCE = 5.0
def get_jerk_factor(personality=custom.LongitudinalPersonalitySP.standard):
if personality==custom.LongitudinalPersonalitySP.relaxed:
return 1.3
return 1.0
elif personality==custom.LongitudinalPersonalitySP.standard:
return 1.0
elif personality==custom.LongitudinalPersonalitySP.moderate:
@@ -77,16 +77,16 @@ def get_a_change_factor(v_ego, v_lead0, v_lead1, personality=custom.Longitudinal
# Higher value = more cautious (slower reaction), smaller value = quicker response (more aggressive driving)
if personality==custom.LongitudinalPersonalitySP.relaxed:
a_change_cost_multiplier_follow = 1.0 # Highest cost for changing acceleration, meaning more gradual transitions
a_change_cost_high_speed_factor = 1.0 # No extra penalty for high-speed changes (more cautious)
a_change_cost_high_speed_factor = 1.5 # No extra penalty for high-speed changes (more cautious)
elif personality==custom.LongitudinalPersonalitySP.standard:
a_change_cost_multiplier_follow = 0.5 # Moderate cost for changing acceleration (quicker transitions compared to relaxed)
a_change_cost_high_speed_factor = 1.5 # Higher penalty for changes at higher speeds (more cautious)
a_change_cost_high_speed_factor = 3.0 # Higher penalty for changes at higher speeds (more cautious)
elif personality==custom.LongitudinalPersonalitySP.moderate:
a_change_cost_multiplier_follow = 0.5 # Similar to standard (quicker transitions compared to relaxed)
a_change_cost_high_speed_factor = 1.5 # Similar to standard (higher penalty for high speeds)
a_change_cost_high_speed_factor = 3.0 # Similar to standard (higher penalty for high speeds)
elif personality==custom.LongitudinalPersonalitySP.aggressive:
a_change_cost_multiplier_follow = 0.1 # Very low cost for changing acceleration, meaning quicker reactions (less cautious)
a_change_cost_high_speed_factor = 3.0 # Much higher penalty for abrupt changes at high speeds (very cautious at high speeds)
a_change_cost_high_speed_factor = 5.0 # Much higher penalty for abrupt changes at high speeds (very cautious at high speeds)
elif personality==custom.LongitudinalPersonalitySP.overtake:
a_change_cost_multiplier_follow = 0.1 # Very low cost for changing acceleration, meaning quicker reactions (less cautious)
a_change_cost_high_speed_factor = 5.0 # Much higher penalty for abrupt changes at high speeds (very cautious at high speeds)
@@ -29,10 +29,10 @@ from openpilot.common.numpy_fast import interp
AccelPersonality = custom.AccelerationPersonality
# accel personality by @arne182 modified by cgw and kumar
_DP_CRUISE_MIN_V = [-1.0, -1.0]
_DP_CRUISE_MIN_V_ECO = [-1.0, -1.0]
_DP_CRUISE_MIN_V_SPORT = [-1.0, -1.0]
_DP_CRUISE_MIN_BP = [0., 20.]
_DP_CRUISE_MIN_V = [-0.03, -0.03, -1.0, -1.0]
_DP_CRUISE_MIN_V_ECO = [-0.02, -0.02, -1.0, -1.0]
_DP_CRUISE_MIN_V_SPORT = [-0.04, -0.04, -1.0, -1.0]
_DP_CRUISE_MIN_BP = [0., 15.99, 16., 20.]
_DP_CRUISE_MAX_V = [2.0, 2.0, 2.0, 1.80, 1.03, .62, .47, .35, .10]
_DP_CRUISE_MAX_V_ECO = [2.0, 2.0, 2.0, 1.65, 0.92, .532, .432, .315, .084]