Esempio n. 1
0
def printSteamVRInfo():
    print("OpenVR test program")

    if openvr.isHmdPresent():
        print("VR head set found")

    if openvr.isRuntimeInstalled():
        print("Runtime is installed")
        print(openvr.runtimePath())

    #To initialize the API and get access to the vr::IVRSystem interface call the vr::VR_Init function
    # VRApplication_Background
    # VRApplication_Utility : IVRSettings and IVRApplications are guaranteed to work
    result = openvr.checkInitError(openvr.VRApplication_Background)
    print("test", result, " ", openvr.getVRInitErrorAsSymbol(result))
    if result == 0:
        state = 10100
    #-------------------------------------------------------------
    #Developing part

    vr_app = openvr.IVRApplications()
    #ctypes.c_char_p("410570")
    print("vr_app getApplicationState: ", vr_app.getApplicationState())
    print(
        "vr_app getTransitionState: ",
        vr_app.getApplicationsTransitionStateNameFromEnum(
            vr_app.getTransitionState()))
    print("vr_app : ",
          vr_app.getApplicationProcessId('SteamVR.exe'.encode("utf-8")))
    # vr_settings = openvr.VRSettings()
    if result == 0:
        vr_sys = openvr.VRSystem()
        state = vr_sys.getInt32TrackedDeviceProperty(
            openvr.k_unTrackedDeviceIndex_Hmd, 10100)
        print("CloudXR_Server_State ",
              ServerState(ctypes.c_ulong(state[0]).value).name)
        print("isDisplayOnDesktop ", vr_sys.isDisplayOnDesktop())
        print(
            "isTrackedDeviceConnected ",
            vr_sys.isTrackedDeviceConnected(openvr.k_unTrackedDeviceIndex_Hmd))
        # print("getPropErrorNameFromEnum ", vr_sys.getPropErrorNameFromEnum(result))
        driver = vr_sys.getStringTrackedDeviceProperty(
            openvr.k_unTrackedDeviceIndex_Hmd,
            openvr.Prop_TrackingSystemName_String,
        )
        display = vr_sys.getStringTrackedDeviceProperty(
            openvr.k_unTrackedDeviceIndex_Hmd,
            openvr.Prop_SerialNumber_String,
        )
        print("driver: ", driver, "; diplay :", display)
Esempio n. 2
0
def main(buttons=False, args=None):
    if not openvr.isRuntimeInstalled:
        raise RuntimeError("OpenVR / SteamVr is not Installed Exit")
    if not openvr.isHmdPresent():
        raise RuntimeError(
            "SteamVr is not running or Headmount is not plugged in")

    rclpy.init(args=args)
    system = openvr.init(openvr.VRApplication_Scene)

    minimal_publisher = VrPublisher(system, buttons)

    rclpy.spin(minimal_publisher)

    minimal_publisher.destroy_node()
    rclpy.shutdown()
    openvr.shutdown()
def main():
    # Should we look for VR input to detect AFK state or should
    # we just focus on getting the app title?
    #
    # Possibly useful endpoints:
    #   IVRApplications.getApplicationPropertyString
    #   IVRApplications.getApplicationPropertyString

    if openvr.isHmdPresent():
        print("VR head set found")

    if openvr.isRuntimeInstalled():
        print("Runtime is installed")

    vr_system = openvr.init(openvr.VRApplication_Utility)
    print(dir(vr_system))

    print(openvr.runtimePath())

    print(vr_system.getRecommendedRenderTargetSize())

    print(vr_system.isDisplayOnDesktop())

    def get_appkeys(ivrapps: openvr.IVRApplications):
        appkeys = []
        appcount = ivrapps.getApplicationCount()
        for idx in range(appcount):
            # TODO: I'm not sure how to handle buffer in this C++ interop context
            pchAppKeyBuffer = ''
            pchAppKeyBufferLen = 90
            error = ivrapps.getApplicationKeyByIndex(idx, pchAppKeyBuffer,
                                                     pchAppKeyBufferLen)
            if error:
                print(error)
            appkeys.append(pchAppKeyBuffer)
        return appkeys

    def get_app(ivrapps: openvr.IVRApplications):
        for pchAppKey in get_appkeys(ivrapps):
            pchPropertyValueBuffer = ''
            unPropertyValueBufferLen = 90
            appname = ivrapps.getApplicationPropertyString(
                pchAppKey, openvr.VRApplicationProperty_Name_String,
                pchPropertyValueBuffer, unPropertyValueBufferLen)
            print(appname)
Esempio n. 4
0
#!/bin/env python

import sys
import time
import openvr

print ("OpenVR test program")

if openvr.isHmdPresent():
    print ("VR head set found")

if openvr.isRuntimeInstalled():
    print ("Runtime is installed")

vr_system = openvr.init(openvr.VRApplication_Scene)

print (openvr.runtimePath())

print (vr_system.getRecommendedRenderTargetSize())

print (vr_system.isDisplayOnDesktop())

for i in range(10):
    xform = vr_system.getEyeToHeadTransform(openvr.Eye_Left)
    print (xform)
    sys.stdout.flush()
    time.sleep(0.2)

openvr.shutdown()
Esempio n. 5
0
#!/usr/bin/env python

from gl_renderer import OpenVrGlRenderer
from openvr.color_cube_actor import ColorCubeActor
from sdl_app import SdlApp
import sys
import time
import openvr
"""
Minimal sdl programming example which colored OpenGL cube scene that can be closed by pressing ESCAPE.
"""

print("OpenVR test program")

if openvr.isHmdPresent():
    print("VR head set found")

if openvr.isRuntimeInstalled():
    print("Runtime is installed")

vr_system = openvr.init(openvr.VRApplication_Scene)

print(openvr.runtimePath())

print(vr_system.getRecommendedRenderTargetSize())

print(vr_system.isDisplayOnDesktop())

if __name__ == "__main__":
    renderer = OpenVrGlRenderer(multisample=2)
    renderer.append(ColorCubeActor())
def check_system_ready():
    establish_server_connection()
    return openvr.isRuntimeInstalled() and openvr.isHmdPresent()