Haptics
Set and clear fingertip haptic feedback.
Haptics
Setting and clearing vibration
Wired and Receiver wireless gloves use the same haptics APIs, with integer strengths from 0..127. See Device discovery and connection for wireless setup.
Set or clear the haptic strength of each finger through device.haptics():
auto haptics = device.haptics();
haptics.set(qnbot::Haptics{{
{qnbot::GloveFinger::thumb, 80},
{qnbot::GloveFinger::index, 40},
}});
if (const auto latest = haptics.latest()) {
std::cout << latest->sequence << '\n';
}
haptics.clear();Reading the current setting
latest() reflects the haptic setting currently saved by the SDK, not a hardware execution acknowledgement:
| Event | latest() result | Notes |
|---|---|---|
set() succeeds | The new vibration setting | — |
set() or clear() fails | Unchanged | A failure publishes no new state |
clear() succeeds | std::nullopt | No additional callback sample is produced |
stop(), e-stop, or connection loss | std::nullopt | The SDK updates the state to empty |
| After reconnecting | Still std::nullopt | Not replayed automatically; call set() again if needed |
An empty state only means that the SDK currently has no haptic setting; it does not guarantee that a disconnected device has received zero output.
Constraints and reference
For the input and return fields, see Haptics.
The strength range is 0..127. An external connection does not support haptics; writes are
rejected. Applications should clear haptic settings that are no longer needed before stopping or
closing.
Existing integer strengths in 0..100 remain valid without conversion. Composite Glove haptic requests are ignored; see the composite guide for supported capabilities.