• 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 /
avatar image
1
Question by xepheria · Jun 28, 2016 at 07:24 AM · rotationquaternionarduinohardwaresensor

Reversed axes with quaternions and orientation sensor

Been dealing with kind of a weird problem...At first I thought I had made a mistake in my code as it went away for about a week, but now it's returned with a vengeance. As a bit of background, I'm trying to use a 9-DOF sensor (BNO055) mounted to a real-world object in order to give the orientation of that same object in my game. I'm using Arduino code to stream the data over UDP (I'm using a Feather M0 WINC1500 controller), and Unity is receiving the data and feeding the quaternion to the object in my game.

Everything is fine until I start up my program and the axes randomly reverse direction...Sometimes it's one, two, or all three axes. And it might stay consistent for a couple hours or days. And then the axes flip again. I haven't changed anything in my code, so I'm pretty certain this is a hardware issue. But I don't understand it because I've never heard of this issue before.

My coworker said it might be because of a change in the surrounding electrical field that would cause the chip to read differently. If anybody here is familiar with this problem, I would really appreciate the help. Thank you. Included below is the code I'm using to orientate the object...I had to change the order of x,y,z in order to match up the axes to the object in Unity...:

 transform.rotation = new Quaternion(float.Parse(BNO055[2]),float.Parse(BNO055[3]),float.Parse(BNO055[1]),float.Parse(BNO055[0]));
 Vector3 finalRotation = transform.eulerAngles - offset;
 transform.rotation = Quaternion.Euler(finalRotation);
Comment
Add comment · Show 1
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 bjahangiri · Sep 28, 2017 at 09:51 PM 0
Share

Could you provide some insight on how to get the assembly to work. I am using the same board and sensor but could not get the board to detect IMU sensor. Did you use adafruit bno055 library? Any help would be highly appreciated.

Thanks,

0 Replies

· Add your reply
  • Sort: 

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Quaternions applied to Sensor Fusion: gyro.attitude with compass 0 Answers

My rotation keeps resetting 1 Answer

How can I rotate at a constant speed to look at a point? 2 Answers

how to combine 2 quaternion components? 2 Answers

Head and body rotate threshold 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges