> ## 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.

# Reading Device Info

## 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 the complete list of device parameters and operations, see [Device Parameters and Operations](/en/docs/wuji-hand/latest/sdk-reference/device-operations). This page covers only how to run it and what the measurements show.

<Info>
  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.
</Info>

This example only reads. It doesn't enable the motors, and the fingers don't move.

## Prerequisites

### Hardware

| Item | Requirement |
| - | - |
| Wuji Hand 2 | 1 |
| Connection | Ethernet |

### Software

| Item | Requirement |
| - | - |
| Operating system | Ubuntu 22.04 LTS or later |
| Wuji SDK | v2026.8.31 or later |
| C toolchain | CMake 3.16 or later, plus the extracted SDK package |

## Two Joint Numbering Schemes

This is the key to reading both this example's output and `joint_states`.

| Numbering | Values | Used by |
| - | - | - |
| **Array index** | Contiguous 0 through 19 | Subscripts for array APIs such as `effort_limit`, `mit_params`, and `joint_command` |
| **`nid`** | 1–4, 6–9, 11–14, 16–19, 21–24 | Firmware bus node IDs, appearing in `joint_states` and `joint_diagnostics` |

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:

```text theme={null}
nid = (index // 4) * 5 + (index % 4) + 1
```

| Index | Label | nid |
| - | - | - |
| 0 | `thumb_S1` | 1 |
| 3 | `thumb_S4` | 4 |
| 4 | `index_S1` | 6 |
| 7 | `index_S4` | 9 |
| 8 | `middle_S1` | 11 |
| 19 | `pinky_S4` | 24 |

**Using an `nid` from `joint_states` directly as an array subscript shifts everything.**

## Data Flow

```mermaid theme={null}
flowchart TD
    CONN["wuji_connect()"]
    STATIC["static information<br/>handedness / ip / online_joints_count"]
    BITMAP["online bitmap<br/>one bit per joint index"]
    PERJ["per-joint information<br/>label / online state / effort limit"]
    DIAG["joint_diagnostics snapshot<br/>status word / current / voltage / temperature / error code"]

    CONN --> STATIC
    STATIC --> BITMAP
    BITMAP --> PERJ
    PERJ --> DIAG
```

The online bitmap is a 32-bit integer where bit N corresponds to the joint at index N. With all 20 joints online it reads `0x000FFFFF`.

## Runtime Handling

| Branch point | Behavior | What to do |
| - | - | - |
| Joint offline | Its bitmap bit is 0 and the joint is marked `offline` | Check bus wiring and power |
| Non-zero error code | The `err_code` column isn't `0x0000` | Look up the fault code and call `clear_fault()` if needed |
| Elevated temperature | The `temp` column reads high | At rest, measurements ranged from 49 to 59 degrees Celsius |
| Several devices | The example connects to the first it finds | On a shared network, name a serial number |

## Integration Steps

<Tabs>
  <Tab title="C">
    ```c theme={null}
    #include "wuji_sdk.h"

    /* 1. Static information */
    WujiHandedness side; wuji_hand_2_handedness(dev, &side);
    char ip[64]; wuji_dev_ip(dev, ip, sizeof(ip));
    uint32_t online = 0; wuji_hand_2_online_joints_count(dev, &online);

    /* 2. Online bitmap and per-joint information */
    uint32_t bitmap = 0;
    wuji_hand_2_online_joints_bitmap(dev, &bitmap);
    for (int i = 0; i < 20; i++) {
        const char *label = wuji_hand_2_joint_label(i);
        bool is_online = (bitmap >> i) & 1;
        float lim = 0; wuji_hand_2_get_effort_limit(dev, i, &lim);
    }

    /* 3. Diagnostic snapshot: one subscribed frame is enough */
    struct WujiSub *sub = NULL;
    wuji_hand_2_subscribe_joint_diagnostics(dev, on_diag, &ctx, &sub);
    /* Read nid / status_word / current / vbus / temperature / error_code in the callback */
    wuji_sub_close(sub);
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    from wuji_sdk import DeviceType, SdkManager

    manager = SdkManager.instance()
    hands = [d for d in manager.scan() if d.device_type == DeviceType.WujiHand2]
    hand = manager.connect(sn=hands[0].sn, device_name="hand")

    # 1. Static information
    print("handedness:", hand.handedness().get())
    print("ip:", hand.ip().get())
    print("online joints:", hand.online_joints_count().get())

    # 2. Per-joint effort limits, indexed 0..19
    print("effort_limit:", hand.effort_limit().get())

    # 3. Diagnostic snapshot: take one frame from a subscription
    sub = hand.joint_diagnostics().subscribe()
    frame = sub.recv()
    for e in frame.joints:
        print(e.nid, hex(e.status_word.raw) if hasattr(e.status_word, "raw") else e.status_word)
    sub.close()

    manager.disconnect_all()
    ```
  </Tab>
</Tabs>

## Running It

```bash theme={null}
./build/hand2/2_hand_info
```

### Measured Output

On a right-hand Wuji Hand 2 with all 20 joints online:

```text theme={null}
Connecting to WH2KA00XXXXXXXXX (192.168.1.100:7447)
handedness: right
ip: 192.168.1.100
online joints (count): 20

online bitmap = 0x000FFFFF  (20 joints online)
  i   label     state      effort_lim
  0   thumb_S1  online        1.500A
  1   thumb_S2  online        1.500A
  2   thumb_S3  online        1.500A
  3   thumb_S4  online        1.500A
  4   index_S1  online        1.500A
  ...
  19  pinky_S4  online        1.500A

joint_diagnostics snapshot (20 joints):
  nid  status_word   current    vbus   temp err_code
  1    0x24620001    0.00A   12.3V  54.8C   0x0000
  2    0x24620001   -0.01A   12.4V  55.4C   0x0000
  ...
  24   0x24620001    0.01A   12.3V  55.8C   0x0000
```

| Metric | Measured |
| - | - |
| Online bitmap | `0x000FFFFF`, all 20 bits set |
| Joint labels | `thumb_S1` through `pinky_S4`, 4 per finger |
| Effort limit | 1.500 A across the board |
| Status word | `0x24620001` across the board |
| Bus voltage | 12.3 to 12.4 V |
| Temperature | 49.1 to 58.6 degrees Celsius |
| Error code | `0x0000` across the board |
| Current at rest | −0.02 to +0.01 A |

At rest and unenabled, current fluctuates slightly around zero and temperature holds near 50 degrees Celsius. That's a normal state.

## 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

When `err_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, compute `i = (nid - 1) // 5 * 4 + (nid - 1) % 5`, noting that nids 5, 10, 15, and 20 correspond to no joint.

## Related

* [Subscribing With Callbacks](/en/docs/wuji-hand/latest/sdk-practice/subscribe-callback): how nid behaves in `joint_states`
* [Publishing Control Commands](/en/docs/wuji-hand/latest/sdk-practice/publish-command): how array index and nid are used in control APIs
* [Troubleshooting](/en/docs/wuji-sdk/troubleshooting/): fault codes and how to handle them


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