5.3.1 Fault Handling

The fault handling sub-module is implemented by the Health Diagnostic System (HDS), providing real-time subscription to diagnostic codes, alert codes, and post-processing signals during robot operation, as well as a query interface for historical events.

Core Features

  • Real-time subscription to current diagnostic codes

  • Real-time subscription to current alert codes

  • Real-time subscription to post-processing signals

  • Query historical alert / diagnostic event records

For the complete list of diagnostic codes available to secondary development users, see Diagnostic Code Reference.


Topic Interfaces

Diagnostic Code Information

Topic Name

Message Type

Description

QoS

Frequency

/aima/hds/diag_code_list

aimdk_msgs/msg/DiagnosticInfoArray

Current diagnostic code list

BEST_EFFORT+TRANSIENT_LOCAL

20Hz

  • DiagnosticInfoArray ros2-msg @ hds/msg/DiagnosticInfoArray.msg

    # Current diagnostic code list
    # Topic name: /aima/hds/diag_code_list
    
    MessageHeader header          # Message header
    DiagnosticInfo[] diagnostics
    
    • DiagnosticInfo ros2-msg @ hds/msg/DiagnosticInfo.msg

      uint64 timestamp        # Timestamp (unit: ns)
      uint64 first_timestamp  # First-occurrence timestamp (unit: ns)
      DiagnosticType type     # Fault type (type.value: 0 (NORMAL periodic), 1 (TRIGGER_APPEAR trigger-appear), 2 (TRIGGER_DISAPPEAR trigger-disappear))
      uint8 module_id         # Module ID
      uint32 code             # Module-level diagnostic code
      uint64 diag_code        # Full diagnostic code (module_id + code combined)
      string info             # Diagnostic description
      

Alert Code Information

Topic Name

Message Type

Description

QoS

Frequency

/aima/hds/alert_code_list

aimdk_msgs/msg/AlertCodeArray

Current alert code list

BEST_EFFORT+TRANSIENT_LOCAL

20Hz

  • AlertCodeArray ros2-msg @ hds/msg/AlertCodeArray.msg

    # Current alert code list
    # Topic name: /aima/hds/alert_code_list
    
    MessageHeader header  # Message header
    AlertCode[] list
    
    • AlertCode ros2-msg @ hds/msg/AlertCode.msg

      uint64 timestamp        # Timestamp (unit: ns)
      uint64 first_timestamp  # First-occurrence timestamp (unit: ns)
      string code             # Alert code as string
      

alert_code_list is a subset of diag_code_list, containing only diagnostic codes that reach a certain severity level: the more urgent and dangerous the fault, the less likely it is to be filtered out, while reserved-level and lower-priority events only appear in diag_code_list and never enter alert_code_list.


Post-processing Signal Information

Topic Name

Message Type

Description

QoS

Frequency

/aima/hds/post_proc/signal

aimdk_msgs/msg/PostProcSigArray

Post-processing signal list

BEST_EFFORT+TRANSIENT_LOCAL

Event-driven (see below)

  • PostProcSigArray ros2-msg @ hds/msg/PostProcSigArray.msg

    # Post-processing signal list
    # Topic name: /aima/hds/post_proc/signal
    
    MessageHeader header        # Message header
    PostProcSig[] post_proc_sig
    
    • PostProcSig ros2-msg @ hds/msg/PostProcSig.msg

      uint64 timestamp  # Timestamp
      uint64 diag_code  # Diagnostic code
      SigSet sig_set    # Signal set
      
    • SigSet ros2-msg @ hds/msg/SigSet.msg

      int32 robot_sig         # Robot-level post-processing signal (255 (restore default), others see table below)
      uint8 motion_sig        # Motion behavior signal (reserved, always 0)
      uint8 sound_sig         # Sound behavior signal (reserved, always 0)
      uint8 led_sig           # LED behavior signal (reserved, always 0)
      uint8 facial_sig        # Facial expression signal (reserved, always 0)
      uint32 reserve          # Reserved signal (always 0)
      uint64 funcdisable_sig  # Function-disable signal
      

    robot_sig value reference (X2 Ultra / X2 Ultra(new version)):

    robot_sig Value

    Hex

    Meaning

    Triggered Action

    17

    0x11

    PMU emergency stop

    PMU triggers emergency stop; robot powers off

    19

    0x13

    SDCU emergency stop

    SDCU cuts power to the joints + TTS prompt: “Safety emergency stop mode engaged. Robot joints have been unloaded. Please exercise caution.”

    18

    0x12

    SDCU emergency stop recovering

    Joints powered on; robot is initializing

    26

    0x1A

    PMU emergency stop recovery complete

    HAL_EtherCAT, DCU, and joints powered on

    31

    0x1F

    Emergency stop recovery complete

    TTS prompt: “Safety emergency stop has been released. Robot is entering damping mode.”

    42

    0x2A

    Damping fall protection

    Motion control enters damping mode (recoverable only by restart) + TTS prompt: “Sorry, I can no longer stand. Please shut down immediately and check the fault details in the client.”

    52

    0x34

    Fall protection

    Robot stops motion + TTS prompt: “Robot fall detected, switched to fall protection mode. Please be aware of your surroundings.”

    90

    0x5A

    Upper-limb disable

    Upper-limb joints disabled (recoverable only by restart); lower limbs can still stand + TTS prompt: “Sorry, I can no longer perform motions. Please pause use and check the fault details in the client.”

    131

    0x83

    Lower-limb first-level over-temperature

    Restrict high-load functions and performance, prohibit high-load motions, may interrupt current motion + TTS prompt on lower-limb over-temperature

    132

    0x84

    Waist first-level over-temperature

    Restrict high-load functions and performance, prohibit high-load motions, may interrupt current motion + TTS prompt on waist over-temperature

    136

    0x88

    Battery first-level over-temperature

    Restrict high-load functions and performance, prohibit high-load motions, may interrupt current motion + TTS prompt on battery over-temperature

    154

    0x9A

    Stop navigation application

    Navigation task interrupted + TTS prompt: “Sorry, a system fault has been detected and autonomous navigation is no longer available. Please check the fault cause in the client.”

    161

    0xA1

    Battery anomaly alert

    TTS prompt: “Battery display abnormal, please check battery connection after use” (repeats every 300 seconds)

    193

    0xC1

    LinkCraft data anomaly

    LinkCraft platform file loading failure or data anomaly; motion control cannot respond + TTS prompt on action file anomaly

    209

    0xD1

    Interactive camera blocked

    TTS prompt: “My camera seems to be blocked, which may affect my visual functions. Please help me check it.”

    210

    0xD2

    Built-in microphone anomaly

    TTS prompt: “My built-in microphone has malfunctioned and cannot pick up sound. Please contact after-sales service promptly.”

    255

    0xFF

    Restore default

    Restore default state (sent once after all alerts are cleared)

