mirror of
https://github.com/dptech-corp/Uni-Lab-OS.git
synced 2026-02-04 05:15:10 +00:00
Merge pull request #148 from lixinyu1011/workstation_dev_YB4
YB4branc_bylixinyu
This commit is contained in:
@@ -47,21 +47,50 @@
|
|||||||
{
|
{
|
||||||
"id": "BatteryStation",
|
"id": "BatteryStation",
|
||||||
"name": "扣电工作站",
|
"name": "扣电工作站",
|
||||||
|
"parent": null,
|
||||||
"children": [
|
"children": [
|
||||||
"coin_cell_deck"
|
"coin_cell_deck"
|
||||||
],
|
],
|
||||||
"parent": null,
|
|
||||||
"type": "device",
|
"type": "device",
|
||||||
"class": "coincellassemblyworkstation_device",
|
"class":"coincellassemblyworkstation_device",
|
||||||
"position": {
|
"position": {
|
||||||
"x": 600,
|
"x": -600,
|
||||||
"y": 400,
|
"y": -400,
|
||||||
"z": 0
|
"z": 0
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"debug_mode": false,
|
"deck": {
|
||||||
|
"data": {
|
||||||
|
"_resource_child_name": "YB_YH_Deck",
|
||||||
|
"_resource_type": "unilabos.devices.workstation.coin_cell_assembly.YB_YH_materials:CoincellDeck"
|
||||||
|
}
|
||||||
|
},
|
||||||
"protocol_type": []
|
"protocol_type": []
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "YB_YH_Deck",
|
||||||
|
"name": "YB_YH_Deck",
|
||||||
|
"children": [],
|
||||||
|
"parent": "BatteryStation",
|
||||||
|
"type": "deck",
|
||||||
|
"class": "CoincellDeck",
|
||||||
|
"position": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"z": 0
|
||||||
|
},
|
||||||
|
"config": {
|
||||||
|
"type": "CoincellDeck",
|
||||||
|
"setup": true,
|
||||||
|
"rotation": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"z": 0,
|
||||||
|
"type": "Rotation"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"data": {}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"links": []
|
"links": []
|
||||||
|
|||||||
@@ -109,44 +109,23 @@ def _coerce_deck_input(deck: Any) -> Optional[Deck]:
|
|||||||
#构建物料系统
|
#构建物料系统
|
||||||
|
|
||||||
class CoinCellAssemblyWorkstation(WorkstationBase):
|
class CoinCellAssemblyWorkstation(WorkstationBase):
|
||||||
def __init__(
|
def __init__(self,
|
||||||
self,
|
config: dict = None,
|
||||||
deck: Deck=None,
|
deck=None,
|
||||||
address: str = "172.21.33.176",
|
address: str = "172.21.33.176",
|
||||||
port: str = "502",
|
port: str = "502",
|
||||||
debug_mode: bool = False,
|
debug_mode: bool = False,
|
||||||
*args,
|
*args,
|
||||||
**kwargs,
|
**kwargs):
|
||||||
):
|
|
||||||
if deck is None and "deck" in kwargs:
|
|
||||||
deck = kwargs.pop("deck")
|
|
||||||
else:
|
|
||||||
kwargs.pop("deck", None)
|
|
||||||
|
|
||||||
normalized_deck = _coerce_deck_input(deck)
|
if deck is None and config:
|
||||||
|
deck = config.get('deck')
|
||||||
if deck is None and isinstance(normalized_deck, Deck):
|
else :
|
||||||
deck = normalized_deck
|
logger.info("没有传入依华deck,检查启动json文件")
|
||||||
|
super().__init__(deck=deck, *args, **kwargs,)
|
||||||
super().__init__(
|
|
||||||
#桌子
|
|
||||||
deck=deck,
|
|
||||||
*args,
|
|
||||||
**kwargs,
|
|
||||||
)
|
|
||||||
self.debug_mode = debug_mode
|
self.debug_mode = debug_mode
|
||||||
|
|
||||||
# 如果没有传入 deck,则创建标准配置的 deck
|
|
||||||
if self.deck is None:
|
|
||||||
self.deck = CoincellDeck(size_x=3650, size_y=1550, size_z=2100, origin=Coordinate(-2000, 100, 0),setup=True)
|
|
||||||
else:
|
|
||||||
# 如果传入了 deck 但还没有 setup,可以选择是否 setup
|
|
||||||
if self.deck is not None and len(self.deck.children) == 0:
|
|
||||||
# deck 为空,执行 setup
|
|
||||||
self.deck.setup()
|
|
||||||
# 否则使用传入的 deck(可能已经配置好了)
|
|
||||||
self.deck = self.deck
|
|
||||||
|
|
||||||
""" 连接初始化 """
|
""" 连接初始化 """
|
||||||
modbus_client = TCPClient(addr=address, port=port)
|
modbus_client = TCPClient(addr=address, port=port)
|
||||||
logger.debug(f"创建 Modbus 客户端: {modbus_client}")
|
logger.debug(f"创建 Modbus 客户端: {modbus_client}")
|
||||||
@@ -173,12 +152,7 @@ class CoinCellAssemblyWorkstation(WorkstationBase):
|
|||||||
self.csv_export_running = False
|
self.csv_export_running = False
|
||||||
self.csv_export_file = None
|
self.csv_export_file = None
|
||||||
self.coin_num_N = 0 #已组装电池数量
|
self.coin_num_N = 0 #已组装电池数量
|
||||||
#创建一个物料台面,包含两个极片板
|
|
||||||
#self._ros_node.update_resource(self.deck)
|
|
||||||
|
|
||||||
#ROS2DeviceNode.run_async_func(self._ros_node.update_resource, True, **{
|
|
||||||
# "resources": [self.deck]
|
|
||||||
#})
|
|
||||||
|
|
||||||
|
|
||||||
def post_init(self, ros_node: ROS2WorkstationNode):
|
def post_init(self, ros_node: ROS2WorkstationNode):
|
||||||
|
|||||||
@@ -34,3 +34,18 @@ BIOYOND_YB_Deck:
|
|||||||
init_param_schema: {}
|
init_param_schema: {}
|
||||||
registry_type: resource
|
registry_type: resource
|
||||||
version: 1.0.0
|
version: 1.0.0
|
||||||
|
CoincellDeck:
|
||||||
|
category:
|
||||||
|
- deck
|
||||||
|
class:
|
||||||
|
module: unilabos.devices.workstation.coin_cell_assembly.YB_YH_materials:CoincellDeck
|
||||||
|
type: pylabrobot
|
||||||
|
description: CoincellDeck
|
||||||
|
handles: []
|
||||||
|
icon: yihua.webp
|
||||||
|
init_param_schema: {}
|
||||||
|
registry_type: resource
|
||||||
|
version: 1.0.0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user