Vive Tracker APIServer
Get Started
pip install vive-tracker-apiserver
From source:
git clone https://github.com/mvig-robotflow/vive-tracker-apiserver
cd vive-tracker-apiserver
python setup.py install
Usage
Set up the SteamVR
First, install SteamVR. Configure and pair the trackers with HMD or receiver.
Then run the configuration command:
python -m vive_tracker_apiserver configure
This will automatically detect all trackable devices and generate a config.yaml file under $pwd. It looks like this
vive_tracker_apiserver:
api:
interface: 0.0.0.0
port: 8080
data_path: ./tracker_data
debug: false
trackers:
- name: tracker_1
uid: LHR-656F5409
- name: tracker_2
uid: LHR-6A736404
The screen might blink during this configuration
After the configuration. Run the apiserver with configuration
python -m vive_tracker_apiserver serve --config=config.yaml
...
INFO:apiserver.app:loading openvr components
...
INFO:apiserver.app:server is tarted!
INFO:apiserver.app:vive tracker service listen at 8080
INFO:apiserver.app:vive tracker config Config(path='./config.yaml', trackers=[TrackerConfig(uid='LHR-656F5409', name='tracker_1'), TrackerConfig(uid='LHR-6A736404', name='tracker_2')], api_port=8080, api_interface='0.0.0.0', debug=False, data_path='./tracker_data', valid=True)
Here is a minimal working example:
import time
from vive_tracker_apiserver.client import Client
def get_description(data):
return str([f'id:{item.meta.uid} x: {item.pos_x:.2f} y: {item.pos_y:.2f} z: {item.pos_z:.2f}' for item in data.payload])
def test_server():
endpoint = "localhost:8080"
c = Client(endpoint)
response = c.get_group()
print("GetTrackerGroup client received: " + str(response))
stream = c.open_group_stream()
print("GetTrackerGroupStream client received: " + str(response))
try:
while True:
data = stream.read()
if data.meta.valid == False:
time.sleep(0.05)
continue
print('\r'+get_description(data), end="")
except KeyboardInterrupt as e:
stream.close()
if __name__ == '__main__':
test_server()
gRPC Server
Run this command
python -m vive_tracker_apiserver serve
Testing with cli tools
python -m vive_tracker_apiserver test.server
You will be asked to input API endpoint.
Testing with Open3D visualization
python -m vive_tracker_apiserver test.visualize
You will be asked to input API endpoint.
Generate Client
First run cd vive_tracker_apiserver/grpc, then run:
# cd vive_tracker_apiserver/grpc
python -m grpc_tools.protoc -I../../manifests/protos --python_out=. --pyi_out=. --grpc_python_out=. ../../manifests/protos/tracker_packet.proto
You might need to replace line 5 of vive_tracker_apiserver/grpc/tracker_packet_pb2_grpc.py with import vive_tracker_apiserver.grpc.tracker_packet_pb2 as tracker__packet__pb2
Metadata
Release files for vive-tracker-apiserver 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| vive-tracker-apiserver-0.0.7.tar.gz | 16.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| vive_tracker_apiserver-0.0.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 38.5 kB
Release files / vive-tracker-apiserver-0.0.7.tar.gz
| Download URL | vive-tracker-apiserver-0.0.7.tar.gz |
|---|---|
| Size | 16.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
75621a6c3f2bf7176d977ebe209f80d7bb4bbe6c85bcfb38056615eacf3d9ccb
|
|
BLAKE2b-256 checksum How to use checksums |
d9bd429d0bd13f222cde80c7dde82d2c8549cffdc676f981d01ddc4c70f8f02e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.9.19
|
Release files / vive_tracker_apiserver-0.0.7-py3-none-any.whl
| Download URL | vive_tracker_apiserver-0.0.7-py3-none-any.whl |
|---|---|
| Size | 22.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
15ecc2c2b5ad67313881f42bdfb3df55693dfc9f60fd4fa2498e7b2076f884a4
|
|
BLAKE2b-256 checksum How to use checksums |
915f339366d9a20c3d9563c9670cd93baab837e710f5c4edda1938efe07cf046
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.9.19
|