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

kitech/path-generation-asw Private

[참조 MVP] 작업경로 생성 A-SW — 직사각형 농경지와 작업 폭으로 왕복형 커버리지 경로를 생성합니다.

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

feat: add executable reference MVP

A-SW Reference Factory <[email protected]> · 2026. 8. 2. 오전 7:37:53
9560b9df324fa89af91903900fa510dcda2c47e1
5 changed files +48 −0 parent 3d9ebb3
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 +21−0 View file
@@ -0,0 +1,21 @@
1 + from __future__ import annotations
2 +
3 +
4 + def execute(payload: dict) -> dict:
5 + width = float(payload["width_m"])
6 + height = float(payload["height_m"])
7 + spacing = float(payload["lane_spacing_m"])
8 + headland = float(payload.get("headland_m", 0))
9 + if width <= 0 or height <= 0 or spacing <= 0 or headland < 0:
10 + raise ValueError("field dimensions and spacing must be positive")
11 + if headland * 2 >= width or headland * 2 >= height:
12 + raise ValueError("headland leaves no workable area")
13 + x0, x1 = headland, width - headland
14 + y, y1, direction = headland, height - headland, 1
15 + points = []
16 + while y <= y1 + 1e-9:
17 + points.extend(([x0, round(y, 3)], [x1, round(y, 3)]) if direction == 1 else ([x1, round(y, 3)], [x0, round(y, 3)]))
18 + y += spacing
19 + direction *= -1
20 + distance = sum(((b[0]-a[0])**2 + (b[1]-a[1])**2)**0.5 for a, b in zip(points, points[1:]))
21 + return {"frame": "field_local", "waypoints": points, "path_length_m": round(distance, 3)}
added examples/input.json +6−0 View file
@@ -0,0 +1,6 @@
1 + {
2 + "width_m": 20,
3 + "height_m": 12,
4 + "lane_spacing_m": 4,
5 + "headland_m": 1
6 + }
added pyproject.toml +8−0 View file
@@ -0,0 +1,8 @@
1 + [project]
2 + name = "path_generation_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))