Class FlippingUtil

java.lang.Object
com.pathplanner.lib.util.FlippingUtil

public class FlippingUtil extends Object
Utility class for flipping positions/rotations to the other side of the field
  • Field Details

    • symmetryType

      public static FlippingUtil.FieldSymmetry symmetryType
      The type of symmetry for the current field
    • fieldSizeX

      public static double fieldSizeX
      The X size or length of the current field in meters
    • fieldSizeY

      public static double fieldSizeY
      The Y size or width of the current field in meters
  • Constructor Details

    • FlippingUtil

      public FlippingUtil()
  • Method Details

    • flipFieldPosition

      public static Translation2d flipFieldPosition(Translation2d pos)
      Flip a field position to the other side of the field, maintaining a blue alliance origin
      Parameters:
      pos - The position to flip
      Returns:
      The flipped position
    • flipFieldRotation

      public static Rotation2d flipFieldRotation(Rotation2d rotation)
      Flip a field rotation to the other side of the field, maintaining a blue alliance origin
      Parameters:
      rotation - The rotation to flip
      Returns:
      The flipped rotation
    • flipFieldPose

      public static Pose2d flipFieldPose(Pose2d pose)
      Flip a field pose to the other side of the field, maintaining a blue alliance origin
      Parameters:
      pose - The pose to flip
      Returns:
      The flipped pose
    • flipFieldSpeeds

      public static ChassisSpeeds flipFieldSpeeds(ChassisSpeeds fieldSpeeds)
      Flip field relative chassis speeds for the other side of the field, maintaining a blue alliance origin
      Parameters:
      fieldSpeeds - Field relative chassis speeds
      Returns:
      Flipped speeds
    • flipFeedforwards

      public static double[] flipFeedforwards(double[] feedforwards)
      Flip an array of drive feedforwards for the other side of the field. Only does anything if mirrored symmetry is used
      Parameters:
      feedforwards - Array of drive feedforwards
      Returns:
      The flipped feedforwards
    • flipFeedforwardXs

      public static double[] flipFeedforwardXs(double[] feedforwardXs)
      Flip an array of drive feedforward X components for the other side of the field. Only does anything if mirrored symmetry is used
      Parameters:
      feedforwardXs - Array of drive feedforward X components
      Returns:
      The flipped feedforward X components
    • flipFeedforwardYs

      public static double[] flipFeedforwardYs(double[] feedforwardYs)
      Flip an array of drive feedforward Y components for the other side of the field. Only does anything if mirrored symmetry is used
      Parameters:
      feedforwardYs - Array of drive feedforward Y components
      Returns:
      The flipped feedforward Y components