Skip to main content
Glama

movej

Control robot joint positions by sending target angles to Universal Robots. Specify acceleration, velocity, duration, and blend radius for precise motion control.

Instructions

发送新的关节姿态到指定IP的机器人,使每个关节都旋转至指定弧度。 IP:机器人地址, q:各关节角度, a:加速度(米每平方秒), v:速度(米每秒), t:移动时长(秒), r:交融半径(米)。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ipYes
qYes
aNo
vNo
tNo
rNo

Implementation Reference

  • MCP tool handler for 'movej': sends joint movement command to UR robot via robot_list[ip].movej and confirms with movejConfirm.
    @mcp.tool() def movej(ip: str, q: list, a=1, v=1, t=0, r=0): """发送新的关节姿态到指定IP的机器人,使每个关节都旋转至指定弧度。 IP:机器人地址, q:各关节角度, a:加速度(米每平方秒), v:速度(米每秒), t:移动时长(秒), r:交融半径(米)。""" try: if '连接失败' in link_check(ip): return return_msg(f"与机器人的连接已断开。") cmd = f"movej({q},{a},{v},{t},{r})" logger.info(f"发送脚本:{cmd}") robot_list[ip].movej(q, a, v, t, r) time.sleep(1) result = movejConfirm(ip, q) if result == 1: return return_msg(f"命令 {cmd} 已发送,移动完成。") else: return return_msg(f"命令 {cmd} 已发送,移动失败。") except Exception as e: logger.error(f"发送新的关节姿态到UR机器人失败: {str(e)}") return return_msg(f"发送新的关节姿态到UR机器人: {str(e)}")
  • Helper function called by movej handler to confirm if the robot has reached the target joint positions accurately.
    def movejConfirm(ip, q): """ movej移动的结果确认 1:移动到位 2:移动结束,但是位置不准确 """ loop_flg = True count = 0 while loop_flg: time.sleep(1) current_pose = round_pose(robot_list[ip].get_actual_joint_positions()) if right_pose_joint(current_pose, q): robot_list[ip].robotConnector.DashboardClient.ur_running() running = robot_list[ip].robotConnector.DashboardClient.last_respond if running == 'Program running: false': return 1 else: robot_list[ip].robotConnector.DashboardClient.ur_running() running = robot_list[ip].robotConnector.DashboardClient.last_respond if running == 'Program running: true': # 尚未移动完成 continue else: # 移动完成 count = count + 1 if count > 5: return 2
  • Helper to round pose values to 3 decimal places, used in movejConfirm.
    def round_pose(pose): """给坐标取近似值,精确到三位小数""" pose[0] = round(pose[0], 3) pose[1] = round(pose[1], 3) pose[2] = round(pose[2], 3) pose[3] = round(pose[3], 3) pose[4] = round(pose[4], 3) pose[5] = round(pose[5], 3) return pose
  • Helper to check if current joint pose is within 0.1 radian tolerance of target, used in movejConfirm.
    def right_pose_joint(current_pose, q): """关节的弧度验证,允许0.1的误差,按角度计算大约5度""" if q[0] + 0.1 >= current_pose[0] >= q[0] - 0.1: if q[1] + 0.1 >= current_pose[1] >= q[1] - 0.1: if q[2] + 0.1 >= current_pose[2] >= q[2] - 0.1: if q[3] + 0.1 >= current_pose[3] >= q[3] - 0.1: if q[4] + 0.1 >= current_pose[4] >= q[4] - 0.1: if q[5] + 0.1 >= current_pose[5] >= q[5] - 0.1: return True return False
  • Helper to format return messages as JSON, used throughout including movej.
    def return_msg(txt: str): return json.dumps(txt, indent=2, ensure_ascii=False)

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