Newbie question Gyro readings

Newbie math question. 

I have been able to mix my iOS app that provides plane transformations with the Metaware framework. 

However I am having trouble understanding the BMI160 gyro readings. I have not been able to google anything specific that solves my issue. Generally I want to get the current orientation of the C module. 

I understand there are sample rates, sample settings. I can get the Gyro readings in my app. However I am not sure how to use the X Y Z readings and translate (excuse the pun) to an orientation. 

The Gyro provides degrees per second per each sample. Using 100 samples per second, I device the angle / 100 per second. to get an angle. Say Y axis reports 12, that is 12 degrees per second rate, and .12 degrees turned in the y direction. However using this math in Degrees, converting to rad and translating transforming the object doesn't show me correct orientation. 

My goal is to show orientation (mostly normal) a pinewood derby car while traveling down the track. I can use the acceleration (which I may switch to) as the better measure but that won't give me the orientation. 

Any feedback would be appreciated. thank you SA0987


  • This is not a small undertaking and will take some math to accomplish.

    The best way to do this is to take a look at the top answer here:
  • Thank you. Can I trust both gyro and accel to report near each other in time?

    Example, set both to 50 hz. And I would not miss any samples via BTLE?

    I can code it to ensure which ever one comes first, to wait for the other, then do the math. I just want to ensure I am guaranteed (with a good connection) to get all 50x2 (100) samples a second.

    have the iOS code now rotating a layer around x and y. And as explained there is gyro drift that messes things us.

    Thank you and let me know about sample rate. Sa0987
This discussion has been closed.