Skip to content

Commit

Permalink
feat(SDK): utilise underlying sdk to retrieve headset type
Browse files Browse the repository at this point in the history
Previously, the `VRTK_DeviceFinder.GetHeadsetType()` would rely on the
built in Unity methods for determining the headset type, however this
was unsustainable as it didn't report generic enough information and
would mean the list of headset types would grow and grow and ultimately
not provide useful information.

This has now been changed by each SDK now has a `GetHeadsetType` method
that reports a simpler to understand headset type string, so in the
case of the vive, it does not report all of the variants, just reports
"htcvive" and similarly with the rift.

This string is then used to return a new, cleaner enum from the
`VRTK_DeviceFinder.GetHeadsetType()` method and the enum is stored
in the SDK_BaseHeadset class as it's more appropriate.

The usage of `GetHeadsetType` to determine which controller is
connected in the SDK_SteamVRController class has been removed and
now the render model of the connected controller is used to determine
the controller type as this will always be accurate from what OpenVR
is reporting.

When using the Unity SDK, the headset is still retrieved in the old
way as Unity doesn't provide enough decent information about the
connected headset to know which device is actually connected. It
does this by scraping the model and device name.
  • Loading branch information
thestonefox committed Nov 20, 2017
1 parent e106b1c commit 8f61ffb
Show file tree
Hide file tree
Showing 15 changed files with 512 additions and 231 deletions.
153 changes: 127 additions & 26 deletions Assets/VRTK/Documentation/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -8445,6 +8445,14 @@ The Device Finder offers a collection of static methods that can be called to fi
* `Headset` - The headset.
* `LeftController` - The left hand controller.
* `RightController` - The right hand controller.
* `public enum Headsets` - Possible headsets
* `Unknown` - An unknown headset.
* `OculusRift` - A summary of all Oculus Rift headset versions.
* `OculusRiftCV1` - A specific version of the Oculus Rift headset, the Consumer Version 1.
* `Vive` - A summary of all HTC Vive headset versions.
* `ViveMV` - A specific version of the HTC Vive headset, the first consumer version.
* `ViveDVT` - A specific version of the HTC Vive headset, the first consumer version.
* `OculusRiftES07` - A specific version of the Oculus Rift headset, the rare ES07.

### Class Methods

Expand Down Expand Up @@ -8736,27 +8744,27 @@ The HeadsetTransform method is used to retrieve the transform for the VR Headset

The HeadsetCamera method is used to retrieve the transform for the VR Camera in the scene.

#### ResetHeadsetTypeCache/0
#### GetHeadsetTypeAsString/0

> `public static void ResetHeadsetTypeCache()`
> `public static string GetHeadsetTypeAsString()`

* Parameters
* _none_
* Returns
* _none_
* `string` - The string of the headset connected.

The ResetHeadsetTypeCache resets the cache holding the current headset type value.
The GetHeadsetTypeAsString method returns a string representing the type of headset connected.

#### GetHeadsetType/1
#### GetHeadsetType/0

> `public static SDK_BaseHeadset.Headsets GetHeadsetType(bool summary = false)`
> `public static SDK_BaseHeadset.HeadsetType GetHeadsetType()`

* Parameters
* `bool summary` - If this is `true`, then the generic name for the headset is returned not including the version type (e.g. OculusRift will be returned for DK2 and CV1).
* _none_
* Returns
* `SDK_BaseHeadset.Headsets` - The Headset type that is connected.
* `SDK_BaseHeadset.HeadsetType` - The Headset type that is connected.

The GetHeadsetType method returns the type of headset connected to the computer.
The GetHeadsetType method returns the type of headset currently connected.

#### PlayAreaTransform/0

Expand Down Expand Up @@ -9908,23 +9916,17 @@ This is an abstract class to implement the interface required by all implemented

### Class Variables

* `public enum Headsets` - SDK Headset types.
* `Unknown` - An unknown headset.
* `OculusRift` - A summary of all Oculus Rift headset versions.
* `OculusRiftCV1` - A specific version of the Oculus Rift headset, the Consumer Version 1.
* `Vive` - A summary of all HTC Vive headset versions.
* `ViveMV` - A specific version of the HTC Vive headset, the first consumer version.
* `ViveDVT` - A specific version of the HTC Vive headset, the first consumer version.
* `OculusRiftES07` - A specific version of the Oculus Rift headset, the rare ES07.
* `GearVR` - A summary of all GearVR headset versions.
* `GearVRGalaxyNote5` - A specific version of the GearVR headset running on a Samsung Galaxy Note 5.
* `GearVRGalaxyS6` - A specific version of the GearVR headset running on a Samsung Galaxy S6.
* `GearVRGalaxyS6Edge` - A specific version of the GearVR headset running on a Samsung Galaxy S6 Edge.
* `GearVRGalaxyS7` - A specific version of the GearVR headset running on a Samsung Galaxy S7.
* `GearVRGalaxyS7Edge` - A specific version of the GearVR headset running on a Samsung Galaxy S7 Edge.
* `GearVRGalaxyS8` - A specific version of the GearVR headset running on a Samsung Galaxy S8.
* `GoogleCardboard` - A summary of all Google Cardboard headset versions.
* `Daydream` - A summary of all Google Daydream headset versions.
* `public enum HeadsetType` - The connected headset type
* `Undefined` - The headset connected is unknown.
* `Simulator` - The headset associated with the simulator.
* `HTCVive` - The HTC Vive headset.
* `OculusRiftDK1` - The Oculus Rift DK1 headset.
* `OculusRiftDK2` - The Oculus Rift DK2 headset.
* `OculusRift` - The Oculus Rift headset.
* `OculusGearVR` - The Oculus GearVR headset.
* `GoogleDaydream` - The Google Daydream headset.
* `GoogleCardboard` - The Google Cardboard headset.
* `HyperealVR` - The HyperealVR headset.

