Class GameField

java.lang.Object
xbot.common.subsystems.pose.GameField

@Singleton public class GameField extends Object
Represents the field the robot is on and provides helpers for transforming field coordinates.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    Represents the symmetry type of the field.
  • Constructor Summary

    Constructors
    Constructor
    Description
    GameField(org.wpilib.fields.Fields fieldLayout, GameField.Symmetry symmetry)
    Creates a new GameField.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.wpilib.math.geometry.Translation2d
    Gets the center of the field.
    org.wpilib.units.measure.Distance
    Gets the length of the field.
    org.wpilib.units.measure.Distance
    Gets the width of the field.
    org.wpilib.math.geometry.Pose2d
    getMirroredPose(org.wpilib.math.geometry.Pose2d original)
    Gets the mirrored pose of a given pose per the field symmetry.
    org.wpilib.math.geometry.Rotation2d
    getMirroredRotation(org.wpilib.math.geometry.Rotation2d original)
    Gets the mirrored rotation of a given rotation per the field symmetry.
    org.wpilib.math.geometry.Translation2d
    getMirroredTranslation(org.wpilib.math.geometry.Translation2d original)
    Gets the mirrored translation of a given translation per the field symmetry.
    Gets the symmetry of the field.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • GameField

      @Inject public GameField(org.wpilib.fields.Fields fieldLayout, GameField.Symmetry symmetry)
      Creates a new GameField.
      Parameters:
      fieldLayout - The layout of the field.
      symmetry - The symmetry of the field.
  • Method Details

    • getFieldWidth

      public org.wpilib.units.measure.Distance getFieldWidth()
      Gets the width of the field.
      Returns:
      The width of the field.
    • getFieldLength

      public org.wpilib.units.measure.Distance getFieldLength()
      Gets the length of the field.
      Returns:
      The length of the field.
    • getSymmetry

      public GameField.Symmetry getSymmetry()
      Gets the symmetry of the field.
      Returns:
      The symmetry of the field.
    • getFieldCenter

      public org.wpilib.math.geometry.Translation2d getFieldCenter()
      Gets the center of the field.
      Returns:
      The center of the field. Distances are in meters.
    • getMirroredTranslation

      public org.wpilib.math.geometry.Translation2d getMirroredTranslation(org.wpilib.math.geometry.Translation2d original)
      Gets the mirrored translation of a given translation per the field symmetry.
      Parameters:
      original - The original translation. Distances are in meters.
      Returns:
      The mirrored translation. Distances are in meters.
    • getMirroredRotation

      public org.wpilib.math.geometry.Rotation2d getMirroredRotation(org.wpilib.math.geometry.Rotation2d original)
      Gets the mirrored rotation of a given rotation per the field symmetry.
      Parameters:
      original - The original rotation.
      Returns:
      The mirrored rotation.
    • getMirroredPose

      public org.wpilib.math.geometry.Pose2d getMirroredPose(org.wpilib.math.geometry.Pose2d original)
      Gets the mirrored pose of a given pose per the field symmetry.
      Parameters:
      original - The original pose. Distances are in meters.
      Returns:
      The mirrored pose. Distances are in meters.