CTV 2.0: GlideTech (#436)

smooth, effortless movement
This commit is contained in:
Kumar
2024-09-29 17:14:17 -07:00
committed by GitHub
parent aa34714b42
commit c1107924ae
3 changed files with 29 additions and 34 deletions
+10 -15
View File
@@ -160,31 +160,26 @@ class CarInterface(CarInterfaceBase):
sp_tss2_long_tune = Params().get_bool("ToyotaTSS2Long")
# hand tuned (August 12, 2024)
def custom_tss2_longitudinal_tuning():
# Last updated: September 29, 2024
def custom_tss2_longitudinal_tuning(): # hand tuned
ret.vEgoStopping = 0.25
ret.vEgoStarting = 0.25
ret.stoppingDecelRate = 0.0074
ret.vEgoStarting = 0.01
ret.stoppingDecelRate = 0.006
def default_tss2_longitudinal_tuning():
def default_tss2_longitudinal_tuning(): # stock comma
ret.vEgoStopping = 0.25
ret.vEgoStarting = 0.25
ret.stoppingDecelRate = 0.3 # reach stopping target smoothly
ret.vEgoStarting = 0.10
ret.stoppingDecelRate = 0.007 # reach stopping target smoothly
def default_longitudinal_tuning():
def default_longitudinal_tuning(): # stock comma
tune.kiBP = [0., 5., 35.]
tune.kiV = [3.6, 2.4, 1.5]
tune = ret.longitudinalTuning
if candidate in TSS2_CAR or ret.enableGasInterceptorDEPRECATED:
if sp_tss2_long_tune:
#tune.kiBP = [0., 0.1, 3., 12., 20., 26., 36., 50]
#tune.kiV = [0.34, 0.35, 0.2896, 0.2237, 0.174, 0.10, 0.08, 0.06]
#smooth
tune.kiBP = [0., 8., 12., 20., 27., 36., 50]
tune.kiV = [0.326, 0.206, 0.20, 0.17, 0.12, 0.08, 0.06]
#tune.kiBP = [0., 2., 5., 12., 16, 20., 27., 36., 50]
#tune.kiV = [0.27, 0.24, 0.2205, 0.20, 0.18, 0.17, 0.12, 0.08, 0.06]
tune.kiBP = [0., 5., 12., 20., 27., 36., 40.]
tune.kiV = [0.34, 0.234, 0.20, 0.17, 0.105, 0.09, 0.08]
custom_tss2_longitudinal_tuning()
else:
tune.kpV = [0.0]
@@ -63,7 +63,7 @@ def get_jerk_factor(personality=custom.LongitudinalPersonalitySP.standard):
elif personality==custom.LongitudinalPersonalitySP.standard:
return 1.0
elif personality==custom.LongitudinalPersonalitySP.moderate:
return 0.85
return 0.9
elif personality==custom.LongitudinalPersonalitySP.aggressive:
return 0.8
elif personality==custom.LongitudinalPersonalitySP.overtake:
@@ -86,20 +86,20 @@ def get_T_FOLLOW(personality=custom.LongitudinalPersonalitySP.standard):
else:
raise NotImplementedError("Longitudinal personality not supported")
# Last updated: September 29, 2024
def get_dynamic_personality(v_ego, personality=custom.LongitudinalPersonalitySP.standard):
if personality==custom.LongitudinalPersonalitySP.relaxed:
x_vel = [0, 5., 5.01, 20., 27.7]
y_dist = [1.0, 1.0, 1.75, 1.75, 1.83]
x_vel = [0, 14., 27.7]
y_dist = [1.75, 1.75, 2.00]
elif personality==custom.LongitudinalPersonalitySP.standard:
x_vel = [0, 5., 5.01, 20., 27.7]
y_dist = [1.45, 1.45, 1.75, 1.75, 1.70]
x_vel = [0, 14., 27.7]
y_dist = [1.75, 1.75, 1.70]
elif personality==custom.LongitudinalPersonalitySP.moderate:
x_vel = [0, 27.69, 27.7]
y_dist = [1.45, 1.45, 1.40]
x_vel = [0, 14., 27.7]
y_dist = [1.45, 1.45, 1.48]
elif personality==custom.LongitudinalPersonalitySP.aggressive:
x_vel = [0, 20.0, 20.01, 27.69, 27.7]
y_dist = [1.0, 1.0, 1.10, 1.10, 1.20]
x_vel = [0, 14., 27.7]
y_dist = [1.25, 1.25, 1.28]
else:
raise NotImplementedError("Dynamic personality not supported")
return np.interp(v_ego, x_vel, y_dist)
@@ -21,7 +21,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
# Last updated: August 12, 2024
# Last updated: September 29, 2024
from cereal import custom
from openpilot.common.numpy_fast import interp
@@ -29,15 +29,15 @@ from openpilot.common.numpy_fast import interp
AccelPersonality = custom.AccelerationPersonality
# accel personality by @arne182 modified by cgw and kumar
_DP_CRUISE_MIN_V = [-0.031, -0.031, -0.101, -0.101, -0.39, -0.39, -0.59, -0.59, -0.79, -0.79, -1.0, -1.0]
_DP_CRUISE_MIN_V_ECO = [-0.030, -0.030, -0.100, -0.100, -0.38, -0.38, -0.58, -0.58, -0.78, -0.78, -1.0, -1.0]
_DP_CRUISE_MIN_V_SPORT = [-0.102, -0.102, -0.102, -0.102, -0.40, -0.40, -0.60, -0.60, -0.80, -0.80, -1.0, -1.0]
_DP_CRUISE_MIN_BP = [0., 5.0, 5.01, 10., 10.01, 14., 14.01, 18., 18.01, 22., 22.01, 30.]
_DP_CRUISE_MIN_V = [-1.0, -1.0, -0.88]
_DP_CRUISE_MIN_V_ECO = [-1.0, -1.0, -0.76]
_DP_CRUISE_MIN_V_SPORT = [-1.0, -1.0, -1.0]
_DP_CRUISE_MIN_BP = [0., 11.1, 20.]
_DP_CRUISE_MAX_V = [2.0, 2.0, 1.9, 1.60, 1.11, .73, .55, .38, .17]
_DP_CRUISE_MAX_V_ECO = [2.0, 2.0, 1.8, 1.35, 0.86, .53, .43, .32, .09]
_DP_CRUISE_MAX_V_SPORT = [2.0, 2.0, 2.0, 2.00, 1.40, .90, .70, .50, .30]
_DP_CRUISE_MAX_BP = [0., 4., 6., 8., 11., 20., 25., 30., 40.]
_DP_CRUISE_MAX_V = [2.0, 2.0, 2.0, 1.75, 1.03, .72, .53, .42, .13]
_DP_CRUISE_MAX_V_ECO = [2.0, 2.0, 2.0, 1.50, 0.92, .54, .43, .32, .088]
_DP_CRUISE_MAX_V_SPORT = [2.0, 2.0, 2.0, 2.00, 1.25, .96, .78, .60, .4]
_DP_CRUISE_MAX_BP = [0., 1., 6., 8., 11., 20., 25., 30., 55.]
class AccelController: