-1

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.

Omkar Dixit
  • 71
  • 1
  • 7
  • Sounds like some problem implementing library? Like forgot something or misconfigured. If possible, I would grab a logic analyzer. Or at least a scope. And compare communication of working and non-working case directly on the physical level. Can reveal a lot. – Ilya Jun 23 '22 at 00:27

2 Answers2

2

I lately found the we dont really need any library for find Roll ,Pitch.

  • I got Pitch and Roll angle from raw value of Accelerometer.Below is the Equation i used.Use need math.h in includes.

     float aX = float(accel.x);
     float aY = float(accel.y);
     float aZ = float(accel.z);
     int pitch = atan2(-aX, aZ) * 180 / PI; // rotation on Y axis
     int roll = atan2(-aY, aZ) * 180 / PI; // rotation on X axis
    

where PI is 3.14...

Please go through the below link(which really helped me) to get more clear idea.

https://docs.idew.org/code-internet-of-things/references/physical-inputs/accelerometer#start-accelerometer-in-setup

#ISM330DLC #Accelerometer #Pitch #roll

ANNA
  • 21
  • 3
-1

Now the issue is solved and we are using the Motion FX Library to get Roll, Pitch & Yaw.

Omkar Dixit
  • 71
  • 1
  • 7