wollewald / MPU9250_WE

An Arduino library for the 9-axis accelerometer, gyroscope and magnetometer MPU9250 and MPU6500. It contains many example sketches make it easy to use.
https://wolles-elektronikkiste.de/en/mpu9250-9-axis-sensor-module-part-1
MIT License
56 stars 26 forks source link

Does this library make use of the DMP? #7

Closed Khyretos closed 2 years ago

Khyretos commented 2 years ago

i have several MPU6500 and i want to get the Yaw value as well, as i see your library only gives pitch and roll and due to the missing magnetometer yaw is dificoult to get (or so i understand).

i am following a video that is about the MPU6050 and they specify i need a library that reads directly from the DMP. hence my question.

wollewald commented 2 years ago

The answer is very simply no. I tried to implement DMP for few hours, got stuck at a certain point and decided to not pursue this. At least not for the moment... but the moment could be long!

Khyretos commented 2 years ago

Thank you for your fast awnser.

Do you have any recomendation for me to get pitch,yaw,roll or quaternions of the mpu6500?

If you need inspiration on how to use DMP this library has it implemented. But for the MPU6050, although it is not very different from the MPU9250.

Thank you for your time.

wollewald commented 2 years ago

I have implemented calculations for pitch and roll. I took the equations from here:

https://wiki.dfrobot.com/How_to_Use_a_Three-Axis_Accelerometer_for_Tilt_Sensing

If you include gyroscope values then you can calculate yaw. But it is relative to the starting orientation and there's always a certain error in calculation. And since you do not have a reference which the magnetometer could provide, the errors will add up and yaw will drift.

The easiest approach is to constantly monitor the gyroscop value for the z-Axis (gyroZ). The value is provided in degrees per second so you just multiply it with the time and get yaw this way:

Delta yaw = Delta gyroZ * Delta time. yaw = yaw + Delta yaw

The higher the frequency you apply (= the smaller Delta time) to measure gyroZ the lower the error.

And thanks for the link. Maybe I will try it again - but won't promise!

wollewald commented 2 years ago

I think I have answered the main question of the issue. If I will implement DMP depends on the time I will have.