Skip to content

Instantly share code, notes, and snippets.

@DanielArnett
Last active February 1, 2024 22:20
Show Gist options
  • Star 30 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save DanielArnett/c9a56c9c7cc0def20648480bca1f6772 to your computer and use it in GitHub Desktop.
Save DanielArnett/c9a56c9c7cc0def20648480bca1f6772 to your computer and use it in GitHub Desktop.
How to use the HTC Vive Trackers in Ubuntu using Python 3.6.

This tutorial will guide you through the setup of the HTC Vive Tracker in Python 3.6 on Ubuntu 14.04.

Prerequesites

Up to date graphics drivers

x86 architecture

SteamVR requires >4GB disk space

Installation Instructions

  1. Install Steam, as well as Python and OpenVR dependencies

sudo apt-get install steam libsdl2-dev libvulkan-dev libudev-dev libssl-dev zlib1g-dev python-pip

  1. Make Steam account & Log in.

  2. Install SteamVR

    1. Click Library

    2. Click VR

    3. Click under Tools there should be SteamVR. Click the blue Install button.

  3. Make a Symbolic Link from libudev.so.0 to libudev.so.1 for SteamVR to use

sudo ln -s /lib/x86_64-linux-gnu/libudev.so.1 /lib/x86_64-linux-gnu/libudev.so.0

  1. Install pyopenvr

sudo pip install -U pip openvr

  1. Clone triad_openvr in a working directory

git clone https://github.com/TriadSemi/triad_openvr.git

  1. (Optional) Disable the headset requirement with your preferred text editor

gedit ~/.steam/steam/steamapps/common/SteamVR/resources/settings/default.vrsettings

  1. Change the third line from "requireHmd" : true, to "requireHmd" : false,

  2. Save and exit the settings document.

Usage

  1. Start SteamVR from the Steam Library

  2. Turn on the tracker with its button, and make sure that its wireless USB dongle is plugged in to your computer. If the tracker shows up in the SteamVR overlay skip to step 4.

  3. Sync the tracker. Hold the button on the tracker until the light blinks. On the SteamVR overlay click the "SteamVR" dropdown menu. Click Devices->Pair Controller. The Tracker should then pair with the computer, and a green outline of the tracker should appear on the SteamVR overlay. If this doesn't work try unplugging the wireless USB dongle, plugging it back in, and restarting SteamVR.

  4. Ensure the Lighthouse base stations are turned on, facing each other, and have green lights showing on them. Place the tracker in view of the Base Stations. The SteamVR overlay should now show two green square Base Stations and a solid green Tracker hexagon. The tracker is now working.

  5. Start the tracker_test.py python script to view the x y z roll pitch yaw output from the tracker.

cd triad_openvr/
`python3.6 ./tracker_test.py
  1. If everything went well you should now see the data coming from the Tracker. Use tracker_test.py as a sample program to work from to integrate into your project.

Command Line

To start SteamVR from the commandline you can run (as one command):

LD_LIBRARY_PATH=~/.steam/bin32/ ~/.steam/bin32/steam-runtime/run.sh ~/.steam/steam/steamapps/common/SteamVR/bin/vrstartup.sh

This will start the server in another process, so you're free to keyboard interrupt (Ctrl+C) the terminal once the server starts.

To kill the SteamVR process:

sudo killall -9 vrmonitor

Links

This is based off of Triad Semiconductor's awesome tutorial found here:

http://help.triadsemi.com/steamvr-tracking/steamvr-tracking-without-an-hmd/

Also thanks to Christopher Bruns for his work on pyopenvr.

https://github.com/cmbruns/pyopenvr

@eric-schleicher
Copy link

eric-schleicher commented Oct 11, 2017

It might be a good idea to add a section for setting up the null driver so that SteamVR will report ready. will fork. It also would be useful to roll this into the pyopenvr wiki.

@chopin1998
Copy link

i can read position data now, thank you very much!

But in my computer(Linux, t480s), i cannot run room setup, and it said "a key component of StreamVR isn't working.......(306)"

do you know why? Thank you!

@PannetierJ
Copy link

Hello ,

I tried to install your project ( Ubuntu 18.04 )
Nevertheless , I have an error :
python3.6 ./tracker_test.py
VR Path Registry node config is not an array
VR Path Registry node log is not an array
VR Path Registry node config is not an array
VR Path Registry node log is not an array
Traceback (most recent call last):
File "./tracker_test.py", line 5, in
v = triad_openvr.triad_openvr()
File "/home/jpannnetier/Documents/DevelopmentPython/Triad Open VR/triad_openvr-master/triad_openvr.py", line 107, in init
self.vr = openvr.init(openvr.VRApplication_Other)
File "/usr/local/lib/python3.6/dist-packages/openvr/init.py", line 6039, in init
initInternal2(applicationType, pStartupInfo)
File "/usr/local/lib/python3.6/dist-packages/openvr/init.py", line 6143, in initInternal2
_checkInitError(error.value)
File "/usr/local/lib/python3.6/dist-packages/openvr/init.py", line 6025, in _checkInitError
raise OpenVRError("%s (error number %d)" %(getVRInitErrorAsSymbol(error), error))
openvr.OpenVRError: b'VRInitError_Init_NoConfigPath' (error number 111)

@DanielArnett
Copy link
Author

Hey, for some reason I'm not getting notifications for this. Feel free to post an issue on the github page for my ROS node. Here's some of my troubleshooting advice from that page:

The Tracker should then pair with the computer, and a green outline of the tracker should appear on the SteamVR overlay. If this doesn't work try unplugging the wireless USB dongle, plugging it back in, and restarting SteamVR. Restarting your computer wouldn't hurt either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment