diff options
| author | yum <yum.food.vr@gmail.com> | 2022-11-12 14:14:49 -0800 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2022-11-12 14:14:49 -0800 |
| commit | 3b038d23ec7621e0164c1901b416bf77a27d8cf3 (patch) | |
| tree | e92badc27b9a93bd7173de993da02a20a560a778 /steamvr.py | |
| parent | 8a7858ad4e965f5410faa4ae5e7ad4f79a280d43 (diff) | |
Clicking the left joystick resets the board.
* Increase no speech probability threshold. This is what was preventing
short transcriptions from working. We rely more on the avg logprob
filter now.
* Remove string matching logic from transcribe. Now when we get 2
consecutive identical transcriptions, we commit the transcription.
This *could* cause words to get cut off but in practice it doesn't seem to
happen.
* Fix steamvr joystick click detection. Moving the joystick would also
fire the event, which is not correct.
* Combine locks in transcribe.py.
* Remove "clear" vocal control.
* osc_ctrl.clear() resets last_message_encoded
* Remove osc_ctrl.sendMessage (unused)
Diffstat (limited to 'steamvr.py')
| -rw-r--r-- | steamvr.py | 18 |
1 files changed, 11 insertions, 7 deletions
@@ -16,9 +16,6 @@ class SessionState: # Whether the configured input event is high or low. self.event_high = False -def getState() -> SessionState: - return SessionState() - # Checks if the given button on the given controller is pressed. # Defaults to joystick click / left hand. # Returns three values: @@ -40,12 +37,21 @@ def pollButtonPress( if state.unPacketNum == session_state.last_packet: return EVENT_NONE - #print("button pressed: %016x" % state.ulButtonPressed) + # Clicking joysticks and moving joysticks fire the same events. To + # differentiate movement from clicking, we create a dead zone: if the event + # fires while the stick isn't moved far from center, we assume it's a + # click, not movement. + dead_zone_radius = 0.5 + # This is the ID of event for the joystick being clicked. joy_click = vr.k_EButton_Axis0 joy_click_mask = (1 << joy_click) ret = EVENT_NONE - if (state.ulButtonPressed & joy_click_mask) != 0: + if (state.ulButtonPressed & joy_click_mask) != 0 and\ + (state.rAxis[0].x**2 + state.rAxis[0].y**2 < dead_zone_radius**2): + #print("button pressed: %016x" % state.ulButtonPressed) + #for i in range(0, 5): + # print("axis {} x: {} y: {}".format(i, state.rAxis[i].x, state.rAxis[i].y)) if not session_state.event_high: ret = EVENT_RISING_EDGE session_state.event_high = True @@ -65,5 +71,3 @@ if __name__ == "__main__": elif event == EVENT_FALLING_EDGE: print("falling edge") - - |
