A-SW Hub / Repositories
Local Gitea · READ ONLY
← 저장소 Repositories
REPOSITORY

kitech/speed-control-asw Private

[참조 MVP] 작업 속도 제어 A-SW — 곡률, 작업 종류와 장애물 거리를 이용해 안전 목표 속도를 산정합니다.

https://git.agrithing.ai/kitech/speed-control-asw.git
6 commits
COMMIT DETAIL

feat: add executable reference MVP

A-SW Reference Factory <[email protected]> · 2026. 8. 2. 오전 7:37:55
f7e21c80eec37a48917921236755f75e6be7238a
5 changed files +45 −0 parent 5bb5e1a
added asw_component/__init__.py +3−0 View file
@@ -0,0 +1,3 @@
1 + from .component import execute
2 +
3 + __all__ = ["execute"]
added asw_component/component.py +18−0 View file
@@ -0,0 +1,18 @@
1 + from __future__ import annotations
2 +
3 + MODE_FACTOR = {"transport": 1.0, "seeding": 0.65, "tillage": 0.5, "spraying": 0.75}
4 +
5 + def execute(payload: dict) -> dict:
6 + maximum = float(payload["max_speed_mps"])
7 + curvature = abs(float(payload.get("curvature", 0)))
8 + distance = float(payload.get("obstacle_distance_m", 999))
9 + mode = payload.get("work_mode", "transport")
10 + if maximum <= 0:
11 + raise ValueError("max_speed_mps must be positive")
12 + target = maximum * MODE_FACTOR.get(mode, 0.6) / (1 + 3.5 * curvature)
13 + reason = "nominal"
14 + if distance < 2:
15 + target, reason = 0.0, "obstacle_stop"
16 + elif distance < 5:
17 + target, reason = min(target, maximum * 0.25), "obstacle_slowdown"
18 + return {"target_speed_mps": round(target, 3), "mode": mode, "limiting_reason": reason}
added examples/input.json +6−0 View file
@@ -0,0 +1,6 @@
1 + {
2 + "max_speed_mps": 3,
3 + "curvature": 0.12,
4 + "work_mode": "seeding",
5 + "obstacle_distance_m": 7
6 + }
added pyproject.toml +8−0 View file
@@ -0,0 +1,8 @@
1 + [project]
2 + name = "speed_control_asw"
3 + version = "0.1.0"
4 + description = "곡률, 작업 종류와 장애물 거리를 이용해 안전 목표 속도를 산정합니다."
5 + requires-python = ">=3.11"
6 +
7 + [tool.unittest]
8 + test-path = "tests"
added run.py +10−0 View file
@@ -0,0 +1,10 @@
1 + from __future__ import annotations
2 + import json
3 + import sys
4 + from asw_component import execute
5 +
6 + if __name__ == "__main__":
7 + path = sys.argv[1] if len(sys.argv) > 1 else None
8 + with open(path, encoding="utf-8") if path else sys.stdin as source:
9 + payload = json.load(source)
10 + print(json.dumps(execute(payload), ensure_ascii=False, indent=2))