Overview
Read the recording shipped with the example, pick the left- or right-hand file by device handedness, and replay 30000 joint-angle frames straight through at 1 kHz. This is the larger of the two motion examples, meant for observing the hand’s full range. The example does no interpolation, no resampling, no smoothing, and adds no recovery motion. What the recording holds is what goes out. Matching examples:examples/python/wuji_hand_2/6_opposition/opposition.py and examples/c/wuji_hand_2/6_opposition/opposition.c.
For joint commands and control modes, see Control Guide. This page covers only how to run it and what the measurements show.
This example drives all 20 joints through large motions, with a measured command peak of 1.43 rad (about 82 degrees) sustained over 30 seconds. Before starting, confirm the hand is firmly mounted, clear people, cables, and desk objects from around it, keep someone watching throughout, and stay ready to cut power.
Prerequisites
Hardware
Software
Replay Files
The example directory shipsdata/right.replay and data/left.replay. Copy the entire 6_opposition/ directory, since taking only the source file fails when it can’t find the data.
Data Flow
File Format
A fixed-length container with a 16-byte header followed by 84 bytes per frame.
Handedness ID is 1 for right and 2 for left. The shipped files measure 30000 frames and 2520016 bytes, matching
16 + 30000 x 84 exactly.
Validation completes before enabling. If any of magic, version, handedness, joint count, or file length fails, the example reports an error and exits without enabling the motors.
Runtime Handling
On interrupt the hand holds its current posture rather than opening automatically. Stopping mid-motion can leave it clenched, which needs handling by hand.
Integration Steps
- Python
- C
Running It
- Python
- C
Measurements
A complete run on a right-hand Wuji Hand 2 with all 20 joints online:
Python held the 1 ms target interval reliably, and accumulated error across 30000 frames is negligible.
The hand settles on its own at the end. The recording’s last frame already returns to an open position, so a normal run needs no extra homing. That comes from the recording’s content rather than anything the example does, and an interrupted run gets no such guarantee.
Range of Motion per Finger
Per-joint travel computed offline from the right-hand replay file:
The index finger’s third joint travels furthest at 1.428 rad, about 81.8 degrees.
Adapting It
Name an SN on a Shared Network
As with the MIT joint sweep,auto_connect() refuses to connect when it finds several devices and lists every serial number rather than guessing. Change it to manager.connect(sn="WH2KA00XXXXXXXXX", device_name="hand_2_opposition").
Replay Your Own Recording
Generate a file in the same container format and the whole replay path works unchanged: a 16-byte header plus 84 bytes per frame. The frame index is skipped during replay, and only the 20 joint angles drive control. Make sureside_id matches the target device’s handedness, or container validation fails.
Changing Playback Speed
The interval is hard-coded at 1 ms. Increasing it slows the whole motion, but since nothing is resampled the joint-angle sequence stays the same and each posture simply holds longer. Real speed changes need you to resample the trajectory yourself.Recovering After an Interrupt
Ctrl+C triggers no return motion. After stopping mid-run, the hand holds its posture, and the smooth homing routine in Publishing Control Commands brings it gently back to zero. Don’t send pos=0 directly, since a large error under MIT impedance snaps the hand back hard.
Related
- Publishing Control Commands: general
joint_commandusage and smooth homing - Running an MIT Joint Sweep: the smallest command-path check
- Subscribing With Callbacks: read actual joint state during replay
- Common Data Types: the
JointCommandstructure