Add traffic lane GPS weighting toolkit

This commit is contained in:
2026-06-19 20:16:09 -05:00
parent 247fd73107
commit 85d1e326ee
8 changed files with 480 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
import json
import subprocess
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
TOOL = ROOT / "tools" / "patch_traffic_lanes.py"
def test_patch_sample(tmp_path):
output = tmp_path / "patched.json"
result = subprocess.run(
[
sys.executable,
str(TOOL),
str(ROOT / "samples" / "traffic_resource.json"),
str(output),
],
check=True,
text=True,
capture_output=True,
)
assert "lanes changed: 2" in result.stdout
patched = json.loads(output.read_text(encoding="utf-8"))
lanes = patched["Data"]["RootChunk"]["data"]["lanes"]
assert lanes[0]["maxSpeed"] == 90
assert lanes[1]["maxSpeed"] == 45
assert lanes[2]["maxSpeed"] == 10