Skip to main content
Glama

draw_circle

Control industrial robots to draw circles by specifying center coordinates, radius, and orientation plane. Use this tool to program circular paths for robotic applications with Universal Robots.

Instructions

命令指定IP的机器人,给定圆心位置和半径,在水平或竖直方向画一个圆 center:圆心的TCP位置 r:半径(米) coordinate:圆所在的平面。z:圆形所在的平面与基座所在平面垂直,其它:圆形所在的平面与基座所在平面平行。默认值:z。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ipYes
centerYes
rYes
coordinateNoz

Implementation Reference

  • The handler function for the 'draw_circle' MCP tool. It calculates four waypoints around the given center and radius in the specified plane (z or other), generates a URScript program using movep and two movec commands to trace a circle, logs the script, sends it to the robot via RealTimeClient, and returns a success message or error.
    @mcp.tool() def draw_circle(ip: str, center: list, r: float, coordinate="z"): """命令指定IP的机器人,给定圆心位置和半径,在水平或竖直方向画一个圆 center:圆心的TCP位置 r:半径(米) coordinate:圆所在的平面。z:圆形所在的平面与基座所在平面垂直,其它:圆形所在的平面与基座所在平面平行。默认值:z。""" try: if '连接失败' in link_check(ip): return return_msg(f"与机器人的连接已断开。") wp_1 = [center[0], center[1], center[2], center[3], center[4], center[5]] wp_2 = [center[0], center[1], center[2], center[3], center[4], center[5]] wp_3 = [center[0], center[1], center[2], center[3], center[4], center[5]] wp_4 = [center[0], center[1], center[2], center[3], center[4], center[5]] cmd = '' if coordinate.lower() == "z": wp_1[2] = wp_1[2] + r wp_2[1] = wp_2[1] + r wp_3[2] = wp_3[2] - r wp_4[1] = wp_4[1] - r else: wp_1[0] = wp_1[0] - r wp_2[1] = wp_2[1] + r wp_3[0] = wp_3[0] + r wp_4[1] = wp_4[1] - r cmd = ( f"def my_program():\n" f" movep(p{str(wp_1)}, a=1, v=0.25, r=0.025)\n" f" movec(p{str(wp_2)}, p{str(wp_3)}, a=1, v=0.25, r=0.025, mode=0)\n" f" movec(p{str(wp_4)}, p{str(wp_1)}, a=1, v=0.25, r=0.025, mode=0)\nend\nmy_program()") logger.info(f"draw_circle 发送脚本:{cmd}") robot_list[ip].robotConnector.RealTimeClient.SendProgram(cmd) time.sleep(1) return return_msg(f"命令已发送:{cmd}") except Exception as e: logger.error(f"命令发送失败: {str(e)}") return return_msg(f"命令发送失败: {str(e)}")

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/nonead/nUR-MCP-SERVER'

If you have feedback or need assistance with the MCP directory API, please join our Discord server