Search Unity

Daydream GvrController.BatteryLevel always returns Unknown

Discussion in 'AR/VR (XR) Discussion' started by SiliconDroid, Apr 30, 2017.

  1. SiliconDroid

    SiliconDroid

    Joined:
    Feb 20, 2017
    Posts:
    302
    Hi,

    I'm making a custom daydream arm and controller rig.

    Using GVR SDK 1.40 (April).

    I've instantiated a GvrController ar runtime:

    Code (CSharp):
    1. GvrController cGvrController = this.gameObject.AddComponent<GvrController>();
    Per frame I am able to read good rotation pose by reading the static property:

    Code (CSharp):
    1. Quaternion qRotation = GvrController.Orientation
    I'm also able to read other things fine in a similar fashion, but when I read battery level using:

    Code (CSharp):
    1. GvrControllerBatteryLevel eLev = GvrController.BatteryLevel;
    I always get GvrControllerBatteryLevel.CriticalLow which is (int)enum == 1.
    I always get GvrControllerBatteryLevel.Unknown == 0.

    Viewing the controller in daydream home screen it's showing correct number of lights 1 ... 5.

    Is this a bug or is there some trick to reading battery level that I'm not aware of?
     
    Last edited: May 4, 2017
  2. mira_leung

    mira_leung

    Official Google Employee

    Joined:
    May 17, 2016
    Posts:
    70
    The battery level indicator in Unity is a wrapper around the C API that displays that level in Daydream Home. Has the level ever matched that in VrHome? Could you please try charging the controller for a few hours, to see if it goes back up to 5?
     
  3. SiliconDroid

    SiliconDroid

    Joined:
    Feb 20, 2017
    Posts:
    302
    I fully charged my controller. In daydream home I see 5 green lights.
    Can read every other property of GvrController OK.
    But reading GvrController.BatteryLevel I get GvrControllerBatteryLevel.Unknown == 0.
    I logged the raw returned enum on a running device.
    I posted above I got 1, I was mistaken as that was clamped in my display function, i get 0 all the time.
     
  4. SiliconDroid

    SiliconDroid

    Joined:
    Feb 20, 2017
    Posts:
    302
    Yesterday I installed "Daydream Elements" on my ZTE_Axon7:

    The battery indicator graphic on the controller also reads unknown, like this:

    ●●?●●

    Could others report if the "Daydream Elements" app shows the correct battery status.

    It looks like it could be a bug in the wrapper around the battery level indicator in Unity.
     
  5. reedny

    reedny

    Joined:
    Mar 4, 2017
    Posts:
    57
    I see the same results for GvrControllerBatteryLevel :
    a) in VrHome I see 2 lights (Low) but in my Unity app I get Unknown.
    b) I charged the controller overnight and see 5 lights (Full) in VrHome, but still get Unknown in my Unity app.
    c) The level never matches that in VrHome (Unity app is always Unknown).

    I'm using:
    Unity 5.6.1p3
    GVR Unity SDK 1.60
    Daydream Renderer 1.0
    Moto Z Force Droid, Android 7.0
     
    SiliconDroid likes this.
  6. SiliconDroid

    SiliconDroid

    Joined:
    Feb 20, 2017
    Posts:
    302
    I'm thinking it's a buglet in the unity wrapper.
     
  7. pozil

    pozil

    Joined:
    Apr 6, 2017
    Posts:
    2
    SiliconDroid likes this.
  8. dsternfeld

    dsternfeld

    Official Google Employee

    Joined:
    Jan 3, 2017
    Posts:
    72
    Thank you for reporting this issue!

    We are investigating it. In the meantime, you can disable the battery indicator.

    -Dan
     
    SiliconDroid likes this.
  9. dsternfeld

    dsternfeld

    Official Google Employee

    Joined:
    Jan 3, 2017
    Posts:
    72
    The battery indicator should work if you use Unity 5.6.2f1.

    Additionally, in the next release of the GVR SDK the battery indicator will be hidden if the battery state is unavailable instead of showing a question mark.

    Thanks,

    Dan
     
    SiliconDroid likes this.
  10. reedny

    reedny

    Joined:
    Mar 4, 2017
    Posts:
    57
    Verified, this is fixed in 5.6.2p1, thanks.
     
    SiliconDroid likes this.