mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-12-02 04:53:40 +08:00
Keep Faster Takeoffs strong beyond the first few mph
This commit is contained in:
@@ -62,7 +62,7 @@ _TAKEOFF_TOTAL_MAX = [3.5, 3.5, 1.7, 1.7, 3.2]
|
||||
|
||||
def get_max_accel(v_ego, faster_takeoffs=False):
|
||||
max_accel = np.interp(v_ego, A_CRUISE_MAX_BP, A_CRUISE_MAX_VALS)
|
||||
return np.interp(v_ego, [2., 5.], [ACCEL_MAX, max_accel]) if faster_takeoffs else max_accel
|
||||
return np.interp(v_ego, [5., 10.], [ACCEL_MAX, max_accel]) if faster_takeoffs else max_accel
|
||||
|
||||
def get_coast_accel(pitch):
|
||||
return np.sin(pitch) * -5.65 - 0.3 # fitted from data using xx/projects/allow_throttle/compute_coast_accel.py
|
||||
|
||||
@@ -7,14 +7,14 @@ from openpilot.starpilot.longitudinal.tests.test_conditional_handoff import Fram
|
||||
from openpilot.starpilot.longitudinal.tests.test_ioniq6_start import candidate
|
||||
|
||||
|
||||
@pytest.mark.parametrize('speed', [0., .5, 1., 2., 3., 4.])
|
||||
@pytest.mark.parametrize('speed', [0., .5, 1., 2., 3., 4., 5., 6., 8., 9.])
|
||||
def test_fast_takeoffs_raise_low_speed_default_within_existing_global_limit(speed):
|
||||
assert get_max_accel(speed, True) > get_max_accel(speed)
|
||||
assert get_max_accel(speed, True) <= ACCEL_MAX
|
||||
|
||||
|
||||
@pytest.mark.parametrize('speed', [5., 6., 10., 15., 25., 40., 50.])
|
||||
def test_fast_takeoffs_rejoin_unchanged_normal_acceleration_by_5ms(speed):
|
||||
@pytest.mark.parametrize('speed', [10., 15., 25., 40., 50.])
|
||||
def test_fast_takeoffs_rejoin_unchanged_normal_acceleration_by_10ms(speed):
|
||||
assert get_max_accel(speed, True) == get_max_accel(speed)
|
||||
|
||||
|
||||
@@ -64,3 +64,25 @@ def test_real_ioniq_planner_accelerates_faster_after_release_but_keeps_model_sto
|
||||
assert outputs[-1] == pytest.approx((1.6, 2.0))
|
||||
assert not faster.output_should_stop
|
||||
assert np.isfinite(outputs).all()
|
||||
|
||||
|
||||
def test_fast_takeoff_keeps_acceleration_after_first_few_mph():
|
||||
cp = candidate()[1]
|
||||
for speed in (3., 4., 5., 6., 8.):
|
||||
normal = faster = 0.
|
||||
for _ in range(40):
|
||||
normal = get_cruise_accel(False, 30., speed, normal, 0., cp, .05, 0., True)
|
||||
faster = get_cruise_accel(False, 30., speed, faster, 0., cp, .05, 0., True, faster_takeoffs=True)
|
||||
assert faster > normal + .15
|
||||
assert faster <= ACCEL_MAX
|
||||
|
||||
|
||||
@pytest.mark.parametrize('speed', [3., 5., 8.])
|
||||
def test_extended_takeoff_still_obeys_selected_cap_set_speed_and_cornering(speed):
|
||||
cp = candidate()[1]
|
||||
args = (False, 30., speed, 2., 0., cp, .05, 0., True)
|
||||
assert get_cruise_accel(False, 30., speed, .7, 0., cp, .05, 0., True, selected_acceleration_max=.7, faster_takeoffs=True) <= .7
|
||||
assert get_cruise_accel(False, speed + .1, speed, 0., 0., cp, .05, 0., True, faster_takeoffs=True) <= .1
|
||||
straight = get_cruise_accel(*args, faster_takeoffs=True)
|
||||
curve = get_cruise_accel(False, 30., speed, 2., 180., cp, .05, 0., True, faster_takeoffs=True)
|
||||
assert curve <= straight
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"protected_inventory_sha256": "4ac0382734f0124c3a27d78fef283d2082da2b07a9864339c899c3ffed881dbc", "schema_version": 1}
|
||||
{"protected_inventory_sha256": "0900e456a7922ffcd9c77651f2d1c3bafb1a754fa1fab83f1cad600160be3b7b", "schema_version": 1}
|
||||
|
||||
Reference in New Issue
Block a user