Overview
joint_states broadcasts at about 1 kHz by default, which is more than most applications need. set_rate() asks the firmware to push at a rate you choose, cutting network and CPU cost.
The rate belongs to the stream, not to a subscription handle: the setting applies to every subscriber of that stream, and it returns to the device default once the last subscription closes or the device reconnects.
Matching examples: examples/python/wuji_hand_2/4.set_stream_rate.py and examples/c/wuji_hand_2/4_set_stream_rate.c.
For the list of adjustable streams and their API definitions, see SDK Reference. This page covers only how to run it and what the measurements show.
This feature has a firmware requirement. Wuji Hand 2 needs firmware v2.3.0 or later, and devices below that raise on the call. The device verified here runs older firmware, so the success path is described from the release notes and the failure path is measured.
Prerequisites
Hardware
Software
Adjustable and Derived Streams
Derived streams reject
set_rate. hand_joint_angles, hand_skeleton, tip_poses, and imu_data/* are computed from source streams and follow their rate, so calling it on them directly is rejected.
joint_states and joint_diagnostics share one device stream. Adjusting the rate through either subscription changes both.
Data Flow
The request is quantized to a rate the device supports, and the return value is what actually took effect. Don’t assume it equals the request.Runtime Handling
Integration Steps
- Python
- C
Running It
- Python
- C
Measured Behavior Without Firmware Support
Calling this on a device below firmware v2.3.0 raises immediately:set_rate() call site and leaves the subscription untouched — it keeps working, simply at the device default rate. On that device, joint_states measured about 1088 Hz by default.
The most direct way to test support is to call set_rate() once and see whether it raises. The SDK has no separate capability query.
Adapting It
Picking a Rate
Requests are quantized. To confirm what took effect, read the return value ofset_rate(), or count frames over a fixed interval after subscribing.
Effect on Other Subscribers
The rate belongs to the stream. With several subscribers on one stream, a change by any of them reaches all of them. That matters most when processes share a device, where one process lowering the rate can undercut another’s timing.Lowering joint_states Also Lowers joint_diagnostics
They share one device stream, so lowering only one of them isn’t possible.When to Restore
When you don’t need an explicit restore, just close the handle and the rate returns to the device default. Passing 0 explicitly suits continuing to receive at the default rate on the same handle.Related
- Subscribing With Callbacks: how subscriptions are created and live
- Subscribing Asynchronously: using
recv_async()alongside a lowered rate - Wuji Glove Adjusting Stream Rate: the same capability on the glove, requiring firmware v0.11.4 or later