setup_multi_robot_coordination
Configure collaborative environments for multiple robots by specifying robot IDs and coordination modes like sequential, parallel, synchronous, or hierarchical.
Instructions
设置多机器人协同工作环境
参数:
- robot_ids: 参与协同的机器人ID列表
- collaboration_mode: 协作模式,可选值包括"sequential", "parallel", "synchronous", "hierarchical"
返回:
- 成功或失败的消息
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| robot_ids | Yes | ||
| collaboration_mode | No | parallel |
Implementation Reference
- The handler function decorated with @mcp.tool(), which registers and implements the setup_multi_robot_coordination tool. It sets up multi-robot coordination by registering robots and setting the collaboration mode using the AdvancedMultiRobotCoordinator.@mcp.tool() def setup_multi_robot_coordination(robot_ids: list, collaboration_mode: str = "parallel"): """ 设置多机器人协同工作环境 参数: - robot_ids: 参与协同的机器人ID列表 - collaboration_mode: 协作模式,可选值包括"sequential", "parallel", "synchronous", "hierarchical" 返回: - 成功或失败的消息 """ try: if multi_robot_coordinator is None: return return_msg("多机器人协调器未初始化") # 映射协作模式字符串到枚举值 mode_map = { "sequential": CollaborationMode.SEQUENTIAL, "parallel": CollaborationMode.PARALLEL, "synchronous": CollaborationMode.SYNCHRONOUS, "hierarchical": CollaborationMode.HIERARCHICAL } if collaboration_mode not in mode_map: return return_msg(f"不支持的协作模式: {collaboration_mode}") # 注册机器人到协调器 for robot_id in robot_ids: # 检查机器人是否已连接 if robot_id in robot_list and robot_list[robot_id].robotConnector.RTDE.isRunning(): multi_robot_coordinator.register_robot(robot_id) logger.info(f"机器人 {robot_id} 已注册到协调器") else: return return_msg(f"机器人 {robot_id} 未连接或不可用") # 设置协作模式 multi_robot_coordinator.set_collaboration_mode(mode_map[collaboration_mode]) return return_msg(f"多机器人协同环境设置成功,协作模式: {collaboration_mode}") except Exception as e: logger.error(f"设置多机器人协同环境失败: {str(e)}") return return_msg(f"设置多机器人协同环境失败: {str(e)}")
- src/nonead_universal_robots_mcp/server.py:820-820 (registration)The @mcp.tool() decorator registers the function as an MCP tool.@mcp.tool()
- Initialization of the multi_robot_coordinator used by the tool in initialize_extended_modules() function.multi_robot_coordinator = AdvancedMultiRobotCoordinator()