sync main

This commit is contained in:
Xuwznln
2025-08-01 21:17:20 +08:00
parent f7cc9e9f2c
commit b014ab34f4
10 changed files with 4 additions and 707 deletions

View File

@@ -43,11 +43,10 @@ def convert_argv_dashes_to_underscores(args: argparse.ArgumentParser):
for i, arg in enumerate(sys.argv):
for option_string in option_strings:
if arg.startswith(option_string):
new_arg = arg[:2] + arg[2 : len(option_string)].replace("-", "_") + arg[len(option_string) :]
new_arg = arg[:2] + arg[2:len(option_string)].replace("-", "_") + arg[len(option_string):]
sys.argv[i] = new_arg
break
def parse_args():
"""解析命令行参数"""
parser = argparse.ArgumentParser(description="Start Uni-Lab Edge server.")
@@ -129,13 +128,6 @@ def parse_args():
default="",
help="实验室唯一ID也可通过环境变量 UNILABOS_MQCONFIG_LABID 设置或传入--config设置",
)
parser.add_argument(
"--loglevel",
type=str,
choices=["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"],
default="INFO",
help="设置日志级别 (DEBUG, INFO, WARNING, ERROR, CRITICAL),默认为 INFO",
)
return parser
@@ -159,22 +151,17 @@ def main():
if not os.path.exists(config_path):
print_status(
f"当前工作目录 {working_dir} 未找到local_config.py请通过 --config 传入 local_config.py 文件路径",
"error",
)
"error")
os._exit(1)
elif os.path.exists(working_dir) and os.path.exists(os.path.join(working_dir, "local_config.py")):
config_path = os.path.join(working_dir, "local_config.py")
elif not config_path and (
not os.path.exists(working_dir) or not os.path.exists(os.path.join(working_dir, "local_config.py"))
):
elif not config_path and (not os.path.exists(working_dir) or not os.path.exists(os.path.join(working_dir, "local_config.py"))):
print_status(f"未指定config路径可通过 --config 传入 local_config.py 文件路径", "info")
print_status(f"您是否为第一次使用?并将当前路径 {working_dir} 作为工作目录? (Y/n)", "info")
if input() != "n":
os.makedirs(working_dir, exist_ok=True)
config_path = os.path.join(working_dir, "local_config.py")
shutil.copy(
os.path.join(os.path.dirname(os.path.dirname(__file__)), "config", "example_config.py"), config_path
)
shutil.copy(os.path.join(os.path.dirname(os.path.dirname(__file__)), "config", "example_config.py"), config_path)
print_status(f"已创建 local_config.py 路径: {config_path}", "info")
print_status(f"请在文件夹中配置lab_id放入下载的CA.crt、lab.crt、lab.key重新启动本程序", "info")
os._exit(1)

View File

