Quaternion issues

Hi all,
I'm working with a MPU9250 to control a 3D position. I have a object that can rotate in 3 axis ( Roll, Pitch and Yaw) but I found some problems.
Initially I tried to calculate Euler Angles from Quaternions, but I discover that Euler Angles have 2 discontinuity in +/- 90 degrees, and so if I rotate the MPU for 365 deg it gives me wrong values like it's shifting while rotating.
I read there is the possibility to convert Quaternions to DCM (Direction Cosine Matrix) but I find this algorithm fills too much the Arduino processor for calculations.
The last possibility that comes to my mind is to control the position directly with Quaternions, so i have to "forecast" the arriving Quaternion to stop the rotation when the MPU will give me the same Quaternion.
If anyone knows how to implement this or any other way please let me know your suggestions.

Many thanks
Luca

If you are trying to control a 3D orientation, then you have the problem that orientation is not uniquely defined using Euler angles.

You can uniquely specify an orientation using a quaternion, given an external reference. See this paper, for example. Google will show you many more discussions.

Thank you Mr. for the answer.

I wanted to know if it is the best solutions use Quaternion, in terms of processor time and precision, or if there are better methods.

I'm pretty sure I will find something on Google that allows me to perform Quaternions operations, I wanted to be sure before trying this implementation.

Thanks in advance,
Luca

Quaternions are super accurate and handy. They don't suffer from gimbal lock and are good things to have in your knowledge stash. But they are complicated. If you can learn to use them, it will prove to be handy. Now, you don't need to worry about processing delays. The onboard DMP can handle quaternions the fastest, I think. The best idea would be to stick to quaternions, until you absolutely need the 3D information in YPR or Euler angles or whatever.