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

kitech/path-tracking-asw Private

[참조 MVP] 작업경로 추종 A-SW — 현재 자세와 경로에서 Pure Pursuit 방식의 조향 명령을 계산합니다.

https://git.agrithing.ai/kitech/path-tracking-asw.git
6 commits
COMMIT DETAIL

feat: add executable reference MVP

A-SW Reference Factory <[email protected]> · 2026. 8. 2. 오전 7:37:54
91d4eca535092cd74b03e8066ab54dcdf69b3a59
5 changed files +64 −0 parent 767167a
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 +20−0 View file
@@ -0,0 +1,20 @@
1 + from __future__ import annotations
2 + import math
3 +
4 +
5 + def execute(payload: dict) -> dict:
6 + pose, path = payload["pose"], payload["path"]
7 + lookahead = float(payload.get("lookahead_m", 2.5))
8 + wheelbase = float(payload.get("wheelbase_m", 2.1))
9 + if not path or lookahead <= 0 or wheelbase <= 0:
10 + raise ValueError("path, lookahead and wheelbase are required")
11 + x, y, heading = float(pose["x"]), float(pose["y"]), float(pose["heading_rad"])
12 + target = path[-1]
13 + for point in path:
14 + if math.hypot(point[0] - x, point[1] - y) >= lookahead:
15 + target = point
16 + break
17 + alpha = math.atan2(target[1] - y, target[0] - x) - heading
18 + steering = math.atan2(2 * wheelbase * math.sin(alpha), max(lookahead, 0.01))
19 + cross_track = min(math.hypot(px-x, py-y) for px, py in path)
20 + return {"target": target, "steering_rad": round(steering, 5), "cross_track_error_m": round(cross_track, 3)}
added examples/input.json +23−0 View file
@@ -0,0 +1,23 @@
1 + {
2 + "pose": {
3 + "x": 0,
4 + "y": 0,
5 + "heading_rad": 0
6 + },
7 + "path": [
8 + [
9 + 0,
10 + 0
11 + ],
12 + [
13 + 5,
14 + 1
15 + ],
16 + [
17 + 10,
18 + 1
19 + ]
20 + ],
21 + "lookahead_m": 3,
22 + "wheelbase_m": 2.1
23 + }
added pyproject.toml +8−0 View file
@@ -0,0 +1,8 @@
1 + [project]
2 + name = "path_tracking_asw"
3 + version = "0.1.0"
4 + description = "현재 자세와 경로에서 Pure Pursuit 방식의 조향 명령을 계산합니다."
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))