Skip to content

Commit

Permalink
[WIP] [Update] Support for Tundra Tracker quirks
Browse files Browse the repository at this point in the history
WORK IN PROGRESS - DO NOT MERGE - INCOMPLETE

This does NOT fix the "Identify" button!

Tentative intensity multiplier value: 9.0
"Linear" is strong, "Throb" is a bit weak, but that may change when
the means of triggering haptic pulses is better tuned to support
Tundra Trackers.

This might break Vive Tracker support, or at the very least needlessly
use more CPU cycles with the tighter FeedbackThread loop.

This might need replaced with support for the IVRInput system in place
of the deprecated triggerHapticPulse() function.

This is just the bare minimum to get Tundra Trackers working with the
bridge app during normal use (not the Identify button).

Haptic Tundrakes, anyone? ...no?
  • Loading branch information
digitalf0x committed Mar 29, 2024
1 parent c467e05 commit 8b823b8
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
27 changes: 26 additions & 1 deletion BridgeApp/app_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,32 @@ def __init__(self, config: AppConfig, tracker: VRTracker, pulse_function, batter
self.strength_delta: float = 0.0
self.last_str_set_time = time.time()

self.interval_ms = 50 # millis
#self.interval_ms = 50 # millis
# HACK: test spacing out pulses
self.interval_ms = 5.1 # millis
# FIXME: Find the slowest interval that allows for a full-duration
# pulse on e.g. Tundra Trackers.
#
# TODO:
# Try switching from "triggerHapticPulse()" to IVRInput
# triggerHapticPulse() is deprecated as per
# See https://github.com/ValveSoftware/openvr/blob/v2.2.3/headers/openvr.h#L2431-L2433
# And https://github.com/ValveSoftware/openvr/blob/v2.2.3/headers/openvr.h#L5216-L5218
#
# This might be specific to Tundra Trackers vs. Vive Trackers, as
# Tundra ships their IO Expansion board with a LRA/haptic actuator
#
# Failing that, this thread could detect Tundra Trackers by model and
# adjust the interval, and adapt the force_pulse() function to
# automatically queue up anything that exceeds the max duration to be
# applied as a series of max duration pulses (until queue is empty).
#
# Example:
# force_pulse() -> self.force_pulse_queue = 500 (ms)
# run()
# inside while True, also check if force_pulse_queue > 0
# triggerHapticPulse(max_duration)
# force_pulse_queue -= max_duration
self.interval_s = self.interval_ms / 1000 # seconds

self.vp = VibrationPattern(self.config)
Expand Down
17 changes: 17 additions & 0 deletions BridgeApp/target_ovr.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from app_config import VRTracker, AppConfig
from typing import List, Dict

## HACK: test spacing out pulses
#import time

class OpenVRTracker:
def __init__(self, config: AppConfig):
Expand Down Expand Up @@ -79,3 +81,18 @@ def is_alive(self):
def __pulse(self, index, pulse_length: int = 200):
if self.is_alive():
self.vr.triggerHapticPulse(index, 0, pulse_length)
# HACK: test spacing out pulses
#pulse_max_amount = 3999
pulse_max_amount = 5000
#sleep_min_delay = pulse_max_amount / 1000000
#sleep_min_delay = 5000 / 1000000
if pulse_length > pulse_max_amount:
print("PULSE LENGTH > " + str(pulse_max_amount) + ": " + str(pulse_length))
#print("PULSE LENGTH: " + str(pulse_length))
#while pulse_length > 3999:
# self.vr.triggerHapticPulse(index, 0, pulse_max_amount)
# pulse_length -= pulse_max_amount
# time.sleep(sleep_min_delay)
#if pulse_length > 0:
# self.vr.triggerHapticPulse(index, 0, pulse_length)
# time.sleep(sleep_min_delay)

0 comments on commit 8b823b8

Please sign in to comment.