@@ -135,9 +135,6 @@ class PRCXI9300Handler(LiquidHandlerAbstract):
def set_liquid(self, wells: list[Well], liquid_names: list[str], volumes: list[float]):
return super().set_liquid(wells, liquid_names, volumes)
def set_liquid(self, wells: list[Well], liquid_names: list[str], volumes: list[float]):
return super().set_liquid(wells, liquid_names, volumes)
async def create_protocol(
self,
protocol_name: str = "",

View File

@@ -628,31 +628,6 @@ class HydrogenateProtocol(BaseModel):
time: str = Field(..., description="反应时间(如 '2 h'")
vessel: dict = Field(..., description="反应容器")
class AdjustPHProtocol(BaseModel):
vessel: str = Field(..., description="目标容器")
ph_value: float = Field(..., description="目标pH值") # 改为 ph_value
reagent: str = Field(..., description="酸碱试剂名称")
# 移除其他可选参数,使用默认值
class ResetHandlingProtocol(BaseModel):
solvent: str = Field(..., description="溶剂名称")
class DryProtocol(BaseModel):
compound: str = Field(..., description="化合物名称")
vessel: str = Field(..., description="目标容器")
class RecrystallizeProtocol(BaseModel):
ratio: str = Field(..., description="溶剂比例(如 '1:1', '3:7'")
solvent1: str = Field(..., description="第一种溶剂名称")
solvent2: str = Field(..., description="第二种溶剂名称")
vessel: str = Field(..., description="目标容器")
volume: float = Field(..., description="总体积 (mL)")
class HydrogenateProtocol(BaseModel):
temp: str = Field(..., description="反应温度(如 '45 °C'")
time: str = Field(..., description="反应时间(如 '2 h'")
vessel: str = Field(..., description="反应容器")
__all__ = [
"Point3D", "PumpTransferProtocol", "CleanProtocol", "SeparateProtocol",
"EvaporateProtocol", "EvacuateAndRefillProtocol", "AGVTransferProtocol",

View File

@@ -319,7 +319,6 @@ mock_chiller:
module: unilabos.devices.mock.mock_chiller:MockChiller
status_types:
current_temperature: float
get_status_info: dict
is_cooling: bool
is_heating: bool
purpose: str
@@ -738,7 +737,6 @@ mock_filter:
filtered_volume: float
filtrate_vessel: str
flow_rate: float
get_status_info: dict
is_filtering: bool
pressure_drop: float
progress: float
@@ -1360,7 +1358,6 @@ mock_heater:
module: unilabos.devices.mock.mock_heater:MockHeater
status_types:
current_temperature: float
get_status_info: dict
heating_power: float
is_heating: bool
max_temperature: float
@@ -1882,7 +1879,6 @@ mock_pump:
current_device: str
flow_rate: float
from_vessel: str
get_status_info: dict
is_solid: bool
is_viscous: bool
max_flow_rate: float
@@ -2303,7 +2299,6 @@ mock_rotavap:
type: EmptyIn
module: unilabos.devices.mock.mock_rotavap:MockRotavap
status_types:
get_status_info: dict
pump_state: str
pump_time: float
rotate_speed: float
@@ -3249,7 +3244,6 @@ mock_separator:
status_types:
current_device: str
from_vessel: str
get_status_info: dict
product_phase: str
purpose: str
repeats: int
@@ -3504,7 +3498,6 @@ mock_solenoid_valve:
type: StrSingleInput
module: unilabos.devices.mock.mock_solenoid_valve:MockSolenoidValve
status_types:
get_valve_status: str
status: str
valve_status: str
type: python
@@ -3767,7 +3760,6 @@ mock_stirrer:
type: EmptyIn
module: unilabos.devices.mock.mock_stirrer:MockStirrer
status_types:
get_status_info: dict
heating_power: float
heating_state: str
max_stir_speed: float
@@ -4301,7 +4293,6 @@ mock_stirrer_new:
type: StopStir
module: unilabos.devices.mock.mock_stirrer_new:MockStirrer_new
status_types:
get_status_info: dict
max_stir_speed: float
progress: float
purpose: str
@@ -4638,7 +4629,6 @@ mock_vacuum:
type: EmptyIn
module: unilabos.devices.mock.mock_vacuum:MockVacuum
status_types:
get_status_info: dict
max_pump_speed: float
power_state: str
pump_efficiency: float

View File

@@ -169,7 +169,6 @@ solenoid_valve:
type: StrSingleInput
module: unilabos.devices.pump_and_valve.solenoid_valve:SolenoidValve
status_types:
get_valve_position: str
status: str
valve_position: str
type: python
@@ -331,7 +330,6 @@ solenoid_valve.mock:
type: EmptyIn
module: unilabos.devices.pump_and_valve.solenoid_valve_mock:SolenoidValveMock
status_types:
get_valve_position: str
status: str
valve_position: str
type: python
@@ -754,14 +752,6 @@ syringe_pump_with_valve.runze:
write: send_command
module: unilabos.devices.pump_and_valve.runze_backbone:RunzeSyringePump
status_types:
get_max_velocity: String
get_plunger_position: String
get_position: String
get_status: String
get_valve_position: str
get_velocity_end: String
get_velocity_grade: String
get_velocity_init: String
max_velocity: float
mode: int
plunger_position: String

View File

@@ -432,261 +432,3 @@ robotic_arm.elite:
mesh: elite_robot
type: device
version: 1.0.0
robotic_arm.elite:
category:
- robot_arm
class:
action_value_mappings:
auto-close:
feedback: {}
goal: {}
goal_default: {}
handles: []
result: {}
schema:
description: ''
properties:
feedback: {}
goal:
properties: {}
required: []
type: object
result: {}
required:
- goal
title: close参数
type: object
type: UniLabJsonCommand
auto-modbus_close:
feedback: {}
goal: {}
goal_default: {}
handles: []
result: {}
schema:
description: ''
properties:
feedback: {}
goal:
properties: {}
required: []
type: object
result: {}
required:
- goal
title: modbus_close参数
type: object
type: UniLabJsonCommand
auto-modbus_read_holding_registers:
feedback: {}
goal: {}
goal_default:
quantity: null
start_addr: null
unit_id: null
handles: []
result: {}
schema:
description: ''
properties:
feedback: {}
goal:
properties:
quantity:
type: string
start_addr:
type: string
unit_id:
type: string
required:
- unit_id
- start_addr
- quantity
type: object
result: {}
required:
- goal
title: modbus_read_holding_registers参数
type: object
type: UniLabJsonCommand
auto-modbus_task:
feedback: {}
goal: {}
goal_default:
job_id: null
handles: []
result: {}
schema:
description: ''
properties:
feedback: {}
goal:
properties:
job_id:
type: string
required:
- job_id
type: object
result: {}
required:
- goal
title: modbus_task参数
type: object
type: UniLabJsonCommand
auto-modbus_write_single_register:
feedback: {}
goal: {}
goal_default:
register_addr: null
unit_id: null
value: null
handles: []
result: {}
schema:
description: ''
properties:
feedback: {}
goal:
properties:
register_addr:
type: string
unit_id:
type: string
value:
type: string
required:
- unit_id
- register_addr
- value
type: object
result: {}
required:
- goal
title: modbus_write_single_register参数
type: object
type: UniLabJsonCommand
auto-parse_success_response:
feedback: {}
goal: {}
goal_default:
response: null
handles: []
result: {}
schema:
description: ''
properties:
feedback: {}
goal:
properties:
response:
type: string
required:
- response
type: object
result: {}
required:
- goal
title: parse_success_response参数
type: object
type: UniLabJsonCommand
auto-send_command:
feedback: {}
goal: {}
goal_default:
command: null
handles: []
result: {}
schema:
description: ''
properties:
feedback: {}
goal:
properties:
command:
type: string
required:
- command
type: object
result: {}
required:
- goal
title: send_command参数
type: object
type: UniLabJsonCommand
modbus_task_cmd:
feedback: {}
goal:
command: command
goal_default:
command: ''
handles: []
result: {}
schema:
description: ''
properties:
feedback:
properties:
status:
type: string
required:
- status
title: SendCmd_Feedback
type: object
goal:
properties:
command:
type: string
required:
- command
title: SendCmd_Goal
type: object
result:
properties:
return_info:
type: string
success:
type: boolean
required:
- return_info
- success
title: SendCmd_Result
type: object
required:
- goal
title: SendCmd
type: object
type: SendCmd
module: unilabos.devices.arm.elite_robot:EliteRobot
status_types:
actual_joint_positions: String
arm_pose: list
type: python
config_info: []
description: Elite robot arm
handles: []
icon: ''
init_param_schema:
config:
properties:
device_id:
type: string
host:
type: string
required:
- device_id
- host
type: object
data:
properties:
actual_joint_positions:
type: string
arm_pose:
type: array
required:
- arm_pose
- actual_joint_positions
type: object
model:
mesh: elite_robot
type: device
version: 1.0.0

View File

@@ -522,8 +522,6 @@ heaterstirrer.dalong:
type: SendCmd
module: unilabos.devices.heaterstirrer.dalong:HeaterStirrer_DaLong
status_types:
get_status: str
get_temp: String
status: str
stir_speed: float
temp: float

View File

@@ -149,7 +149,6 @@ gas_source.mock:
type: StrSingleInput
module: unilabos.devices.pump_and_valve.vacuum_pump_mock:VacuumPumpMock
status_types:
get_status: str
status: str
type: python
config_info: []
@@ -329,7 +328,6 @@ vacuum_pump.mock:
type: StrSingleInput
module: unilabos.devices.pump_and_valve.vacuum_pump_mock:VacuumPumpMock
status_types:
get_status: str
status: str
type: python
config_info: []

View File

@@ -6102,381 +6102,6 @@ workstation:
title: initialize_device参数
type: object
type: UniLabJsonCommand
AdjustPHProtocol:
feedback: {}
goal:
vessel: vessel
ph_value: ph_value
reagent: reagent
goal_default:
vessel: ''
ph_value: 7.0
reagent: ''
handles:
input:
- data_key: vessel
data_source: handle
data_type: resource
handler_key: Vessel
label: Vessel
- data_key: reagent
data_source: handle
data_type: resource
handler_key: reagent
label: Reagent
output:
- data_key: vessel
data_source: executor
data_type: resource
handler_key: VesselOut
label: Vessel
result: {}
schema:
description: ROS Action AdjustPH 的 JSON Schema
properties:
feedback:
description: Action 反馈 - 执行过程中从服务器发送到客户端
properties:
status:
type: string
progress:
type: number
required:
- status
- progress
title: AdjustPH_Feedback
type: object
goal:
description: Action 目标 - 从客户端发送到服务器
properties:
vessel:
type: string
ph_value:
type: number
reagent:
type: string
required:
- vessel
- ph_value
- reagent
title: AdjustPH_Goal
type: object
result:
description: Action 结果 - 完成后从服务器发送到客户端
properties:
message:
type: string
return_info:
type: string
success:
type: boolean
required:
- success
- message
- return_info
title: AdjustPH_Result
type: object
required:
- goal
title: AdjustPH
type: object
type: AdjustPH
ResetHandlingProtocol:
feedback: {}
goal:
solvent: solvent
goal_default:
solvent: ''
handles:
input:
- data_key: solvent
data_source: handle
data_type: resource
handler_key: solvent
label: Solvent
output: []
result: {}
schema:
description: ROS Action ResetHandling 的 JSON Schema
properties:
feedback:
description: Action 反馈 - 执行过程中从服务器发送到客户端
properties:
status:
type: string
progress:
type: number
required:
- status
- progress
title: ResetHandling_Feedback
type: object
goal:
description: Action 目标 - 从客户端发送到服务器
properties:
solvent:
type: string
required:
- solvent
title: ResetHandling_Goal
type: object
result:
description: Action 结果 - 完成后从服务器发送到客户端
properties:
message:
type: string
return_info:
type: string
success:
type: boolean
required:
- success
- message
- return_info
title: ResetHandling_Result
type: object
required:
- goal
title: ResetHandling
type: object
type: ResetHandling
DryProtocol:
feedback: {}
goal:
compound: compound
vessel: vessel
goal_default:
compound: ''
vessel: ''
handles:
input:
- data_key: vessel
data_source: handle
data_type: resource
handler_key: Vessel
label: Vessel
output:
- data_key: vessel
data_source: executor
data_type: resource
handler_key: VesselOut
label: Vessel
result: {}
schema:
description: ROS Action Dry 的 JSON Schema
properties:
feedback:
description: Action 反馈 - 执行过程中从服务器发送到客户端
properties:
status:
type: string
progress:
type: number
required:
- status
- progress
title: Dry_Feedback
type: object
goal:
description: Action 目标 - 从客户端发送到服务器
properties:
compound:
type: string
vessel:
type: string
required:
- compound
- vessel
title: Dry_Goal
type: object
result:
description: Action 结果 - 完成后从服务器发送到客户端
properties:
message:
type: string
return_info:
type: string
success:
type: boolean
required:
- success
- message
- return_info
title: Dry_Result
type: object
required:
- goal
title: Dry
type: object
type: Dry
HydrogenateProtocol:
feedback: {}
goal:
temp: temp
time: time
vessel: vessel
goal_default:
temp: ''
time: ''
vessel: ''
handles:
input:
- data_key: vessel
data_source: handle
data_type: resource
handler_key: Vessel
label: Vessel
output:
- data_key: vessel
data_source: executor
data_type: resource
handler_key: VesselOut
label: Vessel
result: {}
schema:
description: ROS Action Hydrogenate 的 JSON Schema
properties:
feedback:
description: Action 反馈 - 执行过程中从服务器发送到客户端
properties:
status:
type: string
progress:
type: number
required:
- status
- progress
title: Hydrogenate_Feedback
type: object
goal:
description: Action 目标 - 从客户端发送到服务器
properties:
temp:
type: string
time:
type: string
vessel:
type: string
required:
- temp
- time
- vessel
title: Hydrogenate_Goal
type: object
result:
description: Action 结果 - 完成后从服务器发送到客户端
properties:
message:
type: string
return_info:
type: string
success:
type: boolean
required:
- success
- message
- return_info
title: Hydrogenate_Result
type: object
required:
- goal
title: Hydrogenate
type: object
type: Hydrogenate
RecrystallizeProtocol:
feedback: {}
goal:
ratio: ratio
solvent1: solvent1
solvent2: solvent2
vessel: vessel
volume: volume
goal_default:
ratio: ''
solvent1: ''
solvent2: ''
vessel: ''
volume: 0.0
handles:
input:
- data_key: vessel
data_source: handle
data_type: resource
handler_key: Vessel
label: Vessel
- data_key: solvent
data_source: handle
data_type: resource
handler_key: solvent1
label: Solvent 1
- data_key: solvent
data_source: handle
data_type: resource
handler_key: solvent2
label: Solvent 2
output:
- data_key: vessel
data_source: executor
data_type: resource
handler_key: VesselOut
label: Vessel
result: {}
schema:
description: ROS Action Recrystallize 的 JSON Schema
properties:
feedback:
description: Action 反馈 - 执行过程中从服务器发送到客户端
properties:
status:
type: string
progress:
type: number
required:
- status
- progress
title: Recrystallize_Feedback
type: object
goal:
description: Action 目标 - 从客户端发送到服务器
properties:
ratio:
type: string
solvent1:
type: string
solvent2:
type: string
vessel:
type: string
volume:
type: number
required:
- ratio
- solvent1
- solvent2
- vessel
- volume
title: Recrystallize_Goal
type: object
result:
description: Action 结果 - 完成后从服务器发送到客户端
properties:
message:
type: string
return_info:
type: string
success:
type: boolean
required:
- success
- message
- return_info
title: Recrystallize_Result
type: object
required:
- goal
title: Recrystallize
type: object
type: Recrystallize
module: unilabos.ros.nodes.presets.protocol_node:ROS2ProtocolNode
status_types: {}
type: ros2