Skip to main content
Glama

start_data_recording

Initiate data collection from Universal Robots collaborative robots to capture robot state, joint positions, TCP coordinates, or error information for analysis and monitoring.

Instructions

开始记录机器人数据

参数:
- robot_id: 机器人ID
- record_types: 记录类型列表,可选值包括"robot_state", "joint_data", "tcp_data", "error_data"
- duration: 记录持续时间(秒),0表示持续记录直到停止

返回:
- 记录会话ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
robot_idYes
record_typesYes
durationNo

Implementation Reference

  • The handler function for the 'start_data_recording' MCP tool. Decorated with @mcp.tool() for automatic registration. Validates input record_types, maps them to enums, and delegates to advanced_data_recorder.start_recording to initiate data recording for the specified robot.
    @mcp.tool()
    def start_data_recording(robot_id: str, record_types: list, duration: float = 0):
        """
        开始记录机器人数据
        
        参数:
        - robot_id: 机器人ID
        - record_types: 记录类型列表,可选值包括"robot_state", "joint_data", "tcp_data", "error_data"
        - duration: 记录持续时间(秒),0表示持续记录直到停止
        
        返回:
        - 记录会话ID
        """
        try:
            if advanced_data_recorder is None:
                return return_msg("高级数据记录器未初始化")
            
            # 映射记录类型字符串到枚举值
            type_map = {
                "robot_state": DataRecordType.ROBOT_STATE,
                "joint_data": DataRecordType.JOINT_DATA,
                "tcp_data": DataRecordType.TCP_DATA,
                "error_data": DataRecordType.ERROR
            }
            
            record_enum_types = []
            for record_type in record_types:
                if record_type in type_map:
                    record_enum_types.append(type_map[record_type])
                else:
                    return return_msg(f"不支持的记录类型: {record_type}")
            
            # 启动记录
            session_id = advanced_data_recorder.start_recording(
                robot_id=robot_id,
                record_types=record_enum_types,
                duration=duration
            )
            
            return return_msg({"session_id": session_id, "message": "数据记录已启动"})
        except Exception as e:
            logger.error(f"开始数据记录失败: {str(e)}")
            return return_msg(f"开始数据记录失败: {str(e)}")
  • Registration of the start_data_recording tool using the @mcp.tool() decorator, which likely names the tool after the function name.
    @mcp.tool()
  • Input schema defined by function type hints (robot_id: str, record_types: list[str], duration: float=0) and docstring describing parameters and supported record_types.
    def start_data_recording(robot_id: str, record_types: list, duration: float = 0):
        """
        开始记录机器人数据
        
        参数:
        - robot_id: 机器人ID
        - record_types: 记录类型列表,可选值包括"robot_state", "joint_data", "tcp_data", "error_data"
        - duration: 记录持续时间(秒),0表示持续记录直到停止
        
        返回:
        - 记录会话ID
        """

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