movel_z
Control Universal Robots collaborative robots by moving them along the Y-axis using TCP commands. Specify robot IP address and distance in meters for precise motion control.
Instructions
命令指定IP机器人的TCP沿Y轴方向移动 IP:机器人地址 distance:移动距离(米)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ip | Yes | ||
| distance | Yes |
Implementation Reference
- The main handler function for the 'movel_z' tool. It moves the robot's TCP along the Z-axis (pose[2]) by the specified distance for the given IP. Decorated with @mcp.tool() for registration in MCP.@mcp.tool() def movel_z(ip: str, distance: float): """命令指定IP机器人的TCP沿Y轴方向移动 IP:机器人地址 distance:移动距离(米)""" try: if '连接失败' in link_check(ip): return return_msg(f"与机器人的连接已断开。") pose = robot_list[ip].get_actual_tcp_pose() pose[2] = pose[2] + distance robot_list[ip].movel(pose) time.sleep(1) result = movelConfirm(ip, pose) cmd = (f"def my_program():\n" 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)\n" f"end\nmy_program()") logger.info(f"发送脚本:{cmd}") 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)}")