movel_x
Control TCP movement of a Universal Robot along the X-axis by specifying the robot's IP address and desired distance in meters using the MCP server's command interface.
Instructions
命令指定IP机器人的TCP沿X轴方向移动 IP:机器人地址 distance:移动距离(米)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| distance | Yes | ||
| ip | Yes |
Implementation Reference
- The handler function for the 'movel_x' tool, decorated with @mcp.tool() which registers it in the MCP framework. It commands a robot at the given IP to move its TCP pose along the X-axis by the specified distance in meters, with connection checks and confirmation.@mcp.tool() def movel_x(ip: str, distance: float): """命令指定IP机器人的TCP沿X轴方向移动 IP:机器人地址 distance:移动距离(米)""" try: if '连接失败' in link_check(ip): return return_msg(f"与机器人的连接已断开。") pose = robot_list[ip].get_actual_tcp_pose() pose[0] = pose[0] + distance robot_list[ip].movel(pose) result = movelConfirm(ip, pose) cmd = f"movel(p[{'{:.4f}'.format(pose[0])},{'{:.4f}'.format(pose[1])},{'{:.4f}'.format(pose[2])},{'{:.4f}'.format(pose[3])},{'{:.4f}'.format(pose[4])},{'{:.4f}'.format(pose[5])},],0.5,0.25,0,0)" if result == 1: return return_msg(f"命令 {cmd} 已发送,移动完成。") else: return return_msg(f"命令 {cmd} 已发送,移动失败。") except Exception as e: logger.error(f"移动失败: {str(e)}") return return_msg(f"移动失败: {str(e)}")
- Input schema defined by type hints (ip: str, distance: float) and docstring describing parameters and purpose.def movel_x(ip: str, distance: float): """命令指定IP机器人的TCP沿X轴方向移动 IP:机器人地址 distance:移动距离(米)"""
- src/nonead_universal_robots_mcp/server.py:546-546 (registration)MCP decorator that registers the movel_x function as a tool.@mcp.tool()