mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-10-01 03:43:46 +08:00
Sleppy time
This commit is contained in:
@@ -18,7 +18,13 @@ from opendbc.car.toyota.values import CAR as TOYOTA_CAR
|
||||
import openpilot.selfdrive.controls.lib.longitudinal_planner as longitudinal_planner_module
|
||||
from openpilot.selfdrive.controls.lib.longcontrol import LongCtrlState
|
||||
from openpilot.selfdrive.controls.lib.drive_helpers import CONTROL_N
|
||||
from openpilot.selfdrive.controls.lib.longitudinal_planner import LongitudinalPlanner, get_coast_accel, get_vehicle_min_accel, should_publish_planner_fcw
|
||||
from openpilot.selfdrive.controls.lib.longitudinal_planner import (
|
||||
LongitudinalPlanner,
|
||||
get_coast_accel,
|
||||
get_far_lead_coast_cap,
|
||||
get_vehicle_min_accel,
|
||||
should_publish_planner_fcw,
|
||||
)
|
||||
from openpilot.selfdrive.controls.lib.longitudinal_mpc_lib.long_mpc import (
|
||||
LongitudinalMpc,
|
||||
build_model_lead_trajectory,
|
||||
@@ -310,6 +316,24 @@ def test_mpc_panic_bypass_immediately_removes_duplicate_vision_filter():
|
||||
assert mpc.lead_v_filter.x == pytest.approx(10.0)
|
||||
|
||||
|
||||
def test_far_lead_coast_cap_delays_nonurgent_deceleration():
|
||||
lead = make_lead(status=True, d_rel=128.0, v_lead=16.7, a_lead=0.2, radar=True)
|
||||
|
||||
assert get_far_lead_coast_cap(lead, 26.6, 115.0, -0.43) == pytest.approx(-0.20)
|
||||
assert get_far_lead_coast_cap(lead, 26.6, 115.0, 0.10) == pytest.approx(0.10)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("d_rel,v_lead,a_lead,desired_gap", [
|
||||
(50.0, 20.0, 0.2, 45.0), # only a small gap remains
|
||||
(128.0, 8.0, 0.2, 115.0), # urgent closing time
|
||||
(128.0, 16.7, -0.5, 115.0), # the lead is braking materially
|
||||
])
|
||||
def test_far_lead_coast_cap_preserves_urgent_or_close_deceleration(d_rel, v_lead, a_lead, desired_gap):
|
||||
lead = make_lead(status=True, d_rel=d_rel, v_lead=v_lead, a_lead=a_lead, radar=True)
|
||||
|
||||
assert get_far_lead_coast_cap(lead, 26.6, desired_gap, -0.43) == pytest.approx(-0.43)
|
||||
|
||||
|
||||
def test_hrv_far_follow_output_slew_damps_only_continuous_safe_follow():
|
||||
v_ego = 24.0
|
||||
CP = CarInterface.get_non_essential_params(CAR.HONDA_HRV_3G)
|
||||
|
||||
Reference in New Issue
Block a user