更新schema的title字段

This commit is contained in:
Xuwznln
2025-09-07 00:43:23 +08:00
parent 9ac0ad49cb
commit a555c59dc2
10 changed files with 694 additions and 515 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -336,7 +336,7 @@ separator.homemade:
- y
- z
- w
title: Quaternion
title: orientation
type: object
position:
properties:
@@ -350,12 +350,12 @@ separator.homemade:
- x
- y
- z
title: Point
title: position
type: object
required:
- position
- orientation
title: Pose
title: pose
type: object
sample_id:
type: string
@@ -372,7 +372,7 @@ separator.homemade:
- pose
- config
- data
title: Resource
title: vessel
type: object
required:
- vessel

View File

@@ -533,7 +533,7 @@ gripper.mock:
required:
- position
- max_effort
title: GripperCommand
title: command
type: object
required:
- command

View File

@@ -139,12 +139,12 @@ linear_motion.grbl:
required:
- sec
- nanosec
title: Time
title: stamp
type: object
required:
- stamp
- frame_id
title: Header
title: header
type: object
pose:
properties:
@@ -163,7 +163,7 @@ linear_motion.grbl:
- y
- z
- w
title: Quaternion
title: orientation
type: object
position:
properties:
@@ -177,17 +177,17 @@ linear_motion.grbl:
- x
- y
- z
title: Point
title: position
type: object
required:
- position
- orientation
title: Pose
title: pose
type: object
required:
- header
- pose
title: PoseStamped
title: current_pose
type: object
distance_remaining:
type: number
@@ -204,7 +204,7 @@ linear_motion.grbl:
required:
- sec
- nanosec
title: Duration
title: estimated_time_remaining
type: object
navigation_time:
properties:
@@ -219,7 +219,7 @@ linear_motion.grbl:
required:
- sec
- nanosec
title: Duration
title: navigation_time
type: object
number_of_poses_remaining:
maximum: 32767
@@ -262,12 +262,12 @@ linear_motion.grbl:
required:
- sec
- nanosec
title: Time
title: stamp
type: object
required:
- stamp
- frame_id
title: Header
title: header
type: object
pose:
properties:
@@ -286,7 +286,7 @@ linear_motion.grbl:
- y
- z
- w
title: Quaternion
title: orientation
type: object
position:
properties:
@@ -300,17 +300,17 @@ linear_motion.grbl:
- x
- y
- z
title: Point
title: position
type: object
required:
- position
- orientation
title: Pose
title: pose
type: object
required:
- header
- pose
title: PoseStamped
title: poses
type: object
type: array
required:
@@ -323,7 +323,7 @@ linear_motion.grbl:
result:
properties: {}
required: []
title: Empty
title: result
type: object
required:
- result
@@ -371,12 +371,12 @@ linear_motion.grbl:
required:
- sec
- nanosec
title: Time
title: stamp
type: object
required:
- stamp
- frame_id
title: Header
title: header
type: object
position:
type: number
@@ -406,7 +406,7 @@ linear_motion.grbl:
required:
- sec
- nanosec
title: Duration
title: min_duration
type: object
position:
type: number

View File

@@ -362,7 +362,7 @@ heaterstirrer.dalong:
- y
- z
- w
title: Quaternion
title: orientation
type: object
position:
properties:
@@ -376,12 +376,12 @@ heaterstirrer.dalong:
- x
- y
- z
title: Point
title: position
type: object
required:
- position
- orientation
title: Pose
title: pose
type: object
sample_id:
type: string
@@ -398,7 +398,7 @@ heaterstirrer.dalong:
- pose
- config
- data
title: Resource
title: vessel
type: object
required:
- vessel

View File

