Pitch & Roll Decrease After 90
I'm using the MPU6050 to stabilize an ROV with PID control taking the YPR readings as input. When if the pitch set-point is 80 degrees so the PID tries to rotate upward if the pitch was reading 0 which is correct. If it overshoots this 80, goes over 90 and continues rotating nose up until the pitch reads below 80 but by then the ROV would be almost upside down. Since the pitch reads less than the desired set-point then the PID will output a command to rotate nose up but since it's almost upside down, it does a back-flip, continues till it reaches the true 80 degrees, overshoots and flips again. I have no idea how to get around this and I'm extremely happy this library has work still going on, please keep it up!
It falls down to how Eular math is done converting from https://en.wikipedia.org/wiki/Quaternion values given by the MPU. While I know the values you are looking for are available I am not expert enough to guide you in changing the equation to represent degrees over 90 should continue to count upwards rather than back down. The MPU DMP provides Quaternion values along with Gyro Rates and Accelerometer Rates Quaternion Values will likely be what you will need to work with most in your conversion to Eular values. Z