Showing results for 
Search instead for 
Did you mean: 

Exactly which library are we supposed to use if we want Roll, Pitch and Yaw data from the ISM330DLC acc and gyro sensor?

Associate II

Currently, I'm working on a project where my job is to take Accelerometer, Gyroscope data and convert it into Roll, Pitch and Yaw.

So to achieve this we started working on the ISM330DLC sensor. To get the raw data we interfaced the example code successfully and then we included the DI library to convert the raw data into Roll, Pitch and Yaw. Lastly, we were printing the Roll, Pitch and Yaw angles on the UART.

After printing data, we observed suspicious data, for example, we kept the sensor in a steady position and then we observed Yaw angle value was 360 degrees at the same time roll and pitch angles were also changing randomly.

So after this, we dumped the .bin file which is provided in the Unico GUI folder. and again we observed the Roll, Pitch and Yaw. This time we observed that the values were changing according to the position.

Now can anyone please help me to understand whether it is a library issue or something else? which library exactly do I have to use if I want the Roll, Pitch and Yaw angles from the ISM330DLC sensor.

@Eleon BORLINI​ @Miroslav BATEK​ 

ST Employee

Hi @omkardixi​ ,

you might use the MotionFX sensor fusion library that estimates the 3D orientation in space. The demo code reported in the user manual UM2220 p.14 reads data from the accelerometer, gyroscope and magnetometer sensors and gets the rotation, quaternions, gravity and linear acceleration.

Every time you use a library from the X-CUBE-MEMS1 package, I suggest you to run first the libraries related to the Gyro and to the accelerometer calibration, in order to minimize the error you can get by integrating the sensor ZRL or ZGL and the noise.

I let however @Miroslav BATEK​ add further suggestion, if any.