@@ -145,7 +145,7 @@ virtual_centrifuge:
- y
- z
- w
title: Quaternion
title: orientation
type: object
position:
properties:
@@ -159,12 +159,12 @@ virtual_centrifuge:
- x
- y
- z
title: Point
title: position
type: object
required:
- position
- orientation
title: Pose
title: pose
type: object
sample_id:
type: string
@@ -181,7 +181,7 @@ virtual_centrifuge:
- pose
- config
- data
title: Resource
title: vessel
type: object
required:
- vessel
@@ -446,7 +446,7 @@ virtual_column:
- y
- z
- w
title: Quaternion
title: orientation
type: object
position:
properties:
@@ -460,12 +460,12 @@ virtual_column:
- x
- y
- z
title: Point
title: position
type: object
required:
- position
- orientation
title: Pose
title: pose
type: object
sample_id:
type: string
@@ -482,7 +482,7 @@ virtual_column:
- pose
- config
- data
title: Resource
title: from_vessel
type: object
pct1:
type: string
@@ -531,7 +531,7 @@ virtual_column:
- y
- z
- w
title: Quaternion
title: orientation
type: object
position:
properties:
@@ -545,12 +545,12 @@ virtual_column:
- x
- y
- z
title: Point
title: position
type: object
required:
- position
- orientation
title: Pose
title: pose
type: object
sample_id:
type: string
@@ -567,7 +567,7 @@ virtual_column:
- pose
- config
- data
title: Resource
title: to_vessel
type: object
required:
- from_vessel
@@ -850,7 +850,7 @@ virtual_filter:
- y
- z
- w
title: Quaternion
title: orientation
type: object
position:
properties:
@@ -864,12 +864,12 @@ virtual_filter:
- x
- y
- z
title: Point
title: position
type: object
required:
- position
- orientation
title: Pose
title: pose
type: object
sample_id:
type: string
@@ -886,7 +886,7 @@ virtual_filter:
- pose
- config
- data
title: Resource
title: filtrate_vessel
type: object
stir:
type: boolean
@@ -929,7 +929,7 @@ virtual_filter:
- y
- z
- w
title: Quaternion
title: orientation
type: object
position:
properties:
@@ -943,12 +943,12 @@ virtual_filter:
- x
- y
- z
title: Point
title: position
type: object
required:
- position
- orientation
title: Pose
title: pose
type: object
sample_id:
type: string
@@ -965,7 +965,7 @@ virtual_filter:
- pose
- config
- data
title: Resource
title: vessel
type: object
volume:
type: number
@@ -1071,8 +1071,8 @@ virtual_filter:
- status
- progress
- current_temp
- filtered_volume
- current_status
- filtered_volume
- message
- max_temp
- max_stir_speed
@@ -1455,7 +1455,7 @@ virtual_heatchill:
- y
- z
- w
title: Quaternion
title: orientation
type: object
position:
properties:
@@ -1469,12 +1469,12 @@ virtual_heatchill:
- x
- y
- z
title: Point
title: position
type: object
required:
- position
- orientation
title: Pose
title: pose
type: object
sample_id:
type: string
@@ -1491,7 +1491,7 @@ virtual_heatchill:
- pose
- config
- data
title: Resource
title: vessel
type: object
required:
- vessel
@@ -1610,7 +1610,7 @@ virtual_heatchill:
- y
- z
- w
title: Quaternion
title: orientation
type: object
position:
properties:
@@ -1624,12 +1624,12 @@ virtual_heatchill:
- x
- y
- z
title: Point
title: position
type: object
required:
- position
- orientation
title: Pose
title: pose
type: object
sample_id:
type: string
@@ -1646,7 +1646,7 @@ virtual_heatchill:
- pose
- config
- data
title: Resource
title: vessel
type: object
required:
- vessel
@@ -1747,7 +1747,7 @@ virtual_heatchill:
- y
- z
- w
title: Quaternion
title: orientation
type: object
position:
properties:
@@ -1761,12 +1761,12 @@ virtual_heatchill:
- x
- y
- z
title: Point
title: position
type: object
required:
- position
- orientation
title: Pose
title: pose
type: object
sample_id:
type: string
@@ -1783,7 +1783,7 @@ virtual_heatchill:
- pose
- config
- data
title: Resource
title: vessel
type: object
required:
- vessel
@@ -2923,7 +2923,7 @@ virtual_rotavap:
required:
- sec
- nanosec
title: Duration
title: time_remaining
type: object
time_spent:
properties:
@@ -2938,7 +2938,7 @@ virtual_rotavap:
required:
- sec
- nanosec
title: Duration
title: time_spent
type: object
required:
- status
@@ -2994,7 +2994,7 @@ virtual_rotavap:
- y
- z
- w
title: Quaternion
title: orientation
type: object
position:
properties:
@@ -3008,12 +3008,12 @@ virtual_rotavap:
- x
- y
- z
title: Point
title: position
type: object
required:
- position
- orientation
title: Pose
title: pose
type: object
sample_id:
type: string
@@ -3030,7 +3030,7 @@ virtual_rotavap:
- pose
- config
- data
title: Resource
title: vessel
type: object
required:
- vessel
@@ -3415,7 +3415,7 @@ virtual_separator:
- y
- z
- w
title: Quaternion
title: orientation
type: object
position:
properties:
@@ -3429,12 +3429,12 @@ virtual_separator:
- x
- y
- z
title: Point
title: position
type: object
required:
- position
- orientation
title: Pose
title: pose
type: object
sample_id:
type: string
@@ -3451,7 +3451,7 @@ virtual_separator:
- pose
- config
- data
title: Resource
title: from_vessel
type: object
product_phase:
type: string
@@ -3490,7 +3490,7 @@ virtual_separator:
- y
- z
- w
title: Quaternion
title: orientation
type: object
position:
properties:
@@ -3504,12 +3504,12 @@ virtual_separator:
- x
- y
- z
title: Point
title: position
type: object
required:
- position
- orientation
title: Pose
title: pose
type: object
sample_id:
type: string
@@ -3526,7 +3526,7 @@ virtual_separator:
- pose
- config
- data
title: Resource
title: product_vessel
type: object
purpose:
type: string
@@ -3569,7 +3569,7 @@ virtual_separator:
- y
- z
- w
title: Quaternion
title: orientation
type: object
position:
properties:
@@ -3583,12 +3583,12 @@ virtual_separator:
- x
- y
- z
title: Point
title: position
type: object
required:
- position
- orientation
title: Pose
title: pose
type: object
sample_id:
type: string
@@ -3605,7 +3605,7 @@ virtual_separator:
- pose
- config
- data
title: Resource
title: separation_vessel
type: object
settling_time:
type: number
@@ -3654,7 +3654,7 @@ virtual_separator:
- y
- z
- w
title: Quaternion
title: orientation
type: object
position:
properties:
@@ -3668,12 +3668,12 @@ virtual_separator:
- x
- y
- z
title: Point
title: position
type: object
required:
- position
- orientation
title: Pose
title: pose
type: object
sample_id:
type: string
@@ -3690,7 +3690,7 @@ virtual_separator:
- pose
- config
- data
title: Resource
title: to_vessel
type: object
vessel:
properties:
@@ -3727,7 +3727,7 @@ virtual_separator:
- y
- z
- w
title: Quaternion
title: orientation
type: object
position:
properties:
@@ -3741,12 +3741,12 @@ virtual_separator:
- x
- y
- z
title: Point
title: position
type: object
required:
- position
- orientation
title: Pose
title: pose
type: object
sample_id:
type: string
@@ -3763,7 +3763,7 @@ virtual_separator:
- pose
- config
- data
title: Resource
title: vessel
type: object
volume:
type: string
@@ -3802,7 +3802,7 @@ virtual_separator:
- y
- z
- w
title: Quaternion
title: orientation
type: object
position:
properties:
@@ -3816,12 +3816,12 @@ virtual_separator:
- x
- y
- z
title: Point
title: position
type: object
required:
- position
- orientation
title: Pose
title: pose
type: object
sample_id:
type: string
@@ -3838,7 +3838,7 @@ virtual_separator:
- pose
- config
- data
title: Resource
title: waste_phase_to_vessel
type: object
waste_vessel:
properties:
@@ -3875,7 +3875,7 @@ virtual_separator:
- y
- z
- w
title: Quaternion
title: orientation
type: object
position:
properties:
@@ -3889,12 +3889,12 @@ virtual_separator:
- x
- y
- z
title: Point
title: position
type: object
required:
- position
- orientation
title: Pose
title: pose
type: object
sample_id:
type: string
@@ -3911,7 +3911,7 @@ virtual_separator:
- pose
- config
- data
title: Resource
title: waste_vessel
type: object
required:
- vessel
@@ -4489,7 +4489,7 @@ virtual_solid_dispenser:
- y
- z
- w
title: Quaternion
title: orientation
type: object
position:
properties:
@@ -4503,12 +4503,12 @@ virtual_solid_dispenser:
- x
- y
- z
title: Point
title: position
type: object
required:
- position
- orientation
title: Pose
title: pose
type: object
sample_id:
type: string
@@ -4525,7 +4525,7 @@ virtual_solid_dispenser:
- pose
- config
- data
title: Resource
title: vessel
type: object
viscous:
type: boolean
@@ -4874,7 +4874,7 @@ virtual_stirrer:
- y
- z
- w
title: Quaternion
title: orientation
type: object
position:
properties:
@@ -4888,12 +4888,12 @@ virtual_stirrer:
- x
- y
- z
title: Point
title: position
type: object
required:
- position
- orientation
title: Pose
title: pose
type: object
sample_id:
type: string
@@ -4910,7 +4910,7 @@ virtual_stirrer:
- pose
- config
- data
title: Resource
title: vessel
type: object
required:
- vessel
@@ -5034,7 +5034,7 @@ virtual_stirrer:
- y
- z
- w
title: Quaternion
title: orientation
type: object
position:
properties:
@@ -5048,12 +5048,12 @@ virtual_stirrer:
- x
- y
- z
title: Point
title: position
type: object
required:
- position
- orientation
title: Pose
title: pose
type: object
sample_id:
type: string
@@ -5070,7 +5070,7 @@ virtual_stirrer:
- pose
- config
- data
title: Resource
title: vessel
type: object
required:
- vessel
@@ -5181,7 +5181,7 @@ virtual_stirrer:
- y
- z
- w
title: Quaternion
title: orientation
type: object
position:
properties:
@@ -5195,12 +5195,12 @@ virtual_stirrer:
- x
- y
- z
title: Point
title: position
type: object
required:
- position
- orientation
title: Pose
title: pose
type: object
sample_id:
type: string
@@ -5217,7 +5217,7 @@ virtual_stirrer:
- pose
- config
- data
title: Resource
title: vessel
type: object
required:
- vessel

