mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-02-19 00:43:54 +08:00
parameterize longitudinal actuator delay (#22153)
* paremetrize longitudinal actuator delay
* update ref
old-commit-hash: b39f6efa3f
This commit is contained in:
2
cereal
2
cereal
Submodule cereal updated: 0c929f74ce...89557c5a17
@@ -87,6 +87,7 @@ class CarInterfaceBase():
|
||||
ret.longitudinalTuning.kpV = [1.]
|
||||
ret.longitudinalTuning.kiBP = [0.]
|
||||
ret.longitudinalTuning.kiV = [1.]
|
||||
ret.longitudinalActuatorDelay = 0.15
|
||||
return ret
|
||||
|
||||
# returns a car.CarState, pass in car.CarControl
|
||||
|
||||
@@ -14,7 +14,6 @@ DECEL_THRESHOLD_TO_PID = 0.8
|
||||
DECEL_STOPPING_TARGET = 2.0 # apply at least this amount of brake to maintain the vehicle stationary
|
||||
|
||||
RATE = 100.0
|
||||
DEFAULT_LONG_LAG = 0.15
|
||||
|
||||
# As per ISO 15622:2018 for all speeds
|
||||
ACCEL_MIN_ISO = -3.5 # m/s^2
|
||||
@@ -78,9 +77,9 @@ class LongControl():
|
||||
# Interp control trajectory
|
||||
# TODO estimate car specific lag, use .15s for now
|
||||
if len(long_plan.speeds) == CONTROL_N:
|
||||
v_target = interp(DEFAULT_LONG_LAG, T_IDXS[:CONTROL_N], long_plan.speeds)
|
||||
v_target = interp(CP.longitudinalActuatorDelay, T_IDXS[:CONTROL_N], long_plan.speeds)
|
||||
v_target_future = long_plan.speeds[-1]
|
||||
a_target = 2 * (v_target - long_plan.speeds[0])/DEFAULT_LONG_LAG - long_plan.accels[0]
|
||||
a_target = 2 * (v_target - long_plan.speeds[0])/CP.longitudinalActuatorDelay - long_plan.accels[0]
|
||||
else:
|
||||
v_target = 0.0
|
||||
v_target_future = 0.0
|
||||
|
||||
@@ -1 +1 @@
|
||||
bc50c3f64b4677eee32bc49bdf69c3be265fd743
|
||||
d55568ec276ae8789faa1f69585f3c9ab7087205
|
||||
Reference in New Issue
Block a user