跳转到主要内容

joint_diagnostics (SUB)

Joint diagnostics stream: subscribe to per-joint status word, current, bus voltage, temperature, and error code. Frames are variable-length and contain only online joints — identify each entry by its nid. This stream and joint_states ride the same device stream, so lowering the push rate of one lowers both — see joint_states (SUB).
Decode error_code_current with the static method WujiHand2.describe_error(code). The returned object carries the error name, description, severity (Warning / DeferredStop / ImmediateStop / Fatal), and clear_policy (AutoClear / ManualClear / NonClearable). Unknown codes return None. The code field of the returned object is an integer, the same value you passed in. Printing a diagnostics entry object shows error codes in hex.
For joint angles, use position from the joint_states stream — the diagnostics stream doesn’t carry joint angles.

comm_diag (GET, 1 Hz)

Communication diagnostics: returns the throughput / error rate of the 5 fingers, once per second.
Use it to troubleshoot communication between the joints and the control board.

Flash Log Export (Diagnostics)

The SDK writes one flash_<serial>_<YYYY-MM-DD_HHMMSS>.jsonl file to out_dir. Omit out_dir to use ~/.wuji/logs. The SDK writes to a temporary file and makes the JSONL file available only after the export finishes. If the export fails, the SDK removes the temporary file, so the output directory contains no partial export.
A device supports concurrent log exports.When multiple sessions export logs from the same device, the SDK retries automatically. If the export still can’t finish, the call reports that the device is busy. The SDK removes the temporary files and doesn’t keep an unfinished log.

Data Types

JointDiagnosticsFrame / JointDiagnosticsEntry

Joint diagnostics frame: frame type of the hand.joint_diagnostics().subscribe() stream. Variable-length, online joints only.

HandCommunicationDiagnostics

Communication diagnostics data.

StatusWord

Status word: the type of the status_word field on JointDiagnosticsEntry, the public status view exposed by the SDK.

Hand2CommSummary

Frame-level communication health summary: the type of the comm field on JointDiagnosticsFrame, combining the device-internal bus view with the SDK-local end-to-end (Ethernet) view. The device-internal part comes from a snapshot the SDK refreshes automatically at 1 Hz — no polling required.
Reading the device-internal fields. age_ms and the per-joint comm_* fields all come from one snapshot the SDK refreshes at 1 Hz. The refresh is deliberately skipped while a firmware upgrade is running, so a briefly stale snapshot is expected rather than a fault. Tell the two cases apart with comm_get_failures: a growing age_ms while comm_get_failures stays flat means the refresh is being skipped on purpose, while comm_get_failures increasing means the refresh itself is failing.
Counters saturate, they do not wrap. Every counter in this table stops at its maximum (65535 for the 16-bit ones — e2e_reordered, e2e_duplicates, rpc_retries, rpc_timeouts, comm_get_failures — and 4294967295 for the 32-bit ones) and stays there. On a 1 kHz stream a long-running session can reach those ceilings, so read these as deltas between two samples rather than as absolute lifetime totals.

Exception Handling

All SDK operation errors raise a unified WujiException whose message carries an error-type prefix (Disconnected, Timeout, PathNotFound, SchemaMismatch, SerializeError, …). Use try / except as needed.
For the full list of exception types, see the Wuji SDK appendix — Python Exception Types. For reconnecting after a drop, see Wuji SDK best practices — Reconnection Strategy.

Device Fault Codes

error_code_current in the joint diagnostics and error_code in the error history are both u16 device fault codes. Decode them with WujiHand2.describe_error(). Device fault codes lay their hex digits out as 0xSCNN, but don’t decode the digits yourself — the severity and clear_policy fields returned by describe_error() carry the same information as plain strings and stay correct if the layout ever changes. Treat the code as an opaque identifier: log it, show it to the user, quote it in a bug report. When decoding succeeds, use the returned severity and clear_policy to decide how to react. When describe_error() returns None (an unknown code), don’t access those fields — keep the original value for logging and bug reports.
Python: See the Python API examples earlier on this page.