fix: 修复资源移除时的父资源检查问题

在BaseROS2DeviceNode中,移除资源前添加对父资源是否为None的检查,避免空指针异常
同时更新Bottle和BottleCarrier类以支持**kwargs参数
修正测试文件中Liquid_feeding_beaker的大小写拼写错误
This commit is contained in:
ZiWei
2025-10-17 02:23:58 +08:00
parent f5753afb7c
commit 2d26c3fac6
3 changed files with 7 additions and 3 deletions

View File

@@ -582,6 +582,7 @@ class BaseROS2DeviceNode(Node, Generic[T]):
- update: 更新现有资源
- remove: 从资源树中移除资源
"""
from pylabrobot.resources import Resource as ResourcePLR
try:
data = json.loads(req.command)
results = []
@@ -672,7 +673,8 @@ class BaseROS2DeviceNode(Node, Generic[T]):
if callable(func):
func(found_plr_resources)
for plr_resource in found_plr_resources:
plr_resource.parent.unassign_child_resource(plr_resource)
if plr_resource.parent is not None:
plr_resource.parent.unassign_child_resource(plr_resource)
self.resource_tracker.remove_resource(plr_resource)
self.lab_logger().info(f"移除物料 {plr_resource} 及其子节点")
for res in other_plr_resources: