Package choreo.util
Class ChoreoAllianceFlipUtil.Flipper
java.lang.Object
choreo.util.ChoreoAllianceFlipUtil.Flipper
- Enclosing class:
- ChoreoAllianceFlipUtil
The flipper to use for flipping coordinates.
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe default flipper for the current FRC year. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract DifferentialSampleflip(DifferentialSample sample) Flips a DifferentialSample.abstract SwerveSampleflip(SwerveSample sample) Flips a SwerveSample.Flips the pose.Flips the pose.abstract Rotation2dflip(Rotation2d rotation) Flips a Rotation2d.flip(Rotation3d rotation) Flips the rotation.flip(Translation2d translation) Flips a Translation2d.flip(Translation3d translation) Flips the translation.abstract doubleflipHeading(double heading) Flips the heading.abstract doubleflipX(double x) Flips the X coordinate.abstract doubleflipY(double y) Flips the Y coordinate.doubleGets the length (X axis) of the field.doubleGets the width (Y axis) of the field.static choreo.util.ChoreoAllianceFlipUtil.Flipper.MirroredXmirroredX(double fieldLength, double fieldWidth) Creates a new flipper that mirrors across x=fieldLength/2.static choreo.util.ChoreoAllianceFlipUtil.Flipper.MirroredYmirroredY(double fieldLength, double fieldWidth) Creates a new flipper that mirrors across y=fieldWidth/2.static choreo.util.ChoreoAllianceFlipUtil.Flipper.RotatedAroundrotatedAround(double fieldLength, double fieldWidth) Creates a new rotated flipper around the center of the field.
-
Field Details
-
FRC_CURRENT
The default flipper for the current FRC year.
-
-
Constructor Details
-
Flipper
protected Flipper()Constructs a flipper. -
Flipper
Constructs a flipper with the given field dimensions.- Parameters:
fieldLength- The length of the field.fieldWidth- The width of the field.
-
-
Method Details
-
mirroredX
public static choreo.util.ChoreoAllianceFlipUtil.Flipper.MirroredX mirroredX(double fieldLength, double fieldWidth) Creates a new flipper that mirrors across x=fieldLength/2. This is intended for alliance-based flipping in rotationally asymmetric games.- Parameters:
fieldLength- The length of the field.fieldWidth- The width of the field.- Returns:
- a new flipper.
-
mirroredY
public static choreo.util.ChoreoAllianceFlipUtil.Flipper.MirroredY mirroredY(double fieldLength, double fieldWidth) Creates a new flipper that mirrors across y=fieldWidth/2. This keeps the positions on the same alliance half, but can be used to mirror left and right sides of the field, from driver perspective.- Parameters:
fieldLength- The length of the field.fieldWidth- The width of the field.- Returns:
- a new flipper.
-
rotatedAround
public static choreo.util.ChoreoAllianceFlipUtil.Flipper.RotatedAround rotatedAround(double fieldLength, double fieldWidth) Creates a new rotated flipper around the center of the field. This is intended for alliance-based flipping in rotationally symmetric games.- Parameters:
fieldLength- The length of the field.fieldWidth- The width of the field.- Returns:
- A new rotated flipper around the center of the field.
-
getFieldLength
Gets the length (X axis) of the field.- Returns:
- the length (X axis) of the field.
-
getFieldWidth
Gets the width (Y axis) of the field.- Returns:
- the width (Y axis) of the field.
-
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 a Rotation2d.- Parameters:
rotation- the Rotation2d to flip.- Returns:
- The flipped Rotation2d.
-
flip
Flips a SwerveSample.- Parameters:
sample- The SwerveSample to flip.- Returns:
- The flipped SwerveSample.
-
flip
Flips a DifferentialSample.- Parameters:
sample- The DifferentialSample to flip.- Returns:
- The flipped DifferentialSample.
-
flip
Flips a Translation2d.- Parameters:
translation- the Translation2d to flip.- Returns:
- The flipped Translation2d.
-
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.
-