vrDeviceService¶
-
class
vrDeviceService
¶
(Inherits vrBaseService
)
This service allows the management of VR devices and interactions that are triggered by those devices. It gives access to interaction as well as device objects and also allows their creation.
Summary¶
- Functions:
- activateInteraction(interaction)
- addBlockedDeviceModelOrSerial(modelOrSerial)
- createInteraction(name) → vrdDeviceInteraction
- createVRDevice(name) → vrdVRDevice
- deactivateInteraction(interaction)
- deleteVRDevice(device)
- getActiveInteractionGroup() → string
- getBlockedDeviceModelsOrSerials() → List[string]
- getConnectedVRDevices() → List[vrdVRDevice]
- getInteraction(name) → vrdDeviceInteraction
- getInteractions() → List[vrdDeviceInteraction]
- getLeftTrackedHand() → vrdTrackedHand
- getRightTrackedHand() → vrdTrackedHand
- getTrackingOrigin() → QVector3D
- getVRDevice(name) → vrdVRDevice
- getVRDeviceBySerialNumber(serialNumber) → vrdVRDevice
- isBlockedDeviceModelOrSerial(modelOrSerial) → bool
- removeBlockedDeviceModelOrSerial(modelOrSerial)
- removeInteraction(interaction)
- setActiveInteractionGroup(interactionGroup)
- setBlockedDeviceModelsOrSerials(modelsOrSerials)
- setTrackingOrigin(position)
- Signals:
Functions¶
-
vrDeviceService.
activateInteraction
(interaction)¶ Activates an interaction. This allows an interaction to resume receiving input signals, if the interaction is in the active interaction group.
Parameters: interaction (string) – The name of the interaction. If it is not known, nothing will happen.
-
vrDeviceService.
addBlockedDeviceModelOrSerial
(modelOrSerial)¶ Adds an input device model or serial name to the blocked devices list.
Note: This is not available in OpenXR mode due to API limitations.
Parameters: modelOrSerial (string) – The model or serial name
-
vrDeviceService.
createInteraction
(name)¶ Creates a new device interaction and makes it available for mapping inputs to its actions.
Note: It is required to create the interaction before the OpenXR session is started, if OpenXR mode is used.
Parameters: name (string) – The name of the new interaction. If an interaction with this name already exists, the new interaction will overwrite the old one. Returns: The new device interaction. Return type: vrdDeviceInteraction
-
vrDeviceService.
createVRDevice
(name)¶ Creates a virtual device. This can be used to integrate custom hand tracking wtih python.
Parameters: name (string) – The name of the VR device e.g. left-controller, right-controller or tracker-1 Returns: Return type: vrdVRDevice
-
vrDeviceService.
deactivateInteraction
(interaction)¶ Deactivates an interaction. The interaction will not receive input signals anymore.
Parameters: interaction (string) – The name of the interaction. If it is not known, nothing will happen.
-
vrDeviceService.
deleteVRDevice
(device)¶ Removes a virtual device.
Parameters: device (vrdVRDevice) – The device to be removed
-
vrDeviceService.
getActiveInteractionGroup
()¶ Gets the currently active interaction group.
Returns: The name of the currently active interaction group. Return type: string
-
vrDeviceService.
getBlockedDeviceModelsOrSerials
()¶ Note: This is not available in OpenXR mode due to API limitations.
Returns: A list of blocked input device model or serial names Return type: List[string]
-
vrDeviceService.
getConnectedVRDevices
()¶ Gets the connected VR devices like controllers or trackers.
Returns: List of connected devices Return type: List[vrdVRDevice]
-
vrDeviceService.
getInteraction
(name)¶ Gets an interactions that is already known to the service.
Parameters: name (string) – The name of the interaction. Returns: The interaction object, if the name is known to the service, otherwise an invalid interaction object. Return type: vrdDeviceInteraction
-
vrDeviceService.
getInteractions
()¶ Gets all interactions that are known to the service.
Returns: A list of interactions that are available for mapping inputs to their actions. Return type: List[vrdDeviceInteraction]
-
vrDeviceService.
getLeftTrackedHand
()¶ Get the left hand from hand tracker.
Note: This is currently not available in OpenXR mode.
Returns: The left hand Return type: vrdTrackedHand
-
vrDeviceService.
getRightTrackedHand
()¶ Get the right hand from hand tracker.
Note: This is currently not available in OpenXR mode.
Returns: The right hand Return type: vrdTrackedHand
-
vrDeviceService.
getTrackingOrigin
()¶ Returns the tracking reference origin. Default is (0, 0, 0). Can be changed with setTrackingOrigin.
Note: This is currently not available in OpenXR mode.
Returns: the tracking reference origin Return type: QVector3D
-
vrDeviceService.
getVRDevice
(name)¶ Gets an VR device, which can be a controllers or a trackers by its name.
Note: Please also read the note in the class description of vrdVRDevice about device node comparison.
Parameters: name (string) – The name of the VR device e.g. left-controller, right-controller or tracker-0, tracker 1, … Returns: The VR device object or an invalid VR device object if the name does not follow the allowed pattern. Return type: vrdVRDevice
-
vrDeviceService.
getVRDeviceBySerialNumber
(serialNumber)¶ Gets an VR device, which can be a controllers or a trackers by its serial number.
Note: Please also read the note in the class description of vrdVRDevice about device node comparison. In OpenXR mode this is currently only available for Vive trackers.
Parameters: serialNumber (string) – The serial number of the device. This might not be the serial number printed on a device. Some devices use an internal serial number. Returns: The VR device object. Return type: vrdVRDevice
-
vrDeviceService.
isBlockedDeviceModelOrSerial
(modelOrSerial)¶ Note: This is not available in OpenXR mode due to API limitations.
Parameters: modelOrSerial (string) – Returns: Returns True if the passed model or serial name is blocked, False otherwise Return type: bool
-
vrDeviceService.
removeBlockedDeviceModelOrSerial
(modelOrSerial)¶ Removes an input device model or serial name from the blocked devices list.
Note: This is not available in OpenXR mode due to API limitations.
Parameters: modelOrSerial (string) – The model or serial name
-
vrDeviceService.
removeInteraction
(interaction)¶ Removes an interaction from the input mapping.
Parameters: interaction (vrdDeviceInteraction) – The interaction that will be removed from the button mapping.
-
vrDeviceService.
setActiveInteractionGroup
(interactionGroup)¶ Activates a group of interactions which will from now on receive all the input signals. This will also deactivate all other interaction groups as only one interaction group can be active.
Parameters: interactionGroup (string) – The name of the interaction group
-
vrDeviceService.
setBlockedDeviceModelsOrSerials
(modelsOrSerials)¶ Sets a list of input device models or serial names which creation should be prevented.
Note: This is not available in OpenXR mode due to API limitations.
Parameters: modelsOrSerials (List[string]) – A list of model or serial names
-
vrDeviceService.
setTrackingOrigin
(position)¶ Sets the tracking reference origin for tracking. Use it to correct any offsets in the scene This function always assumes Y-Up, even if Z-up is set in the scene. If the tracking origin should be at pos = (x_scene, y_scene, z_scene) in the VRED scene, call setTrackingOrigin(QVector3D(-x_scene, -z_scene, y_scene))
Note: This is currently not available in OpenXR mode.
Parameters: position (QVector3D) – Position offset for the tracking.
Signals¶
-
vrDeviceService.
deviceActionTriggered
(action, device)¶ The signal that is send, when the corresponding device action is triggered.
Parameters: - action (vrdDeviceAction) – The action the signal belongs too and which is triggered.
- device (vrdVRDevice) – The device that triggered the action with an input.
-
vrDeviceService.
deviceCollisionStarted
(otherNode, device)¶ Signal is emitted when the collision sensor of a device touches a collision sensitive node.
Parameters: - otherNode (vrdNode) – The node with which the device collides
- device (vrdVRDevice) – The device that is colliding
-
vrDeviceService.
deviceCollisionStopped
(otherNode, device)¶ Signal is emitted when the collision sensor of a device stops touching a collision sensitive node.
Parameters: - otherNode (vrdNode) – The node with which the device stops colliding
- device (vrdVRDevice) – The device that stops colliding
-
vrDeviceService.
deviceMoved
(device)¶ Signal that is triggered, when a VR device moved.
Parameters: device (vrdVRDevice) – The device that triggered this signal.