This topic is event-driven. Publishing rules:

  • When post-processing alerts are active (an alert with robot_sig≠0 is present), the corresponding post-processing signal is published continuously at approximately 20 Hz;

  • When all post-processing alerts have cleared, a single recovery frame with robot_sig=255 is sent (only once);

  • At all other times (no post-processing alerts and the recovery signal has already been sent), the topic stays silent and publishes nothing.

    Note: When robot_sig=154, any active navigation task will be automatically interrupted. To detect this programmatically, subscribe to the /aima/pnc/pnc_task_response topic and check whether task_status changes to FAILED; or subscribe to the /task_master/state topic and check whether main_state changes from PILOT to IDLE.


Service Interfaces

Query Historical Events

Service Name

Message Type

Description

/aimdk_5Fmsgs/srv/GetHdsEventHistory

aimdk_msgs/srv/GetHdsEventHistory

Query historical alert / diagnostic event records

  • GetHdsEventHistory ros2-srv @ hds/srv/GetHdsEventHistory.srv

    # Query historical alert / diagnostic event records
    # Service name: /aimdk_5Fmsgs/srv/GetHdsEventHistory
    
    RequestHeader header       # Request header
    HdsEventQuery query        # Filter conditions
    ---
    ResponseHeader header      # Response header
    HdsEventRecord[] records   # Historical event records
    uint32 total_count         # Total records matching the filter
    bool has_more              # Whether more records are available
    
    • HdsEventQuery ros2-msg @ hds/msg/HdsEventQuery.msg

      uint64 start_time        # Start timestamp (unit: ns), 0=unlimited
      uint64 end_time          # End timestamp (unit: ns), 0=unlimited
      uint64[] diag_codes      # Filter by diagnostic codes
      string[] alert_codes     # Filter by alert codes
      string[] alert_locations # Filter by alert locations
      uint8 state              # State filter (0 (STATE_ALL all), 1 (STATE_ACTIVE active), 2 (STATE_RECOVERED recovered))
      bool order_desc          # Order by time descending
      uint32 offset            # Pagination offset
      uint32 limit             # Pagination limit
      
    • HdsEventRecord ros2-msg @ hds/msg/HdsEventRecord.msg

      uint64 id                  # Historical event record ID
      uint64 diag_code           # Diagnostic code
      string alert_code          # Alert code
      string alert_location      # Alert location (reserved)
      uint64 first_timestamp     # First-occurrence timestamp (unit: ns)
      uint64 last_timestamp      # Most-recent occurrence timestamp (unit: ns)
      uint64 recover_timestamp   # Recovery timestamp (unit: ns), 0=not recovered
      uint64 duration_ns         # Duration (unit: ns)
      bool recovered             # Whether recovered
      

Historical records contain only diagnostic codes, timestamps, and recovery status — not alert level, fault description, or recommended action. For those details, look up the diag_code in the Diagnostic Code Reference.

Historical events are retained for 30 days by default, with total storage capped at 1024 MB / 10 million records; older entries are purged automatically. Queries outside the retention range return empty results.

Programming Examples

For detailed programming examples and code explanations, see:

Caution

As standard ROS DO NOT guarantee reliable cross-board communication, please refer to the examples and add exception handling, fast retry, and other protection mechanisms during secondary development.

While the robot is in Stable Standing Mode or Locomotion Mode, DO NOT launch ROS nodes in rapid bulk (no more than 2 nodes per second is recommended), as a large number of nodes joining DDS discovery within a short period causes communication congestion and degrades motion control real-time performance, which may cause the robot to lose balance and fall