Skip to main content
Glama

get_robot_mode

Retrieve the current operational status of a Universal Robots collaborative robot by specifying its IP address to monitor and control robot activities.

Instructions

获取指定IP机器人的运行状态 IP:机器人地址

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ipYes

Implementation Reference

  • The main handler function for the MCP tool 'get_robot_mode'. It connects to the robot if needed, queries the robot mode using the URBasic DashboardClient.ur_robotmode() method, which sends 'robotmode\n' to the robot's dashboard server on port 29999, and returns the robot's mode (e.g., RUNNING, IDLE). The @mcp.tool() decorator registers this function as an MCP tool with input schema inferred from type hints (ip: str) and docstring.
    @mcp.tool()
    def get_robot_mode(ip: str):
        """获取指定IP机器人的运行状态
        IP:机器人地址"""
        try:
            if '连接失败' in link_check(ip):
                return return_msg(f"与机器人的连接已断开。")
            robot_list[ip].robotConnector.DashboardClient.ur_robotmode()
            logger.info(f"IP为{ip}的优傲机器人的运行状态为: {robot_list[ip].robotConnector.DashboardClient.last_respond}")
            return return_msg(
                f"IP为{ip}的优傲机器人的运行状态为: {robot_list[ip].robotConnector.DashboardClient.last_respond}")
        except Exception as e:
            logger.error(f"运行状态获取失败: {str(e)}")
            return return_msg(f"运行状态获取失败: {str(e)}")
  • Supporting method in URBasic library that implements the low-level dashboard command to query the robot's mode by sending 'robotmode\n' to the robot controller via TCP port 29999 and capturing the response in last_respond.
    def ur_robotmode(self):
        '''
        Robot mode enquiry
        
        Return value to Log file:
        "Robotmode: <mode>", where <mode> is:        
        NO_CONTROLLER
        DISCONNECTED
        CONFIRM_SAFETY
        BOOTING
        POWER_OFF
        POWER_ON
        IDLE
        BACKDRIVE
        RUNNING
        '''
        self.__send('robotmode\n')

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