Skip to main content

Fault Logs

After connection, the SDK logs faults without a joint_diagnostics subscription. For log locations, fault states, and code lookup, see Fault Logs and Error Codes. After the device restarts, the SDK’s first received status records faults that the device saved as active before power loss, marked state=active_before_power_off. The device saves up to 15 active fault-code records and records how many did not fit. These records describe the state before power loss. They don’t establish that a fault is still active after restart or provide a complete event history from before connection. When a reporting list is truncated, the log reports omissions. The SDK doesn’t treat an omitted fault as cleared solely because the list was truncated. Retain these messages and check the current state when troubleshooting.

diagnostics (SUB, 1 Hz)

Subscribe to whole-device diagnostics to inspect component states, fault codes, and measurements. The SDK publishes one frame per second. A new subscriber waits for the next frame, about one second. This stream is for monitoring, not control-loop feedback.
Python and C subscriptions end when the link drops, so they don’t receive a HostLinkDown frame. Check Fault Logs for connection-loss records, then subscribe again after reconnecting. C frame pointers are valid only during the callback. Copy any data needed afterward.

Fields and Validity

Check each value’s valid flag before using value. An unavailable value is NaN, not zero. To obtain joint temperature, voltage, and current statistics, subscribe to a joint feedback stream such as joint_states so the firmware collects samples during that second. The main controller reads joint runtime states separately, without relying on that stream. A component’s state and measurement validity are separate checks. code.active is true while a fault is active. A false value identifies a fault that cleared within the reporting second. before_power_off describes the previous power-on session, not the current fault state. Without firmware diagnostic-frame support, the diagnostics stream includes the device and host link. It also includes components with fault codes when the firmware supports a fault-code stream. It reports DiagnosticsUnsupported. Full component states and measurements require compatible firmware. See Firmware Upgrade.

Diagnostic Evidence Files

The SDK automatically reads diagnostic details when a red fault code becomes active, a connection starts with an active red fault code, the link reconnects after an interruption, or host-link packet loss or request timeouts exceed their thresholds. Records are saved under ~/.wuji/logs/diagnostics_evidence/. The SDK skips repeated reads within 10 minutes for the same component and fault code, and for records with the same trigger reason and fault codes. Up to 200 records are retained per device. Set WUJI_DIAGNOSTICS_EVIDENCE_DISABLE=1 to disable collection. Recurrence records for faults marked as eligible for escalation in the fault-code catalog are stored under ~/.wuji/diagnostics/ to determine when to contact support.

Read One Joint’s Fault Code

For an immediate read, use hand.joint(index).error_code().get() in Python or wuji_hand_2_get_joint_error_code(hand, index, &code) in C. The joint index is 0–19. Zero means no active fault. Pass a nonzero code to WujiHand2.describe_error(code) in Python or wuji_hand_2_describe_error() in C for its meaning and recommended action. A read failure doesn’t mean the joint is fault-free.

Communication Fault Codes

joint_diagnostics (SUB)

Joint diagnostics stream: subscribe to per-joint status word, current, bus voltage, temperature, and fault 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 Codes Use WujiHand2.describe_error(code) to get the fault cause and recommended action. Unknown codes return None. See Device Fault Codes. Object Display Format Python uses the following format for error_code_current in the repr() of JointDiagnosticsEntry: This changes only the display format. error_code_current remains an integer that you can pass to describe_error(). error_code_current is a native integer fault code. Look it up with WujiHand2.describe_error(code). Unknown codes return None. Printing a diagnostics entry shows the fault code in hexadecimal.
For joint angles, use position from the joint_states stream — the diagnostics stream doesn’t carry joint angles.

comm_diag (GET, 1 Hz)

This interface is deprecated and is scheduled for removal in SDK v2027.1. Use diagnostics for component states and per-finger-bus online node counts. Use online_joints_count() for the online joint count. Per-finger and per-node communication counters have no public replacement. Python emits a deprecation warning on the first call, and C emits one at compile time. Calling wuji_hand_2_get_comm_diag with -Werror makes the deprecation warning a build error.
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.

SDK Log Level

Adjust the SDK log level for debugging:
Choose one log level per call: The SDK writes its log to the terminal and to ~/.wuji/logs/sdk_<date>.log. The kp / kd readback record for each connection uses the info level. For the format, see mit_params. Retrieve the device firmware’s own runtime logs with Flash Log Export.

Flash Log Export (Diagnostics)

Export Flash logs only for offline diagnostics. Before every export, disable the device and stop sending control commands. After the export finishes, enable the device and resume control as needed.Don’t export logs during control, even from another thread or process. During export, device status feedback slows down and drops frames.
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.
Run only one Flash log export at a time on each device. Firmware v2.6.0 or later can detect overlapping exports. Earlier firmware cannot, so ensure exports run sequentially.

Data Types

JointDiagnosticsFrame / JointDiagnosticsEntry

Joint diagnostics frame: frame type of the hand.joint_diagnostics().subscribe() stream. Variable-length, online joints only.
current is the measured current in deprecated MIT mode and the net current after subtracting the applied internal feedforward compensation in MIT_V2 and Position control mode. Both use A.

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 the static method WujiHand2.describe_error(code). The returned object contains:
  • code, the error name, and desc: fault code, name, and description
  • cause and resolution: fault cause and recommended action
  • severity: Warning / DeferredStop / ImmediateStop / Fatal
  • clear_policy: AutoClear / ManualClear / NonClearable
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.