跳转到内容

7.4 故障诊断部分

机器人本身提供了基础的故障诊断和健康监测的能力,能够对一些基本的异常和故障进行监控,例如关节过温、传感器失效、系统占用持续过高、电池电量过低等。

针对故障诊断有两个基本概念,分别为 Alert 告警和 Exception 故障,Alert 是 Exception 的聚类,Alert 指代一大类故障,Exception 则是某个具体的故障,例如重定位失败就是一个 Alert,对应很多种不同失败原因,每个都是一个具体的 Exception。AimMaster 上显示的一般也是 Alert,Exception 会比较多,看起来也不太直观。 如果需要持续监控机器人的异常状态,建议每隔一段时间查询一次当前的告警列表(频率不要太高,推荐 0.2 Hz 及以下的频率)。

全量告警可在 x86 机上 /agibot/software/v0/config/hds_master/database/alert_info.yaml 文件中找到。

接口名 pb:/aimdk.protocol.HDSService/GetAlertList
功能概述 获取当前告警列表
接口类型 HTTP JSON RPC
URL http://127.0.0.1:50587/rpc/aimdk.protocol.HDSService/GetAlertList
入参
{}
出参
{
  "data": {
    "alerts": [
      {
        "id": "c39f6ccc-85d9-4976-a2e9-08f2906cc237",
        "appeared_timestamp": "1762933137153",
        "disappeared_timestamp": "0",
        "alert_code": "A2000003",
        "state": "AlertState_ACTIVE",
        "exception_list": [
          {
            "type": "ExceptionType_Normal",
            "module_id": 81,
            "code": 100,
            "info": "急停拍下",
            "module_name": "健康管理HDS"
          }
        ],
        "description": "急停拍下",
        "level": "AlertLevel_HIDDEN_DANGERS",
        "manual_clear": true,
        "show_type": "AlertShowType_Normal",
        "solution_list": [
          {
            "type": "txt",
            "content": "请逆时针旋转急停按钮解除急停状态。"
          }
        ]
      }
    ]
  }
}
  • id: 本条告警 id

  • appeared_timestamp: 告警出现的时间戳

  • disappeared_timestamp: 告警消失的时间戳

  • alert_code: 告警码

  • state: 告警状态

    • AlertState_UNDEFINED: 未知
    • AlertState_ACTIVE: 告警中
    • AlertState_CLEARED: 已清除
    • AlertState_ExceptionChanged: 告警中异常变更
    • AlertState_Recovering: 恢复中
  • exception_list: 异常列表

  • exception_list[i].type: 异常类型

    • ExceptionType_Normal: 正常类型 该类型异常需要周期性上报、
    • ExceptionType_Trigger_Appear: 触发式异常(异常产生时上报一次) 设置该异常为产生状态
    • ExceptionType_Trigger_Disappear: 触发式异常(异常消失时上报一次) 设置该异常为消失状态
  • exception_list[i].module_id: 异常模块 ID

  • exception_list[i].code: 模块异常码

  • exception_list[i].info: 异常信息

  • exception_list[i].module_name: 模块名称

  • description: 告警描述

  • level: 告警等级

    • AlertLevel_UNDEFINED: 无告警
    • AlertLevel_FATAL: 致命告警
    • AlertLevel_SERIOUS: 严重告警
    • AlertLevel_WARNING: 警告告警
    • AlertLevel_HIDDEN_DANGERS: 当前系统存在隐患
    • AlertLevel_STATUS: 当前系统存在状态类告警
  • manual_clear: 是否支持手动清除

  • show_type: 告警展示类型

    • AlertShowType_Normal
    • AlertShowType_Toast
  • solution_list: 解决方案

  • solution_list[i].type: 解决方案类型

  • solution_list[i].content: 解决方案内容

示例脚本 examples/hds/get_alert_list.sh
备注
接口名 pb:/aimdk.protocol.HDSService/ClearAlert
功能概述 尝试清除告警,需传入告警 id
接口类型 HTTP JSON RPC
URL http://127.0.0.1:50587/rpc/aimdk.protocol.HDSService/ClearAlert
入参
{
  "id": "c92f2fdd-cea5-4209-b02f-d0eb62ae18ce"
}
  • id: 需要填入具体的 alert 的 id,可通过 GetAlertList 接口获取
出参
{
  "header": {
    "code": "1",
    "msg": "clear alert failed!",
    "trace_id": "",
    "domin": ""
  },
  "data": {
    "data": "c92f2fdd-cea5-4209-b02f-d0eb62ae18ce"
  }
}
  • data: 传入的告警 id
  • header 中返回本次清除是否成功的信息,code 为 0 代表成功
示例脚本 examples/hds/clear_alert.sh
备注
  • 急停告警虽然 manual_clear 为 true,但是仍会清除失败,需手动解除急停后才能清除
  • 一般情况下请不要调用本接口进行清除操作,请完全理解告警含义后再考虑使用本接口进行清除