movel_y
Control Universal Robots collaborative robots by moving them along the Y-axis using TCP commands. Specify the robot's IP address and distance in meters to execute precise linear movements for industrial automation tasks.
Instructions
命令指定IP机器人的TCP沿Y轴方向移动 IP:机器人地址 distance:移动距离(米)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ip | Yes | ||
| distance | Yes |
Implementation Reference
- Handler function for 'movel_y' tool. Gets current TCP pose, adjusts Y coordinate by distance, executes movel, confirms execution, and logs the generated script command.@mcp.tool() def movel_y(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[1] = pose[1] + 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)}")