Complete Ford test identities and pinion setting description

This commit is contained in:
Dom
2026-10-27 18:50:26 -05:00
parent e4ad4faf9f
commit 05d14fc86e
5 changed files with 27 additions and 13 deletions
@@ -1,5 +1,6 @@
"""Explorer fixed preview must not broaden the admitted Mach-E strategy."""
from types import SimpleNamespace
from opendbc.car.ford.interface import CarInterface
import pytest
@@ -7,6 +8,11 @@ from opendbc.car.ford.explorer_lateral import ExplorerLateralController
from opendbc.car.ford.mache_lateral import MachELateralController
from opendbc.car.ford.values import CAR, CarControllerParams, FordFlags
def controller_params(car, flags):
cp = CarInterface.get_non_essential_params(car)
return SimpleNamespace(brand=cp.brand, safetyConfigs=cp.safetyConfigs, carFingerprint=car, flags=flags)
def model():
return SimpleNamespace(orientationRate=SimpleNamespace(z=[i * 0.01 for i in range(33)]))
@@ -14,14 +20,14 @@ def model():
@pytest.mark.parametrize("delay", (0.20, 0.30, 0.40))
def test_explorer_fixed_lookahead_selects_original_model_sample(delay):
owner = ExplorerLateralController(SimpleNamespace(carFingerprint=CAR.FORD_EXPLORER_MK6, flags=0))
owner = ExplorerLateralController(controller_params(CAR.FORD_EXPLORER_MK6, 0))
owner.set_inputs(model(), tuple(i * 0.1 for i in range(33)), delay, True)
assert owner._curvature_lookahead() == 0.20
assert owner._predicted_curvature(10.0, owner._curvature_lookahead()) == pytest.approx(0.002)
def test_mach_e_compatibility_keeps_current_provider_lookahead():
owner = MachELateralController(SimpleNamespace(carFingerprint=CAR.FORD_MUSTANG_MACH_E_MK1, flags=FordFlags.CANFD))
owner = MachELateralController(controller_params(CAR.FORD_MUSTANG_MACH_E_MK1, FordFlags.CANFD))
owner.set_inputs(model(), tuple(i * 0.1 for i in range(33)), 0.40, True)
assert owner._curvature_lookahead() == 0.40
assert owner._predicted_curvature(10.0, owner._curvature_lookahead()) == pytest.approx(0.004)
@@ -31,7 +37,7 @@ def test_explorer_strategy_rejects_unrelated_topology():
for car, flags in ((CAR.FORD_EXPLORER_MK6, FordFlags.CANFD),
(CAR.FORD_EDGE_MK2, FordFlags.ALT_STEER_ANGLE | FordFlags.NEW_PORT)):
with pytest.raises(ValueError):
ExplorerLateralController(SimpleNamespace(carFingerprint=car, flags=flags))
ExplorerLateralController(controller_params(car, flags))
@pytest.mark.parametrize("alpha,release", ((False, False), (True, False), (False, True), (True, True)))
@@ -59,7 +65,7 @@ def test_actual_interface_restores_explicit_longitudinal_ownership(alpha, releas
def test_classic_modern_envelope_withdraws_infeasible_speed_transition():
from opendbc.car.ford.explorer_lateral import bounded_command
from opendbc.car.ford.lateral_strategy import FordLateralResult
owner = ExplorerLateralController(SimpleNamespace(carFingerprint=CAR.FORD_EXPLORER_MK6, flags=0))
owner = ExplorerLateralController(controller_params(CAR.FORD_EXPLORER_MK6, 0))
result = bounded_command(owner, FordLateralResult(curvature=.02, active=True), .02, 20., .02)
assert not result.active
assert result.curvature == owner.curvature_last == 0.
@@ -69,7 +75,7 @@ def test_classic_modern_envelope_withdraws_infeasible_speed_transition():
def test_manual_turn_withdraws_without_mach_e_latch_or_gain_compensation():
from opendbc.car.ford.explorer_lateral import bounded_command
from opendbc.car.ford.lateral_strategy import FordLateralResult
owner = ExplorerLateralController(SimpleNamespace(carFingerprint=CAR.FORD_EXPLORER_MK6, flags=0))
owner = ExplorerLateralController(controller_params(CAR.FORD_EXPLORER_MK6, 0))
owner.manual_turn_detected = True
result = bounded_command(owner, FordLateralResult(active=True), .002, 10., .002)
assert not result.active
@@ -80,7 +86,7 @@ def test_manual_turn_withdraws_without_mach_e_latch_or_gain_compensation():
def test_speed_change_cap_cannot_escape_original_rate_interval():
from opendbc.car.ford.explorer_lateral import bounded_command
from opendbc.car.ford.lateral_strategy import FordLateralResult
owner = ExplorerLateralController(SimpleNamespace(carFingerprint=CAR.FORD_EXPLORER_MK6, flags=0))
owner = ExplorerLateralController(controller_params(CAR.FORD_EXPLORER_MK6, 0))
# At26m/s modernjerk admits~.000265, originalnative lookup only.000180.
# Modern bank-tolerant cap~.005309 requires.000211 fromprevious.005520.
result = bounded_command(owner, FordLateralResult(curvature=.00552, active=True), .00552, 26., .00552)
@@ -131,7 +137,7 @@ def test_typed_offset_eps_and_namespace_guards():
def test_final_intersection_preserves_source_rise_and_unwind(sign):
from opendbc.car.ford.explorer_lateral import bounded_command
from opendbc.car.ford.lateral_strategy import FordLateralResult
owner = ExplorerLateralController(SimpleNamespace(carFingerprint=CAR.FORD_EXPLORER_MK6, flags=0))
owner = ExplorerLateralController(controller_params(CAR.FORD_EXPLORER_MK6, 0))
rise = bounded_command(owner, FordLateralResult(curvature=sign*.0015, active=True), sign*.001, 26., sign*.001)
assert rise.curvature == pytest.approx(sign*.00108)
fall = bounded_command(owner, FordLateralResult(curvature=0., active=True), sign*.001, 26., sign*.001)
@@ -158,7 +164,7 @@ def test_classic_rate_endpoint_has_correct_decoded_sign(rate, expected):
def test_measured_recovery_with_empty_source_interval_withdraws(sign):
from opendbc.car.ford.explorer_lateral import bounded_command
from opendbc.car.ford.lateral_strategy import FordLateralResult
owner = ExplorerLateralController(SimpleNamespace(carFingerprint=CAR.FORD_EXPLORER_MK6, flags=0))
owner = ExplorerLateralController(controller_params(CAR.FORD_EXPLORER_MK6, 0))
command = bounded_command(owner, FordLateralResult(curvature=sign*.008, active=True), 0., 35., sign*.008)
assert not command.active and command.curvature == 0.
assert owner.curvature_last == owner.path_angle_last == 0.
@@ -168,7 +174,7 @@ def test_measured_recovery_with_empty_source_interval_withdraws(sign):
def test_measured_window_requires_recovery_and_bounds_unwind(sign):
from opendbc.car.ford.explorer_lateral import bounded_command
from opendbc.car.ford.lateral_strategy import FordLateralResult
owner = ExplorerLateralController(SimpleNamespace(carFingerprint=CAR.FORD_EXPLORER_MK6, flags=0))
owner = ExplorerLateralController(controller_params(CAR.FORD_EXPLORER_MK6, 0))
# Recovery outside the error window may proceed when source fall permits it.
recovery = bounded_command(owner, FordLateralResult(curvature=sign*.001, active=True), sign*.003, 35., 0.)
delta = CarControllerParams.CURVATURE_LIMITS.MAX_LATERAL_JERK / 35.**2 * .05
@@ -1,5 +1,6 @@
"""Original-derived Mach-E demand and driver handoff regressions."""
from types import SimpleNamespace
from opendbc.car.ford.interface import CarInterface
import pytest
from opendbc.car import Bus, structs
from opendbc.car.lateral import MAX_LATERAL_JERK
@@ -11,10 +12,15 @@ from opendbc.car.ford.tests.test_three_ports import params
from opendbc.car.ford.carcontroller import CarController
from opendbc.car.ford.carstate import CarState
def controller_params(car, flags):
cp = CarInterface.get_non_essential_params(car)
return SimpleNamespace(brand=cp.brand, safetyConfigs=cp.safetyConfigs, carFingerprint=car, flags=flags)
@pytest.fixture
def controller():
owner = MachELateralController(SimpleNamespace(flags=FordFlags.CANFD, carFingerprint=CAR.FORD_MUSTANG_MACH_E_MK1))
owner = MachELateralController(controller_params(CAR.FORD_MUSTANG_MACH_E_MK1, FordFlags.CANFD))
model = SimpleNamespace(orientationRate=SimpleNamespace(z=[0.]*33),
meta=SimpleNamespace(laneChangeState=0, laneChangeDirection=0))
owner.set_inputs(model, tuple(i*.1 for i in range(33)), .2, True)
@@ -373,7 +379,7 @@ def test_actual_controller_announces_before_full_physical_frame_and_resets_off()
def test_modern_transient_bound_updates_emitted_history_without_hidden_windup():
owner = MachELateralController(SimpleNamespace(flags=FordFlags.CANFD, carFingerprint=CAR.FORD_MUSTANG_MACH_E_MK1))
owner = MachELateralController(controller_params(CAR.FORD_MUSTANG_MACH_E_MK1, FordFlags.CANFD))
raw = FordLateralResult(curvature=.006, path_angle=.16, active=True)
command = bounded_command(owner, raw, .001, 15.)
assert command.curvature < raw.curvature
@@ -389,7 +395,7 @@ def test_modern_transient_bound_updates_emitted_history_without_hidden_windup():
@pytest.mark.parametrize("sign", (-1, 1))
def test_speed_changes_intersect_bounds_or_withdraw_and_preserve_path_headroom(sign):
owner = MachELateralController(SimpleNamespace(flags=FordFlags.CANFD, carFingerprint=CAR.FORD_MUSTANG_MACH_E_MK1))
owner = MachELateralController(controller_params(CAR.FORD_MUSTANG_MACH_E_MK1, FordFlags.CANFD))
previous, path = sign * .0198, sign * .055
for speed in (5., 5.1, 5.2, 5.3, 8., 15., 5.):
demand = FordLateralResult(curvature=sign*.02, path_angle=sign*.16, active=True)
@@ -6,6 +6,7 @@ This presentation catalog supplies the purpose before any genuine prerequisite.
from openpilot.starpilot.ui.long_profile_feature import CATEGORY_HELP, VALUE_HELP
DESCRIPTIONS = {
'FordPrefSteerAngleCurvature': 'Uses steering pinion angle instead of yaw rate to estimate Ford steering curvature. Applies at the next vehicle startup.',
'lane_change:turn_signal_guidance': 'Uses your turn signal to help the model choose a turning path at intersections.',
'AlphaLongitudinalEnabled': ('Requests StarPilot speed control instead of factory ACC. May disable Automatic Emergency Braking. ' +
'Applies after the next startup; exact vehicle takeover checks remain required.'),
@@ -28,6 +28,7 @@
"ForceStopDistanceOffset",
"ForceStops",
"FordLateralMode",
"FordPrefSteerAngleCurvature",
"GMAutoHold",
"GMLongitudinalTune",
"GMPedalLongitudinal",
+1 -1
View File
@@ -1 +1 @@
{"protected_inventory_sha256": "06233ed7a0ce625bebf465e3550c89ba7d9b8c4047c33c3d80933fbcf9358a09", "schema_version": 1}
{"protected_inventory_sha256": "6da4fd83aab12b238ffe8afbdeecf6f0e4603e4dd92b7bbabd9c858bfb2f9341", "schema_version": 1}