From 88ae56806cd9892799f22aa8c1b79a0cc7f57f86 Mon Sep 17 00:00:00 2001 From: Junhan Chang Date: Sat, 18 Oct 2025 20:53:03 +0800 Subject: [PATCH] add layout serializer & converter --- unilabos/resources/itemized_carrier.py | 2 ++ unilabos/ros/nodes/resource_tracker.py | 1 + 2 files changed, 3 insertions(+) diff --git a/unilabos/resources/itemized_carrier.py b/unilabos/resources/itemized_carrier.py index ddda316f..5f1a93c9 100644 --- a/unilabos/resources/itemized_carrier.py +++ b/unilabos/resources/itemized_carrier.py @@ -74,6 +74,7 @@ class ItemizedCarrier(ResourcePLR): num_items_x: int = 0, num_items_y: int = 0, num_items_z: int = 0, + layout: str = "x-y", sites: Optional[Dict[Union[int, str], Optional[ResourcePLR]]] = None, category: Optional[str] = "carrier", model: Optional[str] = None, @@ -405,6 +406,7 @@ class ItemizedCarrier(ResourcePLR): "num_items_x": self.num_items_x, "num_items_y": self.num_items_y, "num_items_z": self.num_items_z, + "layout": self.layout, "sites": [{ "label": str(identifier), "visible": True if self[identifier] is not None else False, diff --git a/unilabos/ros/nodes/resource_tracker.py b/unilabos/ros/nodes/resource_tracker.py index 35d4529a..cd533aab 100644 --- a/unilabos/ros/nodes/resource_tracker.py +++ b/unilabos/ros/nodes/resource_tracker.py @@ -342,6 +342,7 @@ class ResourceTreeSet(object): pos = { "size": {"width": d["size_x"], "height": d["size_y"], "depth": d["size_z"]}, "scale": {"x": 1.0, "y": 1.0, "z": 1.0}, + "layout": d.get("layout", "x-y"), "position": raw_pos, "position3d": raw_pos, "rotation": d["rotation"],