### Class Methods

Expand Down Expand Up @@ -9972,6 +9974,17 @@ The GetHeadset method returns the Transform of the object that is used to repres

The GetHeadsetCamera method returns the Transform of the object that is used to hold the headset camera in the scene.

#### GetHeadsetType/0

> `public abstract string GetHeadsetType();`

* Parameters
* _none_
* Returns
* `string` - The string of the headset connected.

The GetHeadsetType method returns a string representing the type of headset connected.

#### GetHeadsetVelocity/0

> `public abstract Vector3 GetHeadsetVelocity();`
Expand Down Expand Up @@ -10644,6 +10657,17 @@ The GetHeadset method returns the Transform of the object that is used to repres

The GetHeadsetCamera method returns the Transform of the object that is used to hold the headset camera in the scene.

#### GetHeadsetType/0

> `public override string GetHeadsetType()`

* Parameters
* _none_
* Returns
* `string` - The string of the headset connected.

The GetHeadsetType method returns a string representing the type of headset connected.

#### GetHeadsetVelocity/0

> `public override Vector3 GetHeadsetVelocity()`
Expand Down Expand Up @@ -11252,6 +11276,17 @@ The GetHeadset method returns the Transform of the object that is used to repres

The GetHeadsetCamera method returns the Transform of the object that is used to hold the headset camera in the scene.

#### GetHeadsetType/0

> `public override string GetHeadsetType()`

* Parameters
* _none_
* Returns
* `string` - The string of the headset connected.

The GetHeadsetType method returns a string representing the type of headset connected.

#### GetHeadsetVelocity/0

> `public override Vector3 GetHeadsetVelocity()`
Expand Down Expand Up @@ -11883,6 +11918,17 @@ The GetHeadset method returns the Transform of the object that is used to repres

The GetHeadsetCamera/0 method returns the Transform of the object that is used to hold the headset camera in the scene.

#### GetHeadsetType/0

> `public override string GetHeadsetType()`

* Parameters
* _none_
* Returns
* `string` - The string of the headset connected.

The GetHeadsetType method returns a string representing the type of headset connected.

#### GetHeadsetVelocity/0

> `public override Vector3 GetHeadsetVelocity()`
Expand Down Expand Up @@ -12496,6 +12542,17 @@ The GetHeadset method returns the Transform of the object that is used to repres

The GetHeadsetCamera method returns the Transform of the object that is used to hold the headset camera in the scene.

#### GetHeadsetType/0

> `public override string GetHeadsetType()`

* Parameters
* _none_
* Returns
* `string` - The string of the headset connected.

The GetHeadsetType method returns a string representing the type of headset connected.

#### GetHeadsetVelocity/0

> `public override Vector3 GetHeadsetVelocity()`
Expand Down Expand Up @@ -13119,6 +13176,17 @@ The GetHeadset method returns the Transform of the object that is used to repres

The GetHeadsetCamera method returns the Transform of the object that is used to hold the headset camera in the scene.

#### GetHeadsetType/0

> `public override string GetHeadsetType()`

* Parameters
* _none_
* Returns
* `string` - The string of the headset connected.

The GetHeadsetType method returns a string representing the type of headset connected.

#### GetHeadsetVelocity/0

> `public override Vector3 GetHeadsetVelocity()`
Expand Down Expand Up @@ -13752,6 +13820,17 @@ The GetHeadset method returns the Transform of the object that is used to repres

The GetHeadsetCamera/0 method returns the Transform of the object that is used to hold the headset camera in the scene.

#### GetHeadsetType/0

> `public override string GetHeadsetType()`

* Parameters
* _none_
* Returns
* `string` - The string of the headset connected.

The GetHeadsetType method returns a string representing the type of headset connected.

#### GetHeadsetVelocity/0

> `public override Vector3 GetHeadsetVelocity()`
Expand Down Expand Up @@ -14341,6 +14420,17 @@ The ProcessUpdate method enables an SDK to run logic for every Unity Update

The ProcessFixedUpdate method enables an SDK to run logic for every Unity FixedUpdate

#### GetHeadsetType/0

> `public override string GetHeadsetType()`

* Parameters
* _none_
* Returns
* `string` - The string of the headset connected.

The GetHeadsetType method returns a string representing the type of headset connected.

#### GetHeadsetVelocity/0

> `public override Vector3 GetHeadsetVelocity()`
Expand Down Expand Up @@ -14974,6 +15064,17 @@ The GetHeadset method returns the Transform of the object that is used to repres

The GetHeadsetCamera method returns the Transform of the object that is used to hold the headset camera in the scene.

#### GetHeadsetType/0

> `public override string GetHeadsetType()`

* Parameters
* _none_
* Returns
* `string` - The string of the headset connected.

The GetHeadsetType method returns a string representing the type of headset connected.

#### GetHeadsetVelocity/0

> `public override Vector3 GetHeadsetVelocity()`
Expand Down
Loading

0 comments on commit 8f61ffb

Please sign in to comment.