get_actual_tcp_pose
Retrieve the current TCP position of a Universal Robots collaborative robot by specifying its IP address to monitor or control its precise location.
Instructions
获取指定IP机器人的当前TCP位置 IP:机器人地址
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ip | Yes |
Implementation Reference
- The primary MCP tool handler for 'get_actual_tcp_pose'. It takes an IP address, checks the connection, and retrieves the current TCP pose from the connected UR robot instance (UrScriptExt), logging and returning the pose as a formatted message.@mcp.tool() def get_actual_tcp_pose(ip: str): """获取指定IP机器人的当前TCP位置 IP:机器人地址""" try: if '连接失败' in link_check(ip): return return_msg(f"与机器人的连接已断开。") logger.info(f"当前TCP位置: {robot_list[ip].get_actual_tcp_pose()}") return return_msg(f"当前TCP位置: {robot_list[ip].get_actual_tcp_pose()}") except Exception as e: logger.error(f"TCP位置获取失败: {str(e)}") return return_msg(f"TCP位置获取失败: {str(e)}")
- src/nonead_universal_robots_mcp/server.py:358-370 (registration)The @mcp.tool() decorator registers this function as an MCP tool in the FastMCP server. All such decorated functions are automatically registered when mcp.run() is called in main().@mcp.tool() def get_actual_tcp_pose(ip: str): """获取指定IP机器人的当前TCP位置 IP:机器人地址""" try: if '连接失败' in link_check(ip): return return_msg(f"与机器人的连接已断开。") logger.info(f"当前TCP位置: {robot_list[ip].get_actual_tcp_pose()}") return return_msg(f"当前TCP位置: {robot_list[ip].get_actual_tcp_pose()}") except Exception as e: logger.error(f"TCP位置获取失败: {str(e)}") return return_msg(f"TCP位置获取失败: {str(e)}")
- Input schema defined by function signature (ip: str) and docstring describing the parameter as the robot's IP address. Output is a JSON string via return_msg containing the TCP pose.def get_actual_tcp_pose(ip: str): """获取指定IP机器人的当前TCP位置 IP:机器人地址"""
- URBasic/urScriptExt.py:540-541 (helper)Supporting method in UrScriptExt that prints the actual TCP pose by calling the underlying get_actual_tcp_pose() method (likely inherited), which is delegated to by the MCP handler.self.print_pose(self.get_actual_tcp_pose())