Merge branch 'DH_Raman' of https://github.com/h840473807/Uni-Lab-OS into DH_Raman

This commit is contained in:
Hua Haiming
2025-05-16 18:06:07 +08:00
11 changed files with 110 additions and 55 deletions

View File

@@ -6,7 +6,7 @@ if(rclpy.ok() == False):
else: else:
print("rclpy already initiated") print("rclpy already initiated")
from unilabos.devices.dh_electrochem.dh_7000 import DH7000 from unilabos.devices.electrochem.dh_7000 import DH7000
from unilabos_msgs.action import SendCmd from unilabos_msgs.action import SendCmd
from std_msgs.msg import Float64, String, Int16 from std_msgs.msg import Float64, String, Int16
from unilabos.ros.device_node_wrapper import ros2_device_node from unilabos.ros.device_node_wrapper import ros2_device_node

View File

@@ -6,12 +6,10 @@ if(rclpy.ok() == False):
else: else:
print("rclpy already initiated") print("rclpy already initiated")
from unilabos.devices.opsky_Raman.opsky_ATR30007 import ATR30007 from unilabos.devices.raman_uv.opsky_ATR30007 import ATR30007
from unilabos_msgs.action import SendCmd from unilabos_msgs.action import SendCmd
from std_msgs.msg import Float64, String, Int16
from unilabos.ros.device_node_wrapper import ros2_device_node from unilabos.ros.device_node_wrapper import ros2_device_node
import clr
import os
# dll_path = r'D:\UniLab\code\DHElecChem\release64' # dll_path = r'D:\UniLab\code\DHElecChem\release64'
# eccore_dll_path = os.path.join(dll_path, 'ECCore.dll') # eccore_dll_path = os.path.join(dll_path, 'ECCore.dll')
# os.environ["PATH"] = dll_path + os.pathsep + os.environ["PATH"] # os.environ["PATH"] = dll_path + os.pathsep + os.environ["PATH"]

View File

@@ -498,7 +498,7 @@ class DH7000:
print(f"数据已保存到 {save_root}") print(f"数据已保存到 {save_root}")
# === Core: a unified dh_cmd method that calls start_eis or start_lsv according to methods === # === Core: a unified dh_cmd method that calls start_eis or start_lsv according to methods ===
def dh_cmd(self, command: str): def dh_cmd(self, method: str, command: str, resource: dict):
""" """
Unified handler for different commands such as EIS / LSV / CV / CA. Unified handler for different commands such as EIS / LSV / CV / CA.
In the incoming command JSON, use the key "methods" to specify the measurement type: "eis", "lsv", etc. In the incoming command JSON, use the key "methods" to specify the measurement type: "eis", "lsv", etc.
@@ -516,7 +516,7 @@ class DH7000:
print(f"命令参数: {cmd_dict}") print(f"命令参数: {cmd_dict}")
# Extract measurement method, default to "EIS" if not specified # Extract measurement method, default to "EIS" if not specified
method = cmd_dict.pop("methods", "eis").lower() # method = cmd_dict.pop("methods", "eis").lower()
# Extract file save path (may not be provided) # Extract file save path (may not be provided)
save_root = cmd_dict.get("save_root", r"D:\UniLab\results\test") save_root = cmd_dict.get("save_root", r"D:\UniLab\results\test")

View File

@@ -1,12 +1,9 @@
import clr
import os
import time
import pandas as pd
import json import json
import shutil import os
import sys
import time import clr
from System import Environment import pandas as pd
# define class ATR30007 # define class ATR30007
# this class is used to control the ATR30007 Raman workstation # this class is used to control the ATR30007 Raman workstation
@@ -15,6 +12,7 @@ class ATR30007:
def __init__(self, dll_path: str = r'D:\Raman_RS'): def __init__(self, dll_path: str = r'D:\Raman_RS'):
self.dll_path = dll_path self.dll_path = dll_path
self.machine = None self.machine = None
self.status = "Idle"
self._load_dll() self._load_dll()
def _load_dll(self): def _load_dll(self):
@@ -59,6 +57,7 @@ class ATR30007:
SetC_flag = self.machine.SetCool(CCDTemp) SetC_flag = self.machine.SetCool(CCDTemp)
print(f"SetC_flag:{SetC_flag}") print(f"SetC_flag:{SetC_flag}")
#开始采集光谱 #开始采集光谱
self.status = "Running"
Spect = self.machine.AcquireSpectrum() Spect = self.machine.AcquireSpectrum()
#开始采集光谱谱图数据转换 #开始采集光谱谱图数据转换
Spect_data = list(Spect.get_Data()) Spect_data = list(Spect.get_Data())
@@ -70,6 +69,8 @@ class ATR30007:
Spect_bLC = list(self.machine.BaseLineCorrect(Spect_data)) Spect_bLC = list(self.machine.BaseLineCorrect(Spect_data))
#对数据进行boxcar 平滑 #对数据进行boxcar 平滑
Spect_StB = list(self.machine.SmoothBoxcar(Spect_bLC, 10)) Spect_StB = list(self.machine.SmoothBoxcar(Spect_bLC, 10))
self.status = "Idle"
#关闭仪器 #关闭仪器
OFF_flag = wrapper.CloseDevice() OFF_flag = wrapper.CloseDevice()
print(f"OFF_flag: {OFF_flag}") print(f"OFF_flag: {OFF_flag}")

