mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-07-16 18:32:06 +08:00
fix follow distance (#156)
follow distance sequence not properly matched
This commit is contained in:
@@ -337,17 +337,17 @@ class LongitudinalMpc:
|
||||
if carstate.distanceLines == 1: # Traffic
|
||||
# At slow speeds more time, decrease time up to 60mph
|
||||
# in kph ~= 0 10 20 30 40 50 60 90 150
|
||||
x_vel = [0, 2.25, 4.5, 6.75, 9, 11.25, 13.5, 15.75, 18, 20.25, 22.5, 24.75, 27, 29.25, 31.5, 33.75, 36, 38.25, 40.5]
|
||||
y_dist = [1.25, 1.24, 1.23, 1.22, 1.21, 1.20, 1.18, 1.16, 1.13, 1.11, 1.09, 1.07, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05]
|
||||
self.desired_TF = np.interp(carstate.vEgo, x_vel, y_dist)
|
||||
elif carstate.distanceLines == 2: # Relaxed
|
||||
x_vel = [0, 2.788, 5.56, 8.333, 11.11, 13.89, 16.67, 25.0, 41.67]
|
||||
y_dist = [1.24, 1.24, 1.27, 1.29, 1.35, 1.35, 1.35, 1.1, 1.3]
|
||||
self.desired_TF = np.interp(carstate.vEgo, x_vel, y_dist)
|
||||
elif carstate.distanceLines == 2: # Relaxed
|
||||
x_vel = [0.0, 2.788, 5.56, 8.333, 11.11, 13.89, 19.44, 27.78, 41.67] # velocities
|
||||
y_dist = [1.27, 1.27, 1.29, 1.32, 1.38, 1.38, 1.38, 1.619, 1.8]
|
||||
self.desired_TF = np.interp(carstate.vEgo, x_vel, y_dist)
|
||||
#self.desired_TF = 1.7
|
||||
else:
|
||||
x_vel = [0, 2.25, 4.5, 6.75, 9, 11.25, 13.5, 15.75, 18, 20.25, 22.5, 24.75, 27, 29.25, 31.5, 33.75, 36, 38.25, 40.5]
|
||||
y_dist = [1.25, 1.24, 1.23, 1.22, 1.21, 1.20, 1.18, 1.16, 1.13, 1.11, 1.09, 1.07, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05]
|
||||
x_vel = [0.0, 2.788, 5.56, 8.333, 11.11, 13.89, 19.44, 27.78, 41.67] # velocities
|
||||
y_dist = [1.27, 1.27, 1.29, 1.32, 1.38, 1.38, 1.38, 1.619, 1.8]
|
||||
self.desired_TF = np.interp(carstate.vEgo, x_vel, y_dist)
|
||||
#self.desired_TF = T_FOLLOW
|
||||
|
||||
|
||||
Reference in New Issue
Block a user