File diff suppressed because it is too large Load Diff

View File

@@ -24,12 +24,11 @@ DEFAULT_PATHS = [Path(__file__).absolute().parent]
class Registry:
def __init__(self, registry_paths=None):
import ctypes
try:
import unilabos_msgs
except ImportError:
logger.error(
"[UniLab Registry] unilabos_msgs模块未找到请确保已根据官方文档安装unilabos_msgs包。"
)
logger.error("[UniLab Registry] unilabos_msgs模块未找到请确保已根据官方文档安装unilabos_msgs包。")
sys.exit(1)
try:
ctypes.CDLL(str(Path(unilabos_msgs.__file__).parent / "unilabos_msgs_s__rosidl_typesupport_c.pyd"))
@@ -53,7 +52,7 @@ class Registry:
# 其他状态变量
# self.is_host_mode = False # 移至BasicConfig中
def setup(self, complete_registry=False):
def setup(self, complete_registry=False, upload_registry=False):
# 检查是否已调用过setup
if self._setup_called:
logger.critical("[UniLab Registry] setup方法已被调用过不允许多次调用")
@@ -152,22 +151,22 @@ class Registry:
}
}
)
logger.debug(f"[UniLab Registry] ----------Setup----------")
logger.trace(f"[UniLab Registry] ----------Setup----------")
self.registry_paths = [Path(path).absolute() for path in self.registry_paths]
for i, path in enumerate(self.registry_paths):
sys_path = path.parent
logger.debug(f"[UniLab Registry] Path {i+1}/{len(self.registry_paths)}: {sys_path}")
logger.trace(f"[UniLab Registry] Path {i+1}/{len(self.registry_paths)}: {sys_path}")
sys.path.append(str(sys_path))
self.load_device_types(path, complete_registry)
if BasicConfig.enable_resource_load:
self.load_resource_types(path, complete_registry)
self.load_resource_types(path, complete_registry, upload_registry)
else:
logger.warning("跳过了资源注册表加载!")
logger.info("[UniLab Registry] 注册表设置完成")
# 标记setup已被调用
self._setup_called = True
def load_resource_types(self, path: os.PathLike, complete_registry: bool):
def load_resource_types(self, path: os.PathLike, complete_registry: bool, upload_registry: bool):
abs_path = Path(path).absolute()
resource_path = abs_path / "resources"
files = list(resource_path.glob("*/*.yaml"))
@@ -194,7 +193,12 @@ class Registry:
resource_info["handles"] = []
if "init_param_schema" not in resource_info:
resource_info["init_param_schema"] = {}
if complete_registry:
if "config_info" in resource_info:
del resource_info["config_info"]
if "file_path" in resource_info:
del resource_info["file_path"]
complete_data[resource_id] = copy.deepcopy(dict(sorted(resource_info.items())))
if upload_registry:
class_info = resource_info.get("class", {})
if len(class_info) and "module" in class_info:
if class_info.get("type") == "pylabrobot":
@@ -205,7 +209,6 @@ class Registry:
res_instance = res_class(res_class.__name__)
res_ulr = tree_to_list([resource_plr_to_ulab(res_instance)])
resource_info["config_info"] = res_ulr
complete_data[resource_id] = copy.deepcopy(dict(sorted(resource_info.items()))) # 稍后dump到文件
resource_info["registry_type"] = "resource"
resource_info["file_path"] = str(file.absolute()).replace("\\", "/")
complete_data = dict(sorted(complete_data.items()))
@@ -215,7 +218,7 @@ class Registry:
yaml.dump(complete_data, f, allow_unicode=True, default_flow_style=False, Dumper=NoAliasDumper)
self.resource_type_registry.update(data)
logger.debug(
logger.trace( # type: ignore
f"[UniLab Registry] Resource-{current_resource_number} File-{i+1}/{len(files)} "
+ f"Add {list(data.keys())}"
)
@@ -402,7 +405,7 @@ class Registry:
devices_path = abs_path / "devices"
device_comms_path = abs_path / "device_comms"
files = list(devices_path.glob("*.yaml")) + list(device_comms_path.glob("*.yaml"))
logger.debug(
logger.trace( # type: ignore
f"[UniLab Registry] devices: {devices_path.exists()}, device_comms: {device_comms_path.exists()}, "
+ f"total: {len(files)}"
)
@@ -447,6 +450,8 @@ class Registry:
if complete_registry:
device_config["class"]["status_types"].clear()
enhanced_info = get_enhanced_class_info(device_config["class"]["module"], use_dynamic=True)
if not enhanced_info.get("dynamic_import_success", False):
continue
device_config["class"]["status_types"].update(
{k: v["return_type"] for k, v in enhanced_info["status_methods"].items()}
)
@@ -517,6 +522,12 @@ class Registry:
for action_name, action_config in device_config["class"]["action_value_mappings"].items():
if "handles" not in action_config:
action_config["handles"] = {}
elif isinstance(action_config["handles"], list):
if len(action_config["handles"]):
logger.error(f"设备{device_id} {action_name} 的handles配置错误应该是字典类型")
continue
else:
action_config["handles"] = {}
if "type" in action_config:
action_type_str: str = action_config["type"]
# 通过Json发放指令而不是通过特殊的ros action进行处理
@@ -565,7 +576,7 @@ class Registry:
}
device_config["file_path"] = str(file.absolute()).replace("\\", "/")
device_config["registry_type"] = "device"
logger.debug(
logger.trace(
f"[UniLab Registry] Device-{current_device_number} File-{i+1}/{len(files)} Add {device_id} "
+ f"[{data[device_id].get('name', '未命名设备')}]"
)
@@ -627,7 +638,7 @@ class Registry:
lab_registry = Registry()
def build_registry(registry_paths=None, complete_registry=False):
def build_registry(registry_paths=None, complete_registry=False, upload_registry=False):
"""
构建或获取Registry单例实例
@@ -651,6 +662,6 @@ def build_registry(registry_paths=None, complete_registry=False):
lab_registry.registry_paths.append(path)
# 初始化注册表
lab_registry.setup(complete_registry)
lab_registry.setup(complete_registry, upload_registry)
return lab_registry

View File

@@ -0,0 +1,12 @@
#get_workstation_plate_resource:
# category:
# - workstation
# class:
# module: unilabos.devices.workstation.workstation_base:get_workstation_plate_resource
# type: pylabrobot
# description: workstation example resource
# handles: []
# icon: ''
# init_param_schema: {}
# registry_type: resource
# version: 1.0.0