Local preservation snapshot, not a new deployment or simulation acceptance.
30 lines
1.1 KiB
Python
30 lines
1.1 KiB
Python
import importlib
|
|
from pathlib import Path
|
|
|
|
|
|
def test_native_audit_includes_first_step_and_detects_translation_and_roll(monkeypatch):
|
|
monkeypatch.syspath_prepend(str(Path(__file__).parents[1] / "simulation/ai-polygon"))
|
|
audit = importlib.import_module("sweep_qualification")
|
|
geometry = dict(
|
|
length_m=1.163, width_m=0.905, height_m=0.734, max_step_m=0.1, max_slope_degrees=25
|
|
)
|
|
rows = [
|
|
dict(
|
|
phase="hold",
|
|
dt=1 / 60,
|
|
request=[0, 0],
|
|
pre_step=dict(position=[0, 0, 0], heading=0),
|
|
position=[0, 0, 0],
|
|
quaternion_wxyz=[1, 0, 0, 0],
|
|
)
|
|
for _ in range(180)
|
|
]
|
|
assert audit.phase_metrics(rows, geometry)["passed"]
|
|
rows[0]["position"] = [0.1, 0, 0]
|
|
result = audit.phase_metrics(rows, geometry)
|
|
assert not result["passed"] and not result["windows"][0]["passed"]
|
|
rows[0]["position"] = [0, 0, 0]
|
|
rows[0]["quaternion_wxyz"] = [0.9659258263, 0.2588190451, 0, 0]
|
|
assert not audit.phase_metrics(rows, geometry)["passed"]
|
|
assert not audit.phase_metrics(rows[:10], geometry)["passed"]
|