asw_component/__init__.py +3−0 View file@@ -0,0 +1,3 @@
1 +
from .component import execute 2 +
3 +
__all__ = ["execute"][참조 MVP] ICU 실행 플랫폼 — 센서 프레임과 A-SW 목표값을 ICU 액추에이터 명령 봉투로 변환합니다.
https://git.agrithing.ai/tymict/icu-platform.git 9d25865 6da7869 a692bac 633768f 32eeb5f 61498c4 32eeb5f38b778065d884d15a444a47110652dcac asw_component/__init__.py +3−0 View filefrom .component import execute__all__ = ["execute"]asw_component/component.py +13−0 View filefrom __future__ import annotationsdef _clamp(value, limit): return max(-limit, min(limit, value))def execute(payload: dict) -> dict: desired, limits = payload["desired"], payload["limits"] safe = payload.get("safety_state") == "RUN" command = { "steering_rad": _clamp(float(desired.get("steering_rad", 0)), float(limits["steering_rad"])) if safe else 0.0, "speed_mps": max(0.0, min(float(desired.get("speed_mps", 0)), float(limits["speed_mps"]))) if safe else 0.0, } return {"sequence": int(payload["sequence"]), "accepted": safe, "actuator_command": command, "transport": "CAN-FD"}examples/input.json +12−0 View file{ "sequence": 42, "desired": { "steering_rad": 0.2, "speed_mps": 1.5 }, "limits": { "steering_rad": 0.55, "speed_mps": 4 }, "safety_state": "RUN"}pyproject.toml +8−0 View file[project]name = "icu_platform"version = "0.1.0"description = "센서 프레임과 A-SW 목표값을 ICU 액추에이터 명령 봉투로 변환합니다."requires-python = ">=3.11"[tool.unittest]test-path = "tests"run.py +10−0 View filefrom __future__ import annotationsimport jsonimport sysfrom asw_component import executeif __name__ == "__main__": path = sys.argv[1] if len(sys.argv) > 1 else None with open(path, encoding="utf-8") if path else sys.stdin as source: payload = json.load(source) print(json.dumps(execute(payload), ensure_ascii=False, indent=2))