Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by Thugann · Mar 03, 2016 at 02:12 PM · androidaugmented realitymobile devicesgyroscope

[Gyro] unexpected rotations and offset

Hi,
I recently started a project in Unity 5.0.1 with AR glasses running on Android. I'm facing issues with the built-in gyro.
link:Code of the headtracking class from SDK

Basically, when I start my app everything is fine until Update gets called. From this point, the first "actual" orientation is given by gyro.attitude and it's never a Quat(0,0,0,0) at the beginning. It is always an accurate rotation around x and z axis, and a random rotation around y.
As I said, it happens once Update is called, everything is fine with Start(). If the first angle around y was always the same I would be able to negate it, but I cannot predict it.

Also, I can't add an offset because in Start() gyro.attitude will always returns Quat(0,0,0,0). It's like the gyro is not reading its orientation yet even though gyro.enabled have been set true, thus I cannot set an initial attitude.

Moreover, the gyro rotates around y with a random angle betwen 1° & 180° after one of the following condition is (randomly) met:
- App have started for about 2 or 3 seconds
- Gyro rotated 45° or more
- Angle between attitudes of previous and current frames is high enough

This happens only once, but it shouldn't and I can't figure out why it is doing so, nor how to prevent it.

Can somebody enlighten me on what's wrong and what I should do please? I have tried many fixes, none of them worked, and I couldn't find this kind of issue on the internet.
I also tried to use rotationRateUnbiased instead of attitude, but there are too much reading errors to get a reliable result.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by raynertanxw · May 02, 2016 at 12:20 AM

With regards to the gyroscope not reading its orientation at Start, I get the same problem too. Perhaps a solution would be to have a sort of loading screen, then just before the transition to your actual gyroscope-camera controlled scene have the game read and store the gyroscope quaternion, which should be awake and reading in this loading scene by now. So when you gyroscope scene loads it can read off that initial value as an offset.

Sorry but I have not encountered the other problem about the gyro randomly rotating between 1˚ and 180˚. It could be a device specific thing? Like my device can sometimes have the gyroscope not read until 1-2min after launch.

And I recommend never using rotationRate/rotationRateUnbiased as overtime, I think the errors from rounded off deltas would add up and slowly rotate your gyroscope away, etc. I recommend using gyroscope.attitude

If you would like to use it, my friends and I wrote a free toolset to make setting up the gyroscope easier. You can find it here: https://github.com/Daburu/Daburu-Tools/wiki/API-(DaburuTools.Input) ^ I know our code to be working, just have to set your project to Landscape-Right. We also have a SnapToPoint function to center the camera (with regards to y-rotational axis). Hope it helps.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
1

Answer by Thugann · May 04, 2016 at 01:37 PM

Hi there, thanks for answering.

My issue have never been encountered anywhere, so I just sent the device back. Hopefully I'll get it back repaired or replaced.

As for the orientation at start, I solved this with a coroutine waiting for 1 second before actually setting the right view.

Thanks for the link, I'll dig into it if I get my device back and still have issues using it. :)

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

48 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Gyroscope Samsung S7 doesn't work properly 4 Answers

Corrupted build on Android AR app 0 Answers

How can I detect Android device graphics capability? 0 Answers

Mobile data not being saved on all devices 0 Answers

Move two players in the same Screen (Input.TouchCount) 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges