From d0606c24269c90a3f56f3877f692f01343686010 Mon Sep 17 00:00:00 2001 From: Cutshion Date: Tue, 3 Nov 2026 18:16:24 +0900 Subject: [PATCH] Support new maps without markers or a charging dock Co-Authored-By: Claude Opus 5.5 --- api/server.py | 4 ++-- robot/agv.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api/server.py b/api/server.py index 51f136d..5c7a848 100644 --- a/api/server.py +++ b/api/server.py @@ -690,12 +690,12 @@ def jog_stop(): @app.get("/map/info", tags=["map"], summary="Current map, its geometry, the markers with poses and all maps") def map_info(): cur = agv.request("/api/map/get_current_map")["results"] - marks = agv.request("/api/markers/query_list")["results"] + marks = agv.request("/api/markers/query_list")["results"] or {} # None on a map without markers maps = agv.request("/api/map/list")["results"] markers = [{"name": n, "type": m.get("key"), "x": m["pose"]["position"]["x"], "y": m["pose"]["position"]["y"], "theta": 2 * math.atan2(m["pose"]["orientation"]["z"], m["pose"]["orientation"]["w"])} for n, m in marks.items() if m.get("floor", 1) == cur["floor"]] - return {"map_name": cur["map_name"], "floor": cur["floor"], **cur["info"], "markers": markers, + return {"map_name": cur["map_name"], "floor": cur["floor"], **cur.get("info", {}), "markers": markers, "main_dock": agv.dock_marker(), # "home"; further docks (dock2) keep their names "maps": [{"name": n, "floors": f} for n, f in sorted(maps.items())]} diff --git a/robot/agv.py b/robot/agv.py index 825c78d..20d88f4 100644 --- a/robot/agv.py +++ b/robot/agv.py @@ -12,7 +12,7 @@ import time import uuid AGV = ("192.168.10.10", 31001) -DOCK_FALLBACK = "충전위치로" # dock marker name on the old map; on any map the type-11 marker is used +DOCK_FALLBACK = "home" # a map without a dock (type 11): a plain marker named "home" MARKERS_FRESH_S = 5.0 # known_markers() reads the list again after this long: a new map is seen within it _known = {"t": 0.0, "names": []} # One connection kept open per process: the base answers the first command on a new connection only after ~100 ms