Overview
After connecting, print the device’s static information and current diagnostic state in one pass: handedness, IP, online-joint bitmap, labels and effort limits for all 20 joints, plus each joint’s status word, current, bus voltage, temperature, and error code. This is the first step in diagnosing a device. Offline joints, abnormal temperatures, and non-zero fault codes are all visible at a glance. Matching example:examples/c/wuji_hand_2/2_hand_info.c.
For API and field definitions, see Identity and Diagnostics and Joint Diagnostic Data Types.
Python has no standalone example, though every capability is available:
hand.handedness(), hand.ip(), hand.online_joints_count(), hand.joints, hand.effort_limit(), and a joint_diagnostics subscription for the diagnostic snapshot.Prerequisites
Hardware
Software
Data Flow
The online bitmap is a 32-bit integer where bit N corresponds to the joint at index N. With all 20 joints online it reads0x000FFFFF.
Two Joint Numbering Schemes
This is the key to reading both this example’s output andjoint_states.
Each finger occupies a block of 5 nids but uses only the first 4, so 5, 10, 15, and 20 are skipped. The conversion holds across all 20 joints:
Using an
nid from joint_states directly as an array subscript shifts everything.
Integration Steps
1. Discover and Connect to the Device
This page follows the C example. Initialize withwuji_init(), find a WUJI Hand 2 with wuji_scan_devices(), then pass the target serial number to wuji_connect(). Free the discovery results after the connection call returns. Continue reading information only after a successful connection.
idx is the index of a confirmed WUJI Hand 2 in the discovery results. If no device matches or the connection fails, enter cleanup directly.
2. Read Device Information and Joint Limits
Read handedness withwuji_hand_2_get_handedness() and the online count with wuji_hand_2_online_joints_count(). Call wuji_hand_2_get_ip() twice: first to query the buffer size, then to allocate and read the string.
wuji_hand_2_get_all_effort_limit() returns the limit array and online bitmap. Read only entries marked online in the bitmap.
3. Capture One Diagnostic Frame
Register ajoint_diagnostics callback, copy entries into an application-owned snapshot, and notify the main thread with an atomic flag. The example waits up to about one second, closes the subscription, then reads the copied data.
diag_snapshot_t and on_diag are the example’s snapshot structure and callback. C example includes field copying and cross-thread synchronization. Don’t read snapshot entries if no frame arrives before the timeout.
4. Release the Device and SDK
After reading information, disconnect, release the device handle, and shut down the SDK. Use the same cleanup order on error paths.Running It
Measured Output
On a right-hand WUJI Hand 2 with all 20 joints online:
At rest and unenabled, current fluctuates slightly around zero and temperature holds near 50 degrees Celsius. That’s a normal state.
Notes
Adapting It
Testing Whether a Joint Is Online
The bitmap beats querying one at a time.(bitmap >> i) & 1 equal to 1 means the joint at index i is online. Note that this uses the array index, not the nid.
Reference Ranges for Temperature and Voltage
At rest, temperature measured 49 to 59 degrees Celsius and bus voltage 12.3 to 12.4 V. Temperature rises after sustained large motions, and a persistently high reading calls for checking cooling and load.Investigating Fault Codes
Whenerr_code is non-zero, look it up in the fault code table. Clear faults with clear_fault(), and a fault that won’t clear means the condition is still present.
Locating a Specific Joint
To go from a label to an nid, use the formula above. To go from an nid back to a label, computei = (nid - 1) // 5 * 4 + (nid - 1) % 5, noting that nids 5, 10, 15, and 20 correspond to no joint.
Related
- Subscribing With Callbacks: how nid behaves in
joint_states - Publishing Control Commands: how array index and nid are used in control APIs
- Troubleshooting: fault codes and how to handle them