OSVR / OSVR-Oculus-Rift

Oculus Rift tracking plugin for OSVR.
Apache License 2.0
40 stars 13 forks source link

Needs to supply a device descriptor JSON #3

Closed rpavlik closed 9 years ago

rpavlik commented 9 years ago

This plugin will not presently work with 0.2 because it does not include a device descriptor JSON file. An update to the osvrVRPNServer library makes it straightforward to send the device descriptor for this kind of device: more ore less just adding this line: https://github.com/OSVR/OSVR-Core/blob/master/plugins/multiserver/com_osvr_Multiserver.cpp#L175

DuFF14 commented 9 years ago

I had incorrectly modified this file, but it has been reverted. Is this the device descriptor we need, or does it need to be updated for v0.2? https://github.com/OSVR/OSVR-Oculus-Rift/blob/master/com_osvr_OculusRift.json

rpavlik commented 9 years ago

No, that is the display descriptor, not the device descriptor. Device descriptor does things like say what interfaces there are and what they mean

rpavlik commented 9 years ago

I think I fixed this with https://github.com/OSVR/OSVR-Oculus-Rift/commit/6c0b3d2dd3c6df47ad977bb7aff809fc16c44708 and improved after - can someone test this? Would want to see a osvr_print_tree printout after using the included config file - we should get a nice full semantic tree and an automatic alias for /me/head

DuFF14 commented 9 years ago

After adding a line at the bottom of osvr_server_config.json: "display": "displays/Oculus_Rift_DK2.json"

And adding that json file to the displays folder, I am able to print the path tree:

[OSVR] Connecting to default (local) host
[OSVR] Client context initialized for com.osvr.tools.printtree
[OSVR] Got connection to main OSVR server
[OSVR] Got updated path tree, processing
[OSVR] Connected 0 of 0 unconnected paths successfully
[OSVR] Connection process took 47ms: have connection to server, have path tree
[OSVR] Client context shut down for com.osvr.tools.printtree

[   StringElement] /display
                     - Contained value: {
                        "hmd" : {
                           "device" : {
                              "Note" : "",
                              "Version" : "DK2",
                              "model" : "Rift",
                              "num_displays" : 1,
                              "vendor" : "Oculus"
                           },
                           "distortion" : {
                              "k1Blue" : 1.4860100000000001,
                              "k1Green" : 1.248,
                              "k1Red" : 1.01999
                           },
                           "eyes" : [
                              {
                                 "centerProjX" : 0.5,
                                 "centerProjY" : 0.5
                              }
                           ],
                           "field_of_view" : {
                              "monocularHorizontal" : 93.279799999999994,
                              "monocularVertical" : 106.092,
                              "overlapPercent" : 100,
                              "pitchTilt" : 0
                           },
                           "rendering" : {
                              "leftRoll" : 0,
                              "rightRoll" : 0
                           },
                           "resolutions" : [
                              {
                                 "displayMode" : "horzSideBySide",
                                 "height" : 1080,
                                 "videoInputs" : 1,
                                 "width" : 1920
                              }
                           ]
                        }
                     }

[   DeviceElement] /com_osvr_OculusRift/OculusRift0
                     - corresponds to com_osvr_OculusRift/OculusRift0@localhost
[InterfaceElement] /com_osvr_OculusRift/OculusRift0/analog
[   SensorElement] /com_osvr_OculusRift/OculusRift0/analog/0
[   SensorElement] /com_osvr_OculusRift/OculusRift0/analog/1
[   SensorElement] /com_osvr_OculusRift/OculusRift0/analog/2
[   SensorElement] /com_osvr_OculusRift/OculusRift0/analog/3
[   SensorElement] /com_osvr_OculusRift/OculusRift0/analog/4
[   SensorElement] /com_osvr_OculusRift/OculusRift0/analog/5
[   SensorElement] /com_osvr_OculusRift/OculusRift0/analog/6
[   SensorElement] /com_osvr_OculusRift/OculusRift0/analog/7
[   SensorElement] /com_osvr_OculusRift/OculusRift0/analog/8
[   SensorElement] /com_osvr_OculusRift/OculusRift0/analog/9
[InterfaceElement] /com_osvr_OculusRift/OculusRift0/tracker
[   SensorElement] /com_osvr_OculusRift/OculusRift0/tracker/1
[   SensorElement] /com_osvr_OculusRift/OculusRift0/tracker/0
[   SensorElement] /com_osvr_OculusRift/OculusRift0/tracker/2
[    AliasElement] /com_osvr_OculusRift/OculusRift0/semantic/camera
                     -> /com_osvr_OculusRift/OculusRift0/tracker/1
