mirror of
https://github.com/deepmodeling/Uni-Lab-OS
synced 2026-03-24 05:42:10 +00:00
Merge branch 'dev' into feat/lab_resource
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import argparse
|
||||
import asyncio
|
||||
import os
|
||||
import platform
|
||||
import shutil
|
||||
import signal
|
||||
import sys
|
||||
@@ -358,7 +359,7 @@ def main():
|
||||
if BasicConfig.test_mode:
|
||||
print_status("启用测试模式:所有动作将模拟执行,不调用真实硬件", "warning")
|
||||
BasicConfig.communication_protocol = "websocket"
|
||||
machine_name = os.popen("hostname").read().strip()
|
||||
machine_name = platform.node()
|
||||
machine_name = "".join([c if c.isalnum() or c == "_" else "_" for c in machine_name])
|
||||
BasicConfig.machine_name = machine_name
|
||||
BasicConfig.vis_2d_enable = args_dict["2d_vis"]
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
import json
|
||||
from typing import Dict, Any
|
||||
|
||||
from pylabrobot.resources import Container
|
||||
from unilabos_msgs.msg import Resource
|
||||
|
||||
from unilabos.ros.msgs.message_converter import convert_from_ros_msg
|
||||
|
||||
|
||||
class RegularContainer(Container):
|
||||
@@ -16,12 +12,12 @@ class RegularContainer(Container):
|
||||
kwargs["size_y"] = 0
|
||||
if "size_z" not in kwargs:
|
||||
kwargs["size_z"] = 0
|
||||
|
||||
self.kwargs = kwargs
|
||||
self.state = {}
|
||||
super().__init__(*args, category="container", **kwargs)
|
||||
|
||||
def load_state(self, state: Dict[str, Any]):
|
||||
self.state = state
|
||||
super().load_state(state)
|
||||
|
||||
|
||||
def get_regular_container(name="container"):
|
||||
@@ -29,7 +25,6 @@ def get_regular_container(name="container"):
|
||||
r.category = "container"
|
||||
return r
|
||||
|
||||
#
|
||||
# class RegularContainer(object):
|
||||
# # 第一个参数必须是id传入
|
||||
# # noinspection PyShadowingBuiltins
|
||||
@@ -89,4 +84,4 @@ def get_regular_container(name="container"):
|
||||
# return to_dict
|
||||
#
|
||||
# def __str__(self):
|
||||
# return f"{self.id}"
|
||||
# return f"{self.id}"
|
||||
|
||||
@@ -16,6 +16,7 @@ if TYPE_CHECKING:
|
||||
|
||||
|
||||
EXTRA_CLASS = "unilabos_resource_class"
|
||||
FRONTEND_POSE_EXTRA = "unilabos_frontend_pose_extra"
|
||||
EXTRA_SAMPLE_UUID = "sample_uuid"
|
||||
EXTRA_UNILABOS_SAMPLE_UUID = "unilabos_sample_uuid"
|
||||
|
||||
@@ -74,6 +75,14 @@ class ResourceDictPositionObject(BaseModel):
|
||||
z: float = Field(description="Z coordinate", default=0.0)
|
||||
|
||||
|
||||
class ResourceDictPoseExtraObjectType(BaseModel):
|
||||
z_index: int
|
||||
|
||||
|
||||
class ResourceDictPoseExtraObject(BaseModel):
|
||||
z_index: Optional[int] = Field(alias="zIndex", default=None)
|
||||
|
||||
|
||||
class ResourceDictPositionType(TypedDict):
|
||||
size: ResourceDictPositionSizeType
|
||||
scale: ResourceDictPositionScaleType
|
||||
@@ -100,6 +109,7 @@ class ResourceDictPosition(BaseModel):
|
||||
cross_section_type: Literal["rectangle", "circle", "rounded_rectangle"] = Field(
|
||||
description="Cross section type", default="rectangle"
|
||||
)
|
||||
extra: Optional[ResourceDictPoseExtraObject] = Field(description="Extra data", default=None)
|
||||
|
||||
|
||||
class ResourceDictType(TypedDict):
|
||||
@@ -463,6 +473,7 @@ class ResourceTreeSet(object):
|
||||
"position3d": raw_pos,
|
||||
"rotation": d["rotation"],
|
||||
"cross_section_type": d.get("cross_section_type", "rectangle"),
|
||||
"extra": extra.get(FRONTEND_POSE_EXTRA)
|
||||
}
|
||||
|
||||
# 先构建当前节点的字典(不包含children)
|
||||
@@ -548,6 +559,7 @@ class ResourceTreeSet(object):
|
||||
name_to_uuid[node.res_content.name] = node.res_content.uuid
|
||||
all_states[node.res_content.name] = node.res_content.data
|
||||
name_to_extra[node.res_content.name] = node.res_content.extra
|
||||
name_to_extra[node.res_content.name][FRONTEND_POSE_EXTRA] = node.res_content.pose.extra
|
||||
name_to_extra[node.res_content.name][EXTRA_CLASS] = node.res_content.klass
|
||||
for child in node.children:
|
||||
collect_node_data(child, name_to_uuid, all_states, name_to_extra)
|
||||
|
||||
@@ -83,6 +83,7 @@
|
||||
"depth": 0
|
||||
},
|
||||
"content_type": [
|
||||
"container",
|
||||
"plate",
|
||||
"tip_rack",
|
||||
"plates",
|
||||
|
||||
Reference in New Issue
Block a user