PDA

View Full Version : Handling connected devices


mshukun
07-17-2014, 10:03 AM
I created an application that requires both the Microsoft Xbox controller and Oculus Rift HMD connections. The Vizard throws error messages in Vizard IDE when these devices are not connected. I would like notify device connection errors to the user using vizinput.message(). Unfortunately, I haven't been able to find the way to do it. I appreciate if you have any suggestions/solutions regarding the problem.


Pseudocode:
IF Both Oculus Rift HMD and Xbox controller are connected
THEN start the application
ELSE
THEN show message and Exit the application


Thank you,
Makiko

Jeff
07-17-2014, 04:27 PM
The joystick.py (http://docs.worldviz.com/vizard5/#examples/Joystick.htm) example script exits if a DirectInput device is not connected:

If both the display and sensor cables of the Oculus are not connected getSensor will return None:

import oculus
hmd = oculus.Rift()
if hmd.getSensor() is None:
print 'Rift not connected'