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
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion source/docs/software/advanced-controls/geometry/pose.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.


## Pose

Expand Down