openvr icon indicating copy to clipboard operation
openvr copied to clipboard

[MISSING]: Driver development documentation for Haptic Pulse Event

Open TheDeveloperGuy opened this issue 3 years ago • 2 comments

There is no documentation on this event for drivers. Digging around in the Unreal plugin documentation I was able to find the following:

  • Frequency is 0-360Hz
  • Amplitude is 0-1

What is missing is what the range of the Duration is (some unofficial sources say 0-5 seconds), and what the driver is intended to do for a duration of zero seconds (which is the majority of the events sent by Home and Dashboard), or an amplitude of zero.

Here is a list of events sent to my controller driver from Home and Dashboard (format is controller ID, duration, frequency, amplitude):

1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 0, 0.000000, 1.000000, 0.160000 0, 0.000000, 1.000000, 0.160000 0, 0.000000, 1.000000, 0.160000 0, 0.000000, 1.000000, 0.160000 0, 0.000000, 1.000000, 0.160000 0, 0.000000, 1.000000, 0.160000 0, 0.000000, 1.000000, 0.160000 0, 0.000000, 1.000000, 0.160000 0, 0.000000, 1.000000, 0.160000 0, 0.000000, 1.000000, 0.160000 0, 0.000000, 1.000000, 0.160000 0, 0.000000, 1.000000, 0.160000 0, 0.000000, 1.000000, 0.160000 0, 0.000000, 1.000000, 0.160000 0, 0.000000, 1.000000, 0.160000 0, 0.000000, 1.000000, 0.160000 0, 0.000000, 1.000000, 0.160000 0, 0.000000, 1.000000, 0.160000 0, 0.000000, 1.000000, 0.160000 0, 0.000000, 1.000000, 0.160000 0, 0.000000, 1.000000, 0.160000 0, 0.000000, 1.000000, 0.160000 0, 0.000000, 20.000000, 0.200000 0, 0.000000, 20.000000, 0.100000 0, 0.000000, 20.000000, 0.200000 0, 0.000000, 20.000000, 0.100000 0, 0.000000, 20.000000, 0.200000 0, 0.000000, 20.000000, 0.100000 0, 0.000000, 20.000000, 0.200000 0, 0.000000, 20.000000, 0.100000 0, 0.000000, 20.000000, 0.200000 0, 0.000000, 20.000000, 0.100000 0, 0.000000, 20.000000, 0.200000 0, 0.000000, 20.000000, 0.100000 0, 0.000000, 20.000000, 0.200000 0, 0.000000, 20.000000, 0.100000 0, 0.000000, 1.000000, 0.160000 0, 0.000000, 1.000000, 0.160000 0, 0.000000, 1.000000, 0.160000 0, 0.000000, 1.000000, 0.160000 0, 0.000000, 1.000000, 0.160000 0, 0.000000, 1.000000, 0.160000 0, 0.000000, 1.000000, 0.160000 0, 0.000000, 1.000000, 0.160000 0, 0.000000, 1.000000, 0.160000 0, 0.000000, 1.000000, 0.160000 0, 0.000000, 1.000000, 0.160000 0, 0.000000, 1.000000, 0.160000 0, 0.000000, 1.000000, 0.160000 0, 0.000000, 1.000000, 0.160000 0, 0.000000, 1.000000, 0.160000 0, 0.000000, 1.000000, 0.160000 0, 0.000000, 1.000000, 0.160000 0, 0.000000, 1.000000, 0.160000 0, 0.000000, 1.000000, 0.160000 0, 0.000000, 1.000000, 0.160000 0, 0.000000, 20.000000, 0.200000 0, 0.000000, 20.000000, 0.100000 0, 0.000000, 20.000000, 0.200000 0, 0.000000, 20.000000, 0.100000 0, 0.000000, 20.000000, 0.200000 0, 0.000000, 20.000000, 0.100000 0, 0.000000, 1.000000, 0.160000 0, 0.000000, 1.000000, 0.160000 0, 0.000000, 20.000000, 0.200000 0, 0.000000, 20.000000, 0.100000 0, 0.000000, 20.000000, 0.200000 0, 0.000000, 20.000000, 0.100000 0, 0.000000, 20.000000, 0.200000 0, 0.000000, 20.000000, 0.100000 0, 0.000000, 1.000000, 0.160000 0, 0.000000, 1.000000, 0.160000 0, 0.000000, 1.000000, 0.160000 0, 0.000000, 20.000000, 0.200000 0, 0.000000, 20.000000, 0.100000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 1, 0.011000, 1.000000, 0.000000 0, 0.000000, 20.000000, 0.200000 0, 0.000000, 20.000000, 0.100000 0, 0.000000, 20.000000, 0.200000 0, 0.000000, 20.000000, 0.100000

TheDeveloperGuy avatar Aug 23 '21 09:08 TheDeveloperGuy

Also requested 3 years ago here: https://github.com/ValveSoftware/openvr/issues/724#issuecomment-383353802

TheDeveloperGuy avatar Aug 23 '21 09:08 TheDeveloperGuy

Seems that using a minimum duration of 50ms and a minimum amplitude of 0.05 works. Would be useful to know what the driver is intended to do with zero values for duration or amplitude.

TheDeveloperGuy avatar Aug 24 '21 08:08 TheDeveloperGuy

The way I've been doing it is this:

  1. Get the duration, in microseconds: duration * 1000000.0f
  2. Find the period of the whole haptic event, in microseconds: (1 / frequency) * 1000000.0f

Then to work out how long to have the motor spinning: maximum "on duration" of half the period, and some arbituary minimum duration. The on duration then varies by the amplitude between the set minimum and the maximum of half the period.

danwillm avatar Dec 04 '22 20:12 danwillm

A minimum of 0.05 and this method seems to correlate to the values that are output when using a lighthouse hdk.

danwillm avatar Dec 04 '22 20:12 danwillm