View File

@@ -0,0 +1,44 @@
# 色谱表征设备
hplc.agilent:
description: HPLC device
class:
module: unilabos.devices.hplc.AgilentHPLC:HPLCDriver
type: python
status_types:
device_status: String
could_run: Bool
driver_init_ok: Bool
is_running: Bool
finish_status: String
status_text: String
action_value_mappings:
execute_command_from_outer:
type: SendCmd
goal:
command: command
feedback: {}
result:
success: success
schema:
properties:
device_status:
type: string
could_run:
type: boolean
driver_init_ok:
type: boolean
is_running:
type: boolean
finish_status:
type: string
status_text:
type: string
required:
- device_status
- could_run
- driver_init_ok
- is_running
- finish_status
- status_text
additionalProperties: false
type: object

View File

@@ -0,0 +1,19 @@
# 电化学表征设备:电化学工作站、电池测试柜
electrochem_station.DongHua:
description: Donghua electrochem_station
class:
module: unilabos.devices.electrochem.dh_7000:DH7000
type: python
status_types:
status: String
action_value_mappings:
dh_cmd:
type: WorkStationRun
goal:
wf_name: method
params: command
resource: resource
feedback:
status: status
result:
success: success

View File

@@ -1,5 +1,5 @@
# 光学表征设备:红外、紫外可见、拉曼等 # 光学表征设备:红外、紫外可见、拉曼等
raman_home_made: raman.home_made:
description: Raman spectroscopy device description: Raman spectroscopy device
class: class:
module: unilabos.devices.raman_uv.home_made_raman:RamanObj module: unilabos.devices.raman_uv.home_made_raman:RamanObj
@@ -22,46 +22,24 @@ raman_home_made:
- status - status
additionalProperties: false additionalProperties: false
type: object type: object
hplc.agilent:
description: HPLC device raman.opsky_ATR30007:
description: Raman spectroscopy device
class: class:
module: unilabos.devices.hplc.AgilentHPLC:HPLCDriver module: unilabos.devices.raman_uv.opsky_raman:ATR30007
type: python type: python
status_types: status_types:
device_status: String status: String
could_run: Bool
driver_init_ok: Bool
is_running: Bool
finish_status: String
status_text: String
action_value_mappings: action_value_mappings:
execute_command_from_outer: start_Raman:
type: SendCmd type: GetRaman
goal: goal:
command: command integtime: IntegTime
feedback: {} ldpower: LdPower
result: ldwave: LdWave
success: success ccdtemp: CCDTemp
schema: filename: filename
properties: saveroot: saveroot
device_status: feedback:
type: string status: status
could_run: result: {}
type: boolean
driver_init_ok:
type: boolean
is_running:
type: boolean
finish_status:
type: string
status_text:
type: string
required:
- device_status
- could_run
- driver_init_ok
- is_running
- finish_status
- status_text
additionalProperties: false
type: object

View File

@@ -49,6 +49,8 @@ set(action_files
"action/Evaporate.action" "action/Evaporate.action"
"action/EvacuateAndRefill.action" "action/EvacuateAndRefill.action"
"action/GetRaman.action"
"action/WorkStationRun.action" "action/WorkStationRun.action"
"action/AGVTransfer.action" "action/AGVTransfer.action"
) )

View File

@@ -0,0 +1,13 @@
# Goal
int32 integtime
int32 ldpower
bool ldwave
float64 ccdtemp
string filename
string saveroot
---
# Result
string success
---
# Feedback
string status