[    AliasElement] /com_osvr_OculusRift/OculusRift0/semantic/hmd
                     -> /com_osvr_OculusRift/OculusRift0/tracker/0
[    AliasElement] /com_osvr_OculusRift/OculusRift0/semantic/hmd/accelerometer/x

                     -> /com_osvr_OculusRift/OculusRift0/analog/0
[    AliasElement] /com_osvr_OculusRift/OculusRift0/semantic/hmd/accelerometer/y

                     -> /com_osvr_OculusRift/OculusRift0/analog/1
[    AliasElement] /com_osvr_OculusRift/OculusRift0/semantic/hmd/accelerometer/z

                     -> /com_osvr_OculusRift/OculusRift0/analog/2
[    AliasElement] /com_osvr_OculusRift/OculusRift0/semantic/hmd/gyroscope/x
                     -> /com_osvr_OculusRift/OculusRift0/analog/3
[    AliasElement] /com_osvr_OculusRift/OculusRift0/semantic/hmd/gyroscope/y
                     -> /com_osvr_OculusRift/OculusRift0/analog/4
[    AliasElement] /com_osvr_OculusRift/OculusRift0/semantic/hmd/gyroscope/z
                     -> /com_osvr_OculusRift/OculusRift0/analog/5
[    AliasElement] /com_osvr_OculusRift/OculusRift0/semantic/hmd/magnetometer/x
                     -> /com_osvr_OculusRift/OculusRift0/analog/6
[    AliasElement] /com_osvr_OculusRift/OculusRift0/semantic/hmd/magnetometer/y
                     -> /com_osvr_OculusRift/OculusRift0/analog/7
[    AliasElement] /com_osvr_OculusRift/OculusRift0/semantic/hmd/magnetometer/z
                     -> /com_osvr_OculusRift/OculusRift0/analog/8
[    AliasElement] /com_osvr_OculusRift/OculusRift0/semantic/hmd/temperature
                     -> /com_osvr_OculusRift/OculusRift0/analog/9
[    AliasElement] /com_osvr_OculusRift/OculusRift0/semantic/leveled_camera
                     -> /com_osvr_OculusRift/OculusRift0/tracker/2
[    AliasElement] /me/head
                     -> /com_osvr_OculusRift/OculusRift0/semantic/hmd
DuFF14 commented 9 years ago

Tracking works in TrackerView and Unity, but getting an empty string in Unity from: ClientKit.instance.context.getStringParameter("/display");

rpavlik commented 9 years ago

OK, so the plugin looks like it's working.

Did you put that display descriptor in here? I can add it to the build so that it gets copied over.

The path tree view clearly shows that there is data at /display so if I had to guess, you're using a pre-0.2 set of dlls with the unity plugin.

DuFF14 commented 9 years ago

The DK1 and DK2 display descriptors are in the pull request here: https://github.com/OSVR/OSVR-Core/tree/DisplayConfigs/apps/displays

I thought outdated dlls might be the case. Deleted the plugins folder from the Unity project and imported the latest package, but still nothing from /display. Maybe it's being stubborn and I need to essentially clear the cache. Will give that another attempt.

rpavlik commented 9 years ago

this is why we need version metadata in the DLLs...

DuFF14 commented 9 years ago

So I deleted the Library, Temp, and Plugins folders, opened the project and imported the Plugins folder from the OSVR-Unity unitypackage. The first time I run the Unity scene, the correct output is reported from /display. All subsequent tries returns an empty string from /display. Repeated this a few times and get the same results. Any ideas?

rpavlik commented 9 years ago

OK, so two things:

a: that's really weird b: that is an OSVR-Unity issue, so I'd say file an issue over there for it.