mirror of
https://github.com/dptech-corp/Uni-Lab-OS.git
synced 2025-12-18 21:41:16 +00:00
easy resource creation logic
This commit is contained in:
@@ -51,11 +51,14 @@ class Registry:
|
|||||||
"add_resource_from_outer_easy": {
|
"add_resource_from_outer_easy": {
|
||||||
"type": msg_converter_manager.search_class("ResourceCreateFromOuterEasy"),
|
"type": msg_converter_manager.search_class("ResourceCreateFromOuterEasy"),
|
||||||
"goal": {
|
"goal": {
|
||||||
"resources": "resources",
|
"res_id": "res_id",
|
||||||
"device_ids": "device_ids",
|
"class_name": "class_name",
|
||||||
"bind_parent_ids": "bind_parent_ids",
|
"parent": "parent",
|
||||||
"bind_locations": "bind_locations",
|
"bind_locations": "bind_locations",
|
||||||
"other_calling_params": "other_calling_params",
|
"liquid_input_slot": "liquid_input_slot",
|
||||||
|
"liquid_type": "liquid_type",
|
||||||
|
"liquid_volume": "liquid_volume",
|
||||||
|
"slot_on_deck": "slot_on_deck",
|
||||||
},
|
},
|
||||||
"feedback": {},
|
"feedback": {},
|
||||||
"result": {
|
"result": {
|
||||||
|
|||||||
@@ -574,6 +574,7 @@ basic_type_map = {
|
|||||||
'int64': {'type': 'integer'},
|
'int64': {'type': 'integer'},
|
||||||
'uint64': {'type': 'integer', 'minimum': 0},
|
'uint64': {'type': 'integer', 'minimum': 0},
|
||||||
'double': {'type': 'number'},
|
'double': {'type': 'number'},
|
||||||
|
'float': {'type': 'number'},
|
||||||
'float32': {'type': 'number'},
|
'float32': {'type': 'number'},
|
||||||
'float64': {'type': 'number'},
|
'float64': {'type': 'number'},
|
||||||
'string': {'type': 'string'},
|
'string': {'type': 'string'},
|
||||||
|
|||||||
@@ -515,7 +515,7 @@ class BaseROS2DeviceNode(Node, Generic[T]):
|
|||||||
action_kwargs = convert_from_ros_msg_with_mapping(goal, action_value_mapping["goal"])
|
action_kwargs = convert_from_ros_msg_with_mapping(goal, action_value_mapping["goal"])
|
||||||
self.lab_logger().debug(f"接收到原始目标: {action_kwargs}")
|
self.lab_logger().debug(f"接收到原始目标: {action_kwargs}")
|
||||||
# 向Host查询物料当前状态,如果是host本身的增加物料的请求,则直接跳过
|
# 向Host查询物料当前状态,如果是host本身的增加物料的请求,则直接跳过
|
||||||
if action_name != "add_resource_from_outer":
|
if action_name not in ["add_resource_from_outer", "add_resource_from_outer_easy"]:
|
||||||
for k, v in goal.get_fields_and_field_types().items():
|
for k, v in goal.get_fields_and_field_types().items():
|
||||||
if v in ["unilabos_msgs/Resource", "sequence<unilabos_msgs/Resource>"]:
|
if v in ["unilabos_msgs/Resource", "sequence<unilabos_msgs/Resource>"]:
|
||||||
self.lab_logger().info(f"查询资源状态: Key: {k} Type: {v}")
|
self.lab_logger().info(f"查询资源状态: Key: {k} Type: {v}")
|
||||||
@@ -614,7 +614,7 @@ class BaseROS2DeviceNode(Node, Generic[T]):
|
|||||||
del future
|
del future
|
||||||
|
|
||||||
# 向Host更新物料当前状态
|
# 向Host更新物料当前状态
|
||||||
if action_name != "add_resource_from_outer":
|
if action_name not in ["add_resource_from_outer", "add_resource_from_outer_easy"]:
|
||||||
for k, v in goal.get_fields_and_field_types().items():
|
for k, v in goal.get_fields_and_field_types().items():
|
||||||
if v not in ["unilabos_msgs/Resource", "sequence<unilabos_msgs/Resource>"]:
|
if v not in ["unilabos_msgs/Resource", "sequence<unilabos_msgs/Resource>"]:
|
||||||
continue
|
continue
|
||||||
|
|||||||
@@ -143,7 +143,19 @@ class HostNode(BaseROS2DeviceNode):
|
|||||||
controller_config["update_rate"] = update_rate
|
controller_config["update_rate"] = update_rate
|
||||||
self.initialize_controller(controller_id, controller_config)
|
self.initialize_controller(controller_id, controller_config)
|
||||||
resources_config.insert(0, {
|
resources_config.insert(0, {
|
||||||
|
"id": "host_node",
|
||||||
|
"name": "host_node",
|
||||||
|
"parent": None,
|
||||||
|
"type": "device",
|
||||||
|
"class": "host_node",
|
||||||
|
"position": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"z": 0
|
||||||
|
},
|
||||||
|
"config": {},
|
||||||
|
"data": {},
|
||||||
|
"children": []
|
||||||
})
|
})
|
||||||
try:
|
try:
|
||||||
for bridge in self.bridges:
|
for bridge in self.bridges:
|
||||||
|
|||||||
Reference in New Issue
Block a user