cancel
Showing results for 
Search instead for 
Did you mean: 

How do you calculate the tri-axis(mag, access, gyro or fusion) outputs (+/- 1over 180 degrees) to accurately cover 360 degrees in code and what are those conversion. So that one physical rotation of the device equals 360 degrees exactly.

CTone.1
Associate

How do you calculate the tri-axis(mag, access, gyro or fusion) outputs (+/- 1over 180 degrees) to accurately cover 360 degrees in code and what are those conversion. So that one physical rotation of the device equals 360 degrees exactly. Currently using ST iOS App and Compass, 1 rotation of the device is off by about 90 degrees in the ST App.

1 REPLY 1
Eleon BORLINI
ST Employee

Hi @CTone.1​ ,

the calculation algorithm may depend on the sensors involved in the specific application.

For example, if you use the gyroscope for the tilt measurement and eCompass applications, you can refer to the DT0060 design tip for the detailed calculations.

In general, you can have a look at the X-CUBE-MEMS1 sensor and motion algorithm software expansion for STM32Cube, which contains a series of libraries designed for angle and in general displacement calculation (i.e. the integration and combination of the row output data): for example, the MotionTL library is in charge of the tilt measurement; the MotionEC for the real-time E-Compass; the MotionFX for the sensor fusion and the Euler's angles / quaternions calculation.

The exact algorithms behind these libraries are not open, so a request for the source code has to be carried out by contacting Sales and Offices representatives from the st.com link.

Please let me know if these suggestions can help you.

-Eleon