> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wuji.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# 健康诊断

> 用 wuji doctor 逐项检查设备，定位 EMF 断线与触觉坏点故障

设备无法连接或数据异常时，先运行 `wuji doctor`。命令先检查主机环境，再扫描设备并采样实时数据（约 100 帧，数秒内完成），输出逐项检查的树形报告，帮助缩小故障范围。

## 检测范围

检查分为主机环境、设备发现与逐设备三层。

**主机环境（Environment）**

* 软件版本：CLI、Wuji SDK、Wuji Studio 各自的版本与是否有更新
* 系统信息：操作系统与版本是否在支持范围内
* 网络接口：在网接口及其地址，多接口时提示可能的路由问题

**设备发现（Generic）**

扫描一次即产生，即使未发现任何设备也会出现：发现的设备数、设备 IP 是否重复、设备是否与主机同一子网。

**逐设备**

* **wuji\_glove**
  * EMF 断线检测：定位到具体手指，区分 RX（接收）与 TX（发射）故障
  * 触觉传感器坏点/坏行/坏列检测

> [!WARNING]
>
> 触觉检测需将手套静态放置，勿佩戴或按压，否则可能误报。

## 用法

```bash theme={null}
wuji doctor                # 诊断全部设备
wuji doctor --sn <SN>      # 只诊断指定设备
wuji doctor -v             # 显示全部检查项（默认隐藏通过项）
wuji doctor --json         # 与树形报告同等信息的结构化输出
```

## 读懂报告

```bash theme={null}
$ wuji doctor

══════ Environment ══════
~ Software: version info incomplete
├─ ✔ CLI: 2026.8.3 (up to date)
├─ ~ SDK: not installed or version undetectable (skipped)
└─ ✔ Studio: 2026.8.3 (up to date)

✔ System: supported
└─ ✔ OS: Ubuntu 26.04 (supported)

! Network interfaces: 2 interfaces, see interface count
├─ ✔ eth0 (192.168.1.50/24, fe80::abcd:.../64)
└─ ! Interface count: 2 interfaces — multiple interfaces may cause routing issues

══════ Generic ══════
✔ Device discovery: 2 device(s) found, no issues
├─ ✔ Devices found: 2 device(s) found
├─ ✔ Duplicate device IP
└─ ✔ Host subnet

══════ wuji_glove: WG1KXXXXXXXXXXX ══════
├─ ✔ EMF disconnect check: all 5 fingers normal
└─ ! tactile dead-pixel check: 0 dead pixels, 2 bad rows, 2 bad cols
   ├─ ! Bad rows: 2 bad row(s)
   └─ ! Bad cols: 2 bad col(s)
   Tip: Tactile check result is for reference only. Verify via the tactile matrix in wuji viz
```

* **状态标记**：✔ 通过、! 警告（参考性提示）、✘ 失败（确定故障）、\~ 跳过（检查不适用或无法执行）
* **Tip: 行**是修复建议
* **退出码**：0 表示无失败项（警告不算失败），1 表示存在失败项或诊断无法完成，脚本可直接判定。未连接任何设备不算错误，主机环境与设备发现照常检查并决定退出码
* **不适用或无法执行的检查**：只有发现 UDP 设备时才执行 `Duplicate device IP` 和 `Host subnet`。全部设备均使用 USB 或 Zenoh 时，两项显示 `~ not attempted: no UDP devices`。没有诊断配方的设备也会显示 `~ connect & diagnose`，不再误报故障。这些跳过项本身不会让退出码变为 1。连接或数据采集失败仍显示 ✘ 并返回 1
* 触觉检查结果仅供参考（最高只到警告级），需要通过 [`wuji viz`](https://docs.wuji.tech/docs/zh/wuji-cli/latest/visualization#wuji-glove) 显示的原始触觉矩阵验证

## 展开全部检查项

默认只显示异常项，`-v` 展开全部检查项（含通过项），完整呈现检查范围。以下只截取设备段，实际输出中主机环境与设备发现两段仍排在设备之前：

```bash theme={null}
$ wuji doctor -v

══════ wuji_glove: WG1KXXXXXXXXXXX ══════
├─ ✔ EMF disconnect check: all 5 fingers normal
│  ├─ ✔ Thumb
│  ├─ ✔ Index
│  ├─ ✔ Middle
│  ├─ ✔ Ring
│  └─ ✔ Pinky
└─ ! tactile dead-pixel check: 0 dead pixels, 0 bad rows, 1 bad cols
   ├─ ✔ Thumb
   ├─ ✔ Index
   ├─ ✔ Middle
   ├─ ✔ Ring
   ├─ ✔ Pinky
   ├─ ✔ Palm
   └─ ! Bad cols: 1 bad col(s)
   Tip: Tactile check result is for reference only. Verify via the tactile matrix in wuji viz
```

## 结构化输出

`--json` 输出格式化 JSON，`--jsonl` 输出单行紧凑 JSON，便于保存和脚本处理：

```bash theme={null}
wuji doctor --json > doctor-report.json
```

检查结果统一保存在顶层 `checks` 数组中。环境检查直接作为数组节点，设备发现和逐设备检查通过 `children` 保存子树。

| 字段 | 内容 |
| - | - |
| `checks` | 检查结果数组，始终存在，无结果时为空数组 |
| `checks[].status` | 检查状态：`pass`、`warn`、`fail` 或 `skip` |
| `checks[].children` | 子检查结果，按同样结构递归读取，无子项时省略 |
| `device` | 设备范围字符串，`wuji doctor` 输出为 `"all"`，不保存检查结果 |
| `verdict` | 整体诊断结论 |

> [!WARNING]
>
> 此前从 `env` 或 `device` 数组读取检查结果的脚本，需改为遍历 `checks` 及其 `children`。`device` 已改为字符串，不再是检查结果数组。

以下为报告中与检查结果相关的字段节选：

```json theme={null}
{
  "device": "all",
  "verdict": "pass",
  "checks": [
    {
      "id": "env_system",
      "label": "System",
      "status": "pass",
      "summary": "supported"
    },
    {
      "id": "device_wg1kxxxxxxxxxxx",
      "label": "wuji_glove: WG1KXXXXXXXXXXX",
      "status": "pass",
      "children": [
        {
          "id": "emf_disconnect",
          "label": "EMF disconnect check",
          "status": "pass",
          "summary": "all 5 fingers normal"
        }
      ]
    }
  ]
}
```

`wuji logs export` 支持包中的 `doctor_diagnosis.json` 使用相同结构，保存导出时生成的诊断结果。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.