Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix documentation implying that no part of Rotation2d wraps #2986

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

cland29
Copy link

@cland29 cland29 commented Feb 21, 2025

The Rotation2d object multiple times states throughout documentation that it doesn't wrap, yet has methods that wrap prior to constructing the Rotation2d. This commit clarifies that in the documentation

@@ -14,7 +14,7 @@ Rotation in 2 dimensions is represented by WPILib's ``Rotation2d`` class ([Java]

.. note:: ``Rotation2d`` uses the C++ Units library. The constructor in Java/Python accepts either the angle in radians, or the sine and cosine of the angle, but the ``fromDegrees`` method will construct a ``Rotation2d`` object from degrees.

.. note:: ``Rotation2d`` does not wrap the value of the angle, so if a value of 400 degrees is passed into the constructor, then 400 degrees will be returned in subsequent value calls.
.. note:: ``Rotation2d`` does not wrap the value of the angle, so if a value of 400 degrees is passed into the constructor, then 400 degrees will be returned in subsequent value calls. However, some method calls like ``plus`` and ``minus`` wrap the angle prior to the construction of the ``Rotation2d`` object.
Copy link
Member

@calcmogul calcmogul Feb 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some method calls isn't exactly correct. The constructor and angle getters won't wrap the angle, but all other methods will. This behavior was retained to support users abusing Rotation2d as an Euler angle; the 2027 version of Rotation2d makes everything wrap because it fundamentally represents an element of the SO(2) Lie group, not an Euler angle.

Users who don't want wrapping behavior should avoid Rotation2d and just use an Euler angle.

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.

2 participants