# libsurvive ![Logo](https://cloud.githubusercontent.com/assets/2748168/24084003/9095c98a-0cb8-11e7-88a3-575f9f4c7bb4.png) An Open-Source tool for working with lighthouse-based tracking data, including support for the HTC Vive, which is still in the experimental phase. Most of the development is discussed on Discord. Join the chat and discussion here: https://discordapp.com/invite/7QbCAGS ## Livestream collection | Note | Youtube URL | Run time | | -------------------------------------- | ------------------------------------------- | -------- | | First livestream | https://www.youtube.com/watch?v=sv_AVI9kHN4 | 5:01:25 | | Second livestream | https://www.youtube.com/watch?v=gFyEbGQ88s4 | 4:03:26 | | Summary of first and second livestream | https://www.youtube.com/watch?v=oHJkpNakswM | 23:00 | | Third livestream | https://www.youtube.com/watch?v=RExji5EtSzE | 4:11:16 | | Fourth livestream | https://www.youtube.com/watch?v=fces1O7kWGY | 4:50:33 | | Fifth livestream | https://www.youtube.com/watch?v=hHt3twW5_fI | 3:13:38 | | Sixth livestream | https://www.youtube.com/watch?v=JsfkNRFkFM4 | 3:44:49 | | Seventh livestream | https://www.youtube.com/watch?v=EKSHvO3QSWY | 1:17:21 | Notes from second livestream trying to reverse engineer the watchman protocol: https://gist.github.com/cnlohr/581c433f36f4249f8bbc9c2b6450ef0e Please see the issues for what help needs to be done now! ## Extra resources HackADay article and video with Dr. Yates on how they made the Vive a thing. http://hackaday.com/2016/12/21/alan-yates-why-valves-lighthouse-cant-work/ ## Getting things working There are two things you should consider doing to your system before running libsurvive. (1) Install the udev rules: ```cp usefulfiles/81-vive.rules to /etc/udev/rules.d/``` and reboot. (2) If you are running on an NVIDIA Card, you will need to AllowHMD to true. Add the following line to your /etc/X11/xorg.conf device section: ```Option "AllowHMD" "yes"``` ## Introduction High-performance HTC Vive Library I say "high-performance" really this project is based tightly off of OSVR-Vive-Libre, but, specifically is an attempt to: 1. Minimize external libraries. Actual reason for starting this: Downloading all of the libraries needed for OSVR-Vive-Libre maxed out my data plan. 2. Put it under an open-source instead of a force-source license. (GPL to MIT/X11) 3. Write it in C. 4. Avoid extra layers where convenient. 5. (long shot) Make the vive viable for use with Intel Integrated Graphics systems. [It works with HD4000 using DisplayPort. See "Intel Integrated Graphics" section below.] Will ~~I~~ we succeed? Probably not. ~~Definitely going to try!~~ Though it's looking like we might. ## External dependencies * libUSB (Linux) or hidapi (Win, OSX; included in redist) * pthread * libX11 (Linux) or Native (win32) or OpenGL (OSX) * zlib (Linux) or puff.c (win32, included in redist) ## Architecture
Description | Diagram |
---|---|
### Layout In the src/ folder you'll find most of the internal code that is part of libsurvive. The redist/ folder contains code that libsurvive uses that was copied from other projects. Libsurvive links to other libraries, but very few. You'll find that most of the functionality lies within libsurvive or in the redist folder. For the user-facing headers you can find them in the include/ folder. ### Logical Data Flow There are device drivers, such as survive_vive.c which connect to physical devices, via libUSB, hidapi or another method and collect raw IMU and lightcap data. Lightcap data is specically a sensor ID, light pulse length (in ticks) and the time of the light pulse (in ticks). The driver also must provide locations of the sensors to populate the SurviveObject structures of whatever sensors that driver is responsible for. Once this data is collected, the light pulses are disambiguated (see survive_data.c) into OOTX sync pulses (id -1, -2 depending on lighthouse) as well as sweep pulses which provide the time of a sweep pulse passing the sensor. This is passed off to "lightproc." The default behavior for lightproc can be found in survive.c. The user may override this, however, if they have interest in the raw pulse information for whatever reason. The default behavior for lightproc determines the time delta between the sync pulse and the sweep pulse time and derives angle. The derivation for the angle is simply calculated by the time difference between the sync pulse and the sweep pulse. It then calls "angleproc" (not implemented yet: Using OOTX data from lighthouses to correct and tweak angles) Angleproc may also be overridden by the user for similar purposes to for "angleproc" which passes its information off to a calibrator (if running) as well as to whatever posers are enabled. The posers will take this data and determine position from it. |