Giter VIP home page Giter VIP logo

z4urce / vrc-haptic-pancake Goto Github PK

View Code? Open in Web Editor NEW
72.0 2.0 4.0 7.48 MB

A dirt cheap solution to enable haptic feedback on the vive (and other OpenVR compatible) trackers in VRChat (Or other OSC compatible VR games)

License: GNU General Public License v3.0

Python 99.74% Batchfile 0.26%
haptic-feedback haptic-interface haptics openvr osc vibration vive vive-tracker vivetracker vr vrchat

vrc-haptic-pancake's Introduction

VRChat Haptic Pancake (for trackers)

A dirt cheap solution to enable haptic feedback on the vive (and other OpenVR compatible) trackers in VRChat (Or other OSC compatible VR games)

Contact

Curious about the development? Have any questions? Join the discord!

Discord

How to make

> Check out the Wiki for a full guide! <

Planned Features

  • Support for DIY haptic devices through serial connection

Frequently Asked Questions

  • Will this harm my tracker in any way?
    • The tracking capabilities of your tracker should not get harmed at all. In case of an unexpected high load the output pin of your tracker might get fried out. That only means that in the worst case scenario you won't be able to use a vibration function on that particular tracker anymore. However after two weeks of intensive testing on my own trackers I experienced no problems whatsoever. I'll update this page if anything changes.
  • Will this affect my tracking?
    • Since I implemented the vibration pattern system, it barely affects the tracking. But it still depends on the selected pattern. For example You should experience minor to no drifting with the 'Linear' one.
  • Can I put the tracker elsewhere after setting up my avatar?
    • Yes. None of the trackers are permanently linked to any parts of your avatar. In fact you can even hotswap them. Just ensure you are using the right parameters in the bridge app.

Support the project

Buy Me a Coffee at ko-fi.com

Special Thanks

  • @BubblegumFoxxo (For helping in the testing and debugging)
  • @vulp_vibes (for giving me the idea)

vrc-haptic-pancake's People

Contributors

digitalf0x avatar z4urce avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

vrc-haptic-pancake's Issues

Add a test function

Feature request
A button or slider to test the motor without a osc connection would be nice.

Migrate to IVRInput's haptic Actions and/or consider OpenXR?

About that IVRInput

This is the supported, modern way forward.

  • Allows for frequency modulation
    • Even with ERMs instead of LRAs, offers a slightly adjustable haptics feel on Tundra Trackers
  • Allows Steam to automatically map Vive/Tundra/etc Trackers with given SteamVR roles (e.g. Chest, Left Foot)
    • Haptic Pancake would just be mapping from e.g. "Chest tracker" to /avatar/parameters/something_here
  • Solves the Tundra Tracker issue with the legacy haptics pulses being cut off, requiring 4 ms loops
  • As part of this, we'll want a .vrmanifest file which will make the Bridge App auto-start with SteamVR, too

But.. it is an involved change.

I still don't get why lighthouse_console's haptic2 command can use the new haptics API without the need for the entire SteamVR Actions system - if we could simply copy that, then Haptic Pancake itself would need almost no changes.

Further research on triggerHapticVibrationAction and how the Lighthouse console uses it is needed.

This is a large enough project we may want to make this a v2 of Tundra Tracker support, or even a v2 of the entire Bridge App.

Considering Valve is pushing SteamVR towards OpenXR (an actually independent standard) as the replacement for OpenVR (Valve's own standard), perhaps OpenXR will provide another path forward? It looks like OpenXR uses the same rebindable Action system, though.

Using lighthouse_console

With SteamVR open and your headset connected to your PC

Launching console

Linux

Run as your normal user:

$HOME/.local/share/Steam/steamapps/common/SteamVR/tools/lighthouse/bin/linux64/lighthouse_console

Windows

May need to run as administrator:

C:\Program Files (x86)\Steam\steamapps\common\SteamVR\tools\lighthouse\bin\win32\lighthouse_console.exe

(See this HTC thread)

Examples

Haptics help

lh> help
[…]
haptic [<duration_us>] [<interval_us>] [<repeat_count>] Trigger haptic pulse
haptic2 [<frequency_hz>] [<duration_ms>] [<amplitude_percent>]  Trigger haptics
[…]

Legacy API

triggerHapticPulse()

Some long duration (4000µs duration, 4000µs interval, 100× repeat):

lh> haptic 4000 4000 100

Modern API

triggerHapticVibrationAction()

400 Hz for 4 seconds:

lh> haptic2 400 4000

SteamVR OpenVR API

Legacy API (in use now)

    def triggerHapticPulse(self, controllerDeviceIndex, axisId, durationMicroSec: int) -> None:
        """
        Trigger a single haptic pulse on a controller. After this call the application may not trigger another haptic pulse on this controller
        and axis combination for 5ms. This function is deprecated in favor of the new IVRInput system.
        """
        […]

OpenVR says the duration is in microseconds, NOT milliseconds!

Vive Trackers are doing something wrong. (Perhaps they were built to an older spec, and HTC didn't want to break backwards compatibility for their enterprise customers?) Tundra Trackers, Index Wands, etc are doing things correctly.

Tundra Trackers do have a problem with cutting off haptic pulses longer than about 4000 microseconds, though.

Modern API (IVRInput)

    def triggerHapticVibrationAction(self, action, startSecondsFromNow: float, durationSeconds: float, frequency: float, amplitude: float, restrictToDevice) -> None:
        """Triggers a haptic event as described by the specified action"""
        […]

SteamVR now makes everything - including haptics! - rebindable with SteamVR Input 2.0, as per the Action manifest.

Haptic Pancake will no longer handle mapping to specific trackers. This is handled by SteamVR's own UI with assigning roles to trackers.

This should allow changing tracker bindings inside SteamVR and when Haptic Pancake isn't running.

This involves a lot of haptics vibrations:

vibration - The action is a output haptic vibration. Include one of these per type of haptic output in your application so they can be bound to different output devices if the user has them available. Examples include haptics due to firing a gun (that would usually be bound directly to a controller) or haptics from getting shot (which could be bound to a feedback vest worn on the chest).

And I think this is looking at…

  1. def setActionManifestPath(self, actionManifestPath: str) -> None: which will need generated according to the Valve wiki page
  2. def getActionHandle(self, actionName: str): on tracker load
  3. def triggerHapticVibrationAction(self, action, [...]) -> None: inside the Bridge App haptics loop

And to allow binding when Bridge App isn't running, and to have SteamVR auto-start the Bridge App, then we need a .vrmanifest file, like how WlxOverlay-S creates it - see below.

Other context

The whole action manifest is the route VRCOSC went, though they're only handling controllers.

VRC-OSC-Manager looked interesting initially as it supports both Linux and Windows and allows multiple plugins to use one OSC input, but that entirely skips VR manifests.

Example config files

Adapted from Valve's documentation.
BridgeApp/hp_actions.json:

{
  "default_bindings": [
   {
      "controller_type": "some_controller",
      "binding_url": "hp_bindings_fbt_trackers.json"
   }
  ], 
  "actions": [
    {
      "name": "/actions/hp_haptics/out/chest",
      "requirement" : "optional",
      "type": "vibration"
    },
    {
      "name": "/actions/hp_haptics/out/foot_left",
      "requirement" : "optional",
      "type": "vibration"
    }
  ],
  "action_sets": [
    {
      "name": "/actions/hp_haptics",
      "usage": "leftright"
    }
  ],
  "localization" : [
   {
       "language_tag": "en_us",

        "/actions/hp_haptics" : "Haptics",

        "/actions/hp_haptics/out/chest" : "Touch near Chest",
        "/actions/hp_haptics/out/foot_left" : "Touch near Left Foot",

    }
  ]
}

Adapted from WlxOverlay-S actions_binding_vive.json.
BridgeApp/hp_bindings_fbt_trackers.json:

{
   "action_manifest_version" : 0,
   "app_key" : "galister.wlxoverlay-s",
   "bindings" : {
      "/actions/default": {
         "haptics": [
            {
               "output": "/actions/hp_haptics/out/chest",
               "path": "/user/[path for SteamVR's chest tracker role, e.g. 'hand/left']/output/haptic"
            },
            {
               "output": "/actions/hp_haptics/out/foot_left",
               "path": "/user/[path for SteamVR's left foot tracker role, e.g. 'hand/left']/output/haptic"
            }
         ]
      }
   },
   "category" : "steamvr_input",
   "controller_type" : "TODO_vive_controller",
   "description" : "Ver1",
   "interaction_profile" : "",
   "name" : "Haptic Pancake configuration for Full Body Trackers",
   "options" : {
      "mirror_actions" : false,
      "simulated_controller_type" : "none"
   },
   "simulated_actions" : []
}

Adapted from WlxOverlay-S openvr/manifest.rs.
BridgeApp/haptic_pancake.vrmanifest:

{
    "source" : "builtin",
    "applications" : [
            {
                "app_key" : "z4urce.vrc-haptic-pancake",
                "launch_type" : "binary",
                "binary_path_linux" : "PATH/TO/hapticpancake",
                "binary_path_windows" : "PATH\\TO\\hapticpancake.exe",
                "is_dashboard_overlay" : false,
                "strings" : {
                    "en_us": {
                        "name" : "Haptic Pancake",
                        "description" : "A cheap solution to enable haptic feedback on full body trackers in OSC compatible games.",
                    }
                }
            }
        ]
    }

Enclosure for Tundra Tracker's IO Expansion board

In brief

Details

While it's possible to wire up the haptic actuator on the side and tape it somewhere, it'd be nice to integrate this with the Tundra Tracker enclosure directly. At the time of my order, Tundra Labs shipped the right haptics actuator with the IO Expansion Board, I'd just need to solder it on.

Looking around, I've not found any existing shared 3D printable enclosures that could hold the haptics actuator.


I noticed your hidden Ongoing Research wiki page mentions this is under consideration. If there's anything I can do to help that research, let me know. I'm handy with electronics, though I lack a 3D printer (I can use services such as Craftcloud if needed).

This project seems to not be too Windows-centric, either, so I'd be happy to try to help with getting it working on Linux as part of this.

long vibrations stop

long vibrations get stopped after a while. I dont know if this is by design or a bug. vibration pattern is set to none.

VRCOSC Modular Support

Essentially, there is this application called VRCOSC. "VRCOSC is intended to act as a wrapper around VRChat's OSC system to make creating OSC programs easier, provide interfaces for other APIs and frameworks that might be useful to an OSC project, and act as a centralized source for useful OSC programs so that a user will only need to download a single application."

Essentially, I'm requesting that you port the software to work with this application so that instead of users needing to have a different application for everything, all OSC stuff including your haptic pancakes would be utilized through one application making it easier for everyone! I'm curious to see if you'll support the application as it has large numbers of users. They have documentation on how to make Modules here.

bool mode

Instead of vibrating when the value changes add an optional mode for simpler on/off vibration.

Tracker Autorefresh

Hi,

love your porgram!
would be nice to have some kind of autorefresh function for the trackers

when i start SteamVR it takes soem time for it to register all trackers, i'm in game already by that time and i have to remember to klick the refresh button via the virtual desktop (which i forget most of the time 😅)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.