Skip to content

Conversation

@Kikkiu17
Copy link

@Kikkiu17 Kikkiu17 commented Dec 1, 2022

Z angle needs to be wrapped, like the other angles, to +/- 180 degrees. If there's constant rotation along the Z axis, without wrap, the Z angle will go out of bounds and will reach ~ +/- 650 degrees.

@rfetick
Copy link
Owner

rfetick commented Dec 3, 2022

Hello,
Thanks for your comment, however the Z angle is not wrapped on purpose, since an angle does not have to stay into the [-180°,+180°] bounds. The user may want to get the number of turns around Z axis, and this information is lost due to wrapping.
The user can still wrap the Z-angle by his/her own if needed.
Cheers,
Romain

@HAmamiya
Copy link

I am applying the MPU6050 in a RC Car and I am the one who wish the Z angle not wrapping.

However, I wonder if the value of Z will "overflow" well below the limit of float. Take arduino AVR as example, according to their documentation on float, while floating-point numbers can be as large as 3.4028235E+38 and as low as -3.4028235E+38, "The float data type has only 6-7 decimal digits of precision". If I am correct, that means resolution of Z will decrease to 1 degree if Z degree accumulates up to 1,000,000 (7 digits) and further decrease to 10 degree when Z degree accumulates up to 10,000,000 (i.e. over 27,777 full 360 degree turn).

I don't see any reset Z angle function in the documentation. I wonder if this library has one or in fact I was wrong in my understanding.

@shivenpatel399
Copy link

Hi. I was wondering if this library and angle example given also works with MPU9250.

@madhavjaigarg
Copy link

I think that instead of this, the fix given by @cemyasam2 on this post can be implemented in the src files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants