New To The Forum? Click Here To Read The How To Guide. -- Developers Click Here.

Can't get the accelerometer to work on Oculus Go, but works fine on Gear VR?

GnimmelGnimmel Posts: 12
NerveGear

I have a game on the store called Jogger which uses the accelerometer to detect for when someone is jogging on the spot to move forward.
This has been on the store for over a year now and works great, however it's not working on the Oculus Go.

Is there a different way to access the gyro on the Oculus Go?
For the Gear VR I can use "Input.gyro.userAcceleration" but this just returns 0 0 0 on the Go?

Any help would be greatly appreciated at this point because I've had to remove Jogger from the Go store until I can find out why it's not working.

Comments

  • imperativityimperativity Posts: 3,465 Oculus Staff
    Hi,

    I am checking with the internal team responsible for the Oculus GO's functionality and will update you by next week with guidance on whether or not we expose the acceleromter as we do in Gear VR.
    Please tag me @imperativity in your forum post/response if you need immediate assistance or want additional support or context on an issue you are having with our software or integrations.

    Having an issue with our platform, services, or integrations?

    Try using our new bug tool to report this and receive emailed updates as we proceed to address it internally.
  • stregillusstregillus Posts: 10
    NerveGear
    I also need this functionality.  Without access to the gyro/accelerometer, we can't do anything interesting with head gestures, interesting input methods (like walking-in-place), etc.  I was hoping to port my Daydream/Cardboard game to the Go, which uses walking-in-place input, but if there's no way to access this I guess my interest in developing for the Go has dropped significantly.

    I've also tried using OVRDisplay.acceleration, but that also doesn't seem to give any values.
  • GnimmelGnimmel Posts: 12
    NerveGear
    Thanks for the update, I look forward to hearing what you can find out about this problem.
  • imperativityimperativity Posts: 3,465 Oculus Staff
    @Gnimmel

    Here is some internal feedback on this:

    "Yep, Input.gyro.userAcceleration is the Unity API to query the android sensor data. Just confirmed that is not functional on Go"

    Looks like we will be making this functional in the neat future. No ETA yet, but we are working on it.

    Some more additional feedback and context on this issue:

    "there are two APIs for getting sensor data on GearVR. There is the Android/phone sensor API which provides data from the phone's onboard sensors and a completely separate VrAPI for the sensors on the headset. On Oculus Go, we only implement the VrAPI portion.

    is it possible that your developer is referring to the phone sensor API (https://developer.android.com/.../hardware/SensorManager)? If they are then, please ask them to take a look at the VrAPI tracking interface, it contains the accelerometer output and must be polled."
    Please tag me @imperativity in your forum post/response if you need immediate assistance or want additional support or context on an issue you are having with our software or integrations.

    Having an issue with our platform, services, or integrations?

    Try using our new bug tool to report this and receive emailed updates as we proceed to address it internally.
  • stregillusstregillus Posts: 10
    NerveGear
    Hi @imperativity

    Thanks for the response.  Just out of curiosity, does that mean that on GearVR, Input.gyro returns the phone's sensor data, not the GearVR headset's?  I always suspected that that was the case, but it was a bit hard to verify.

    I'm guessing that getting the sensor data using the linked VrApi would required a custom/modified Android activity to pass that data into Unity, correct?  Or is there a way to do this another way?
  • imperativityimperativity Posts: 3,465 Oculus Staff
    @stregillus

    I'll relay this internally and get back to you on these queries.
    Please tag me @imperativity in your forum post/response if you need immediate assistance or want additional support or context on an issue you are having with our software or integrations.

    Having an issue with our platform, services, or integrations?

    Try using our new bug tool to report this and receive emailed updates as we proceed to address it internally.
  • GnimmelGnimmel Posts: 12
    NerveGear

    @imperativity Thanks for the update.

    I was trying to find information on the VR API and couldn't find anything for Unity. Do you know of any, or is this something that will need a plug-in as @stregillus asked?


  • carrotstiencarrotstien Posts: 5
    NerveGear
    edited May 31
    Hello, we want to do something in our app that requires us to be able to access the imu data per frame, or faster if possible. 

    Even if the limit is just getting it once per frame through the sdk, we expect to be able to get

    for gearVR: HEAD:[2 accelerations, 1 from phone, and 1 from gearvr], Controller [1 acceleration]

    for Oculus Go, same as above, but only 1 acceleration from the head. 

    Please let us know when /if this can be done. If it can't be done, that's a big wrench in our plans. 

    @imperativity

  • sara.hanson.12382sara.hanson.12382 Posts: 5
    NerveGear
    edited June 1
    Hey y'all,

    I managed to get a reading with adb logcat on the angular acceleration by instantiating an OVRDisplay:
    OVRDisplay display = new OVRDisplay();
    float temp = display.angularAcceleration.y;
    Debug.Log(temp); 

    For acceleration just change temp, like so:
    float temp = display.acceleration.y;

    Otherwise, my question is about the angular acceleration/acceleration scale, and I thought everyone here may find the question useful as well: what are the units for these readings? @imperativity  

    Best of luck.
  • stregillusstregillus Posts: 10
    NerveGear
    @sara.hanson.12382 I guess Angular Acceleration likely works fine if that's all you care about.  However, I doubt it would work great with walking in place, since most people don't do a ton of head rotation when they walk.  I was more interested in just normal acceleration, and unfortunately display.Acceleration just returns 0 all the time.
  • carrotstiencarrotstien Posts: 5
    NerveGear
    There is something like this, but I'd reeeally prefer if Oculus SDK just made it available. 

    https://hackernoon.com/how-i-hacked-google-daydream-controller-c4619ef318e4
  • sara.hanson.12382sara.hanson.12382 Posts: 5
    NerveGear
    edited June 1
    @stregillus I can get readings for acceleration in that same way as well. I just changed angularAcceleration to acceleration and it worked.
  • carrotstiencarrotstien Posts: 5
    NerveGear
    edited June 1
    @sara.hanson.12382, is this on GearVR or GO? Can you post a snippet of that code?

    and any luck getting acceleration for the controller?
  • stregillusstregillus Posts: 10
    NerveGear
    @stregillus I can get readings for acceleration in that same way as well. I just changed angularAcceleration to acceleration and it worked.
    Hmm, this is on the Go for sure?  I've tried 3 different OVRDisplays:

    Instantiated during Start:
    OVRDisplay _ovrDisplay;
    Start(){
       _ovrDisplay = new OVRDisplay();
    }
    
    Update(){
       Debug.Log(_ovrDisplay.acceleration);
    }
    Instantiated every frame
    Update(){
       OVRDisplay ovrDisplay = new OVRDisplay();
       Debug.Log(ovrDisplay.acceleration);
    }
    Retrieved using OVRManager.display
    Update(){
       Debug.Log(OVRManager.display.acceleration);
    }
    All of these return vectors that are all 0s.  

    @sara.hanson.12382 the only thing I can think of is you're not using a Go (maybe you're using a GearVR or a full Oculus headset), or you have a different firmware or OS version from me that's leading to the different behavior.

    Could you maybe  let me know:
    • Your version of Unity
    • Your OS version on the Go
    • Whether it is a devkit Go or a commercial one
    Thanks!  
    -Sam


  • stregillusstregillus Posts: 10
    NerveGear
    I've made a pretty big breakthrough!  I was looking at the code that is actually returned by OVRDisplay.acceleration, and it looked like this:
    public Vector3 acceleration
    	{
    		get {
    			if (!OVRManager.isHmdPresent) {
    				return Vector3.zero;
    			}
    
    			return OVRPlugin.GetNodeAcceleration(OVRPlugin.Node.None, OVRPlugin.Step.Render).FromFlippedZVector3f();
    		}
    	}
    Note the "Node.None" there!  I changed it to Node.Head, so now it looks like this:
    public Vector3 acceleration
    	{
    		get {
    			if (!OVRManager.isHmdPresent) {
    				return Vector3.zero;
    			}
    
    			return OVRPlugin.GetNodeAcceleration(OVRPlugin.Node.Head, OVRPlugin.Step.Render).FromFlippedZVector3f();
    		}
    	}
    Now I'm getting the values I want!  It looks like these units are in Meters/Second squared.  In my case, my code was originally programmed to assume Gs, so I just divided that number by 9.8, and I'm getting the values that I seem to want.

    @Gnimmel, I'm fairly certain that you're using my VR-Step plugin (I am the dev of that), feel free to PM me on here, and I can help you adapt the code for the Go.  The values are still a bit higher than they were on GoogleVR, even after dividing by 9.8, so some other things need to be tweaked.  I'll also probably update the plugin now that I know what's going on.
  • carrotstiencarrotstien Posts: 5
    NerveGear
    @stregillus nice!

    Are you able to similarly get acceleration values for the GO controller?
  • stregillusstregillus Posts: 10
    NerveGear
    @carrotstien The Go controller has never really been an issue, you can access that information easily with OVRInput.GetLocalControllerAcceleration.  Look at the OVRGearVrControllerTest.cs that comes with the Unity plugin for everything to do wtih the controllers.
  • sara.hanson.12382sara.hanson.12382 Posts: 5
    NerveGear
    edited June 2
    @carrotstien
    @stregillus
    I don't have the tech with me right now, so I can't give you specifics but its definitely the Go. And I when I posted my follow-up I also edited my original comment to include the code for acceleration. Hope you figured it out.
  • stregillusstregillus Posts: 10
    NerveGear
    Hi @sara.hanson.12382 , I wonder if maybe you're using a different version of the Oculus Unity plugin?  Can you look at the code for the acceleration parameter in OVRDisplay.cs and let me know what it looks like?  

    Doesn't really matter now, but thank you for letting me know that it was working for you, which prompted me to dig in a lot further and fix it myself.  
  • arjenveenhuizenarjenveenhuizen Posts: 1
    NerveGear
    Fyi, the patch proposed by @stregillus has found its way upstream in Oculus Utilities 1.26:

    > Fixed bug causing head velocity and acceleration to always be 0.

    Release notes: https://developer.oculus.com/documentation/unity/latest/concepts/release-1.26/
    Download Oculus Utilties 1.26: https://developer.oculus.com/downloads/package/oculus-utilities-for-unity-5/1.26.0/
  • GnimmelGnimmel Posts: 12
    NerveGear
    I was out of the studio all last week so sorry for the late reply.

    @stregillus Yes, the game I'm having problems with is Jogger, which is on your asset store page as an example for VR Step.

    Thanks for looking into this, I have a few things to catch up on today and then I will be looking at this again and hopefully have a Go version of Jogger working soon.

  • stregillusstregillus Posts: 10
    NerveGear
    A few things to note:
    • Using OVRDisplay.acceleration (with the fix to replace Node.none to Node.head) works on the Go, but doesn't seem to work with a GearVR + Galaxy S7.  I have to use Input.gyro with the S7, which I guess means that I am not getting the "better" gyro sensor inputs from the GearVR.  This is OK, but just a bit annoying to have to detect.
    • I had originally thought that the units were Meters/sec squared, but they seem a bit higher, and I actually think that they might be in Feet/sec squared?  @imperativity can you confirm with the devs what the units are for the OVRDisplay.acceleration reading?  
    Thanks!
  • imperativityimperativity Posts: 3,465 Oculus Staff
    @stregillus

    I have confirmed that these readings are measured in in meters per second.

    More context:

    "They are the acceleration and angular acceleration reported by sensor fusion.
    There's some filtering there, but it basically comes from the IMU (gyroscope and accelerometer).
    They're in the same space as the head pose."
    Please tag me @imperativity in your forum post/response if you need immediate assistance or want additional support or context on an issue you are having with our software or integrations.

    Having an issue with our platform, services, or integrations?

    Try using our new bug tool to report this and receive emailed updates as we proceed to address it internally.
  • GnimmelGnimmel Posts: 12
    NerveGear
    Thanks again for all the help on this.

    I haven't had the chance to get Jogger fully working yet, but I have got a small test project getting acceleration values now :)
     
  • imperativityimperativity Posts: 3,465 Oculus Staff
    @Gnimmel

    No problem! Anything I can do to help the transition to GO be as smooth as possible.
    Please tag me @imperativity in your forum post/response if you need immediate assistance or want additional support or context on an issue you are having with our software or integrations.

    Having an issue with our platform, services, or integrations?

    Try using our new bug tool to report this and receive emailed updates as we proceed to address it internally.
  • IlyaVoitsekhIlyaVoitsekh Posts: 1
    NerveGear
    Fyi, the patch proposed by @stregillus has found its way upstream in Oculus Utilities 1.26:

    > Fixed bug causing head velocity and acceleration to always be 0.

    Release notes: https://developer.oculus.com/documentation/unity/latest/concepts/release-1.26/
    Download Oculus Utilties 1.26: https://developer.oculus.com/downloads/package/oculus-utilities-for-unity-5/1.26.0/
    But it's only about head acceleration. No controller?(
  • root_da_wootroot_da_woot Posts: 4
    NerveGear
    Sorry for offtopic
    Spend some amount of time getting WebVR or polyfilled WebVR  work on GO
    Really missing accelerometer data on go.

    I have app with WebView showing polyfilled VR. Works fine on GearVR or random Android phone. On Go WebView or Crosswalk chrome build got no accelerometer data so no tracking at all







Sign In or Register to comment.