Skip to main content
Glama

get_actual_tcp_pose

Retrieve the current TCP position of a specified robot by inputting its IP address. Enables precise monitoring and control of Universal Robots through the nUR MCP Server.

Instructions

获取指定IP机器人的当前TCP位置 IP:机器人地址

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ipYes

Implementation Reference

  • MCP tool handler function for 'get_actual_tcp_pose'. It checks the robot connection using link_check, retrieves the actual TCP pose from the robot instance, formats it as a JSON string, and handles errors.
    @mcp.tool() def get_actual_tcp_pose(ip: str): """获取指定IP机器人的当前TCP位置 IP:机器人地址""" try: if '连接失败' in link_check(ip): return return_msg(f"与机器人的连接已断开。") return return_msg(f"当前TCP位置: {robot_list[ip].get_actual_tcp_pose()}") except Exception as e: logger.error(f"TCP位置获取失败: {str(e)}") return return_msg(f"TCP位置获取失败: {str(e)}")
  • Implementation of get_actual_tcp_pose method in UrScript class (inherited by UrScriptExt), which synchronizes and returns the actual TCP pose from the RobotModel.
    def get_actual_tcp_pose(self, wait=True): ''' Returns the current measured tool pose Returns the 6d pose representing the tool position and orientation specified in the base frame. The calculation of this pose is based on the actual robot encoder readings. Return Value The current actual TCP vector : ([X, Y, Z, Rx, Ry, Rz]) ''' if (wait): self.sync() return self.robotConnector.RobotModel.ActualTCPPose() # c_pose = self.robotConnector.RobotModel.ActualTCPPose # # pose = [] # pose.append(ctypes.c_double(c_pose[0]).value) # pose.append(ctypes.c_double(c_pose[1]).value) # pose.append(ctypes.c_double(c_pose[2]).value) # pose.append(ctypes.c_double(c_pose[3]).value) # pose.append(ctypes.c_double(c_pose[4]).value) # pose.append(ctypes.c_double(c_pose[5]).value) # return pose
  • RobotModel method ActualTCPPose that returns the actual TCP pose data from RTDE stream (dataDir['actual_TCP_pose']).
    def ActualTCPPose(self): return self.dataDir['actual_TCP_pose']
  • Helper function link_check used by the tool handler to verify and establish robot connection if needed.
    def link_check(ip): """检查连接状态,若连接断开或不存在,则建立连接""" if robot_list.get(ip, "unknown") == "unknown" or not robot_list[ ip].robotConnector.RTDE.isRunning(): return connect_ur(ip) return '连接成功'
  • MCP tool registration decorator @mcp.tool() applied to the get_actual_tcp_pose handler.
    @mcp.tool()

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