mirror of
https://github.com/dptech-corp/Uni-Lab-OS.git
synced 2026-02-06 23:15:10 +00:00
新增注册表补全功能,修复Protocol执行失败
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
import rtde_control
|
||||
import dashboard_client
|
||||
try:
|
||||
import rtde_control
|
||||
import dashboard_client
|
||||
import rtde_receive
|
||||
except ImportError as ex:
|
||||
print("Import Error, Please Install Packages in ur_arm_task.py First!", ex)
|
||||
import time
|
||||
import json
|
||||
from unilabos.devices.agv.robotiq_gripper import RobotiqGripper
|
||||
import rtde_receive
|
||||
from std_msgs.msg import Float64MultiArray
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
@@ -234,71 +234,71 @@ class Laiyu:
|
||||
resp_reset = self.reset()
|
||||
return actual_mass_mg
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
'''
|
||||
样例:对单个粉筒进行称量
|
||||
'''
|
||||
|
||||
modbus = Laiyu(port="COM25")
|
||||
|
||||
mass_test = modbus.add_powder_tube(1, 'h12', 6.0)
|
||||
print(f"实际出料质量:{mass_test}mg")
|
||||
|
||||
|
||||
'''
|
||||
样例:对单个粉筒进行称量
|
||||
'''
|
||||
'''
|
||||
样例: 对一份excel文件记录的化合物进行称量
|
||||
'''
|
||||
|
||||
modbus = Laiyu(port="COM25")
|
||||
excel_file = r"C:\auto\laiyu\test1.xlsx"
|
||||
# 定义输出文件路径,用于记录实际加样多少
|
||||
output_file = r"C:\auto\laiyu\test_output.xlsx"
|
||||
|
||||
mass_test = modbus.add_powder_tube(1, 'h12', 6.0)
|
||||
print(f"实际出料质量:{mass_test}mg")
|
||||
# 定义物料名称和料筒位置关系
|
||||
compound_positions = {
|
||||
'XPhos': '1',
|
||||
'Cu(OTf)2': '2',
|
||||
'CuSO4': '3',
|
||||
'PPh3': '4',
|
||||
}
|
||||
|
||||
# read excel file
|
||||
# excel_file = r"C:\auto\laiyu\test.xlsx"
|
||||
df = pd.read_excel(excel_file, sheet_name='Sheet1')
|
||||
# 读取Excel文件中的数据
|
||||
# 遍历每一行数据
|
||||
for index, row in df.iterrows():
|
||||
# 获取物料名称和质量
|
||||
copper_name = row['copper']
|
||||
copper_mass = row['copper_mass']
|
||||
ligand_name = row['ligand']
|
||||
ligand_mass = row['ligand_mass']
|
||||
target_tube_position = row['position']
|
||||
# 获取物料位置 from compound_positions
|
||||
copper_position = compound_positions.get(copper_name)
|
||||
ligand_position = compound_positions.get(ligand_name)
|
||||
# 判断物料位置是否存在
|
||||
if copper_position is None:
|
||||
print(f"物料位置不存在:{copper_name}")
|
||||
continue
|
||||
if ligand_position is None:
|
||||
print(f"物料位置不存在:{ligand_name}")
|
||||
continue
|
||||
# 加铜
|
||||
copper_actual_mass = modbus.add_powder_tube(int(copper_position), target_tube_position, copper_mass)
|
||||
time.sleep(1)
|
||||
# 加配体
|
||||
ligand_actual_mass = modbus.add_powder_tube(int(ligand_position), target_tube_position, ligand_mass)
|
||||
time.sleep(1)
|
||||
# 保存至df
|
||||
df.at[index, 'copper_actual_mass'] = copper_actual_mass
|
||||
df.at[index, 'ligand_actual_mass'] = ligand_actual_mass
|
||||
|
||||
'''
|
||||
样例: 对一份excel文件记录的化合物进行称量
|
||||
'''
|
||||
# 保存修改后的数据到新的Excel文件
|
||||
df.to_excel(output_file, index=False)
|
||||
print(f"已保存到文件:{output_file}")
|
||||
|
||||
excel_file = r"C:\auto\laiyu\test1.xlsx"
|
||||
# 定义输出文件路径,用于记录实际加样多少
|
||||
output_file = r"C:\auto\laiyu\test_output.xlsx"
|
||||
|
||||
# 定义物料名称和料筒位置关系
|
||||
compound_positions = {
|
||||
'XPhos': '1',
|
||||
'Cu(OTf)2': '2',
|
||||
'CuSO4': '3',
|
||||
'PPh3': '4',
|
||||
}
|
||||
|
||||
# read excel file
|
||||
# excel_file = r"C:\auto\laiyu\test.xlsx"
|
||||
df = pd.read_excel(excel_file, sheet_name='Sheet1')
|
||||
# 读取Excel文件中的数据
|
||||
# 遍历每一行数据
|
||||
for index, row in df.iterrows():
|
||||
# 获取物料名称和质量
|
||||
copper_name = row['copper']
|
||||
copper_mass = row['copper_mass']
|
||||
ligand_name = row['ligand']
|
||||
ligand_mass = row['ligand_mass']
|
||||
target_tube_position = row['position']
|
||||
# 获取物料位置 from compound_positions
|
||||
copper_position = compound_positions.get(copper_name)
|
||||
ligand_position = compound_positions.get(ligand_name)
|
||||
# 判断物料位置是否存在
|
||||
if copper_position is None:
|
||||
print(f"物料位置不存在:{copper_name}")
|
||||
continue
|
||||
if ligand_position is None:
|
||||
print(f"物料位置不存在:{ligand_name}")
|
||||
continue
|
||||
# 加铜
|
||||
copper_actual_mass = modbus.add_powder_tube(int(copper_position), target_tube_position, copper_mass)
|
||||
time.sleep(1)
|
||||
# 加配体
|
||||
ligand_actual_mass = modbus.add_powder_tube(int(ligand_position), target_tube_position, ligand_mass)
|
||||
time.sleep(1)
|
||||
# 保存至df
|
||||
df.at[index, 'copper_actual_mass'] = copper_actual_mass
|
||||
df.at[index, 'ligand_actual_mass'] = ligand_actual_mass
|
||||
|
||||
# 保存修改后的数据到新的Excel文件
|
||||
df.to_excel(output_file, index=False)
|
||||
print(f"已保存到文件:{output_file}")
|
||||
|
||||
# 关闭串口
|
||||
modbus.ser.close()
|
||||
print("串口已关闭")
|
||||
# 关闭串口
|
||||
modbus.ser.close()
|
||||
print("串口已关闭")
|
||||
|
||||
|
||||
@@ -3,7 +3,11 @@ import sys
|
||||
import io
|
||||
# sys.path.insert(0, r'C:\kui\winprep_cli\winprep_c_Uni-lab\x64\Debug')
|
||||
|
||||
import winprep_c
|
||||
try:
|
||||
import winprep_c
|
||||
except ImportError as e:
|
||||
print("Error importing winprep_c:", e)
|
||||
print("Please ensure that the winprep_c module is correctly installed and accessible.")
|
||||
from queue import Queue
|
||||
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ except Exception as e:
|
||||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "..")))
|
||||
from unilabos.utils.pywinauto_util import connect_application, get_process_pid_by_name, get_ui_path_with_window_specification, print_wrapper_identifiers
|
||||
from unilabos.device_comms.universal_driver import UniversalDriver, SingleRunningExecutor
|
||||
from unilabos.devices.template_driver import universal_driver as ud
|
||||
from unilabos.device_comms import universal_driver as ud
|
||||
print(f"使用文件DEBUG运行: {e}")
|
||||
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
|
||||
import time
|
||||
|
||||
class RamanObj:
|
||||
def __init__(self, port_laser,port_ccd, baudrate_laser=9600, baudrate_ccd=921600):
|
||||
def __init__(self, port_laser, port_ccd, baudrate_laser=9600, baudrate_ccd=921600):
|
||||
self.port_laser = port_laser
|
||||
self.port_ccd = port_ccd
|
||||
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import socket
|
||||
import json
|
||||
import base64
|
||||
import argparse
|
||||
import sys
|
||||
import json
|
||||
import socket
|
||||
import time
|
||||
|
||||
|
||||
@@ -96,17 +94,20 @@ class ZhidaClient:
|
||||
def abort(self) -> dict:
|
||||
return self._send_command({"command": "abort"})
|
||||
|
||||
"""
|
||||
a,b,c
|
||||
1,2,4
|
||||
2,4,5
|
||||
"""
|
||||
|
||||
client = ZhidaClient()
|
||||
# 连接
|
||||
client.connect()
|
||||
# 获取状态
|
||||
print(client.status)
|
||||
if __name__ == "__main__":
|
||||
|
||||
"""
|
||||
a,b,c
|
||||
1,2,4
|
||||
2,4,5
|
||||
"""
|
||||
|
||||
client = ZhidaClient()
|
||||
# 连接
|
||||
client.connect()
|
||||
# 获取状态
|
||||
print(client.status)
|
||||
|
||||
|
||||
# 命令格式:python zhida.py <subcommand> [options]
|
||||
# 命令格式:python zhida.py <subcommand> [options]
|
||||
|
||||
Reference in New Issue
Block a user