SDKC++ SDK

Haptics

Set and clear fingertip haptic feedback.

Current version · 1.4.0

Haptics

Setting and clearing vibration

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:

Eventlatest() resultNotes
set() succeedsThe new vibration setting—
set() or clear() failsUnchangedA failure publishes no new state
clear() succeedsstd::nulloptNo additional callback sample is produced
stop(), e-stop, or connection lossstd::nulloptThe SDK updates the state to empty
After reconnectingStill std::nulloptNot 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..100. An external connection does not support haptics; writes are rejected. Applications should clear haptic settings that are no longer needed before stopping or closing.