Package choreo.util
Class AllianceFlipUtil
java.lang.Object
choreo.util.AllianceFlipUtil
A utility to standardize flipping of coordinate data based on the current alliance across
different years.
If every vendor used this, the user would be able to specify the year and no matter the year the vendor's code is from, the user would be able to flip as expected.
This API still allows vendors and users to match case against the flipping variant as a way to specially handle cases or throw errors if a variant is explicitly not supported.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
The flipper to use for flipping coordinates. -
Method Summary
Modifier and TypeMethodDescriptionstatic Pose2d
Flips the pose.static Pose3d
Flips the pose.static Rotation2d
flip
(Rotation2d rotation) Flips the rotation.static Rotation3d
flip
(Rotation3d rotation) Flips the rotation.static Translation2d
flip
(Translation2d translation) Flips the translation.static Translation3d
flip
(Translation3d translation) Flips the translation.static double
flipHeading
(double heading) Flips the heading.static double
flipX
(double x) Flips the X coordinate.static double
flipY
(double y) Flips the Y coordinate.static AllianceFlipUtil.Flipper
Get the flipper that is currently active for flipping coordinates.static void
setYear
(int year) Set the year to determine the Alliance Coordinate Flipper to use.static boolean
Returns if you are on red alliance.
-
Method Details
-
getFlipper
Get the flipper that is currently active for flipping coordinates. It's recommended not to store this locally as the flipper may change.- Returns:
- The active flipper.
-
shouldFlip
Returns if you are on red alliance.- Returns:
- If you are on red alliance.
-
setYear
Set the year to determine the Alliance Coordinate Flipper to use.- Parameters:
year
- The year to set the flipper to. [2020 - 2024]
-
flipX
Flips the X coordinate.- Parameters:
x
- The X coordinate to flip.- Returns:
- The flipped X coordinate.
-
flipY
Flips the Y coordinate.- Parameters:
y
- The Y coordinate to flip.- Returns:
- The flipped Y coordinate.
-
flipHeading
Flips the heading.- Parameters:
heading
- The heading to flip.- Returns:
- The flipped heading.
-
flip
Flips the translation.- Parameters:
translation
- The translation to flip.- Returns:
- The flipped translation.
-
flip
Flips the rotation.- Parameters:
rotation
- The rotation to flip.- Returns:
- The flipped rotation.
-
flip
Flips the pose.- Parameters:
pose
- The pose to flip.- Returns:
- The flipped pose.
-
flip
Flips the translation.- Parameters:
translation
- The translation to flip.- Returns:
- The flipped translation.
-
flip
Flips the rotation.- Parameters:
rotation
- The rotation to flip.- Returns:
- The flipped rotation.
-
flip
Flips the pose.- Parameters:
pose
- The pose to flip.- Returns:
- The flipped pose.
-