Skip to main content

Overview

Configure MIT_V2, enable all 20 joints, transition from the measured posture to the sweep start over one second, then send 101 cosine-sweep frames at 20 ms intervals. Joint 0 has a 0.02 rad command amplitude. Other joints target zero, so their motion depends on the starting posture. The matching examples are Python 7_mit_sweep.py and C 7_mit_sweep.c.
The example enables and moves all 20 joints. Clear the workspace and keep a stop method available. A small joint-0 command doesn’t limit the other joints’ travel toward zero.

Prerequisites

Use SDK v2026.11.23 or later and main-controller and joint firmware v3.1.0 or later. All 20 joints must be online. Select the target device explicitly on shared networks. Install the SDK and toolchain before running the example.

Data Flow

Connect → check all 20 joints → disable → select MIT_V2 → configure and read back limits and gains → enable → wait for all joints to report Enabled → capture the posture → transition → sweep → disable and disconnect.

Integration Steps

1. Connect and Check the Joints

The example selects a target device and checks online_joints_count(). It exits before motion unless all 20 joints are online.

2. Enable and Capture the Starting Posture

Before enabling, configure physical parameters and check every readback. The following excerpt uses the example’s per-joint effort limits (N·m), kp = 1.0 N·m/rad, and kd = 0.02 N·m·s/rad. These are example settings, not device-wide maximums.
C uses WUJI_CONTROL_MODE_MIT_V2, wuji_hand_2_set_all_effort_limit_per_joint(), and wuji_hand_2_set_all_mit_params(), then checks both parameter arrays and all 20 validity bits. If a status check fails, the example stops configuration and cleans up the connection. After verifying the parameters, enable the joints, wait until all 20 report Enabled, and read the complete measured posture.

3. Send Sweep Commands at a Fixed Interval

Transition smoothly from the measured posture to zero over one second, then send the cosine sweep for joint 0. Each frame contains exactly 20 JointCommand entries. Position uses rad, velocity uses rad/s, and effort uses N·m. The example sets velocity and feedforward effort to zero.

4. Stop Motion and Clean Up

Stop sending, close the publisher, disable the hand, and disconnect. The example attempts every cleanup action even if an earlier action fails. Normal completion or an operator stop returns 0 when cleanup succeeds. Configuration, runtime, or cleanup failures return 1 and print errors to stderr. The torque limits set by the example remain after exit and also affect subsequent Position control mode. See Save and Restore Limits for restoration steps.

Running It

Notes

If a mode write, parameter readback, or readiness check fails, stop before publishing. Check the device’s fault codes and firmware support. For mode requirements, configuration, and restart handling, see MIT_V2 Migration.