Class GameField
java.lang.Object
xbot.common.subsystems.pose.GameField
Represents the field the robot is on and provides helpers for transforming field coordinates.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumRepresents the symmetry type of the field. -
Constructor Summary
ConstructorsConstructorDescriptionGameField(org.wpilib.fields.Fields fieldLayout, GameField.Symmetry symmetry) Creates a new GameField. -
Method Summary
Modifier and TypeMethodDescriptionorg.wpilib.math.geometry.Translation2dGets the center of the field.org.wpilib.units.measure.DistanceGets the length of the field.org.wpilib.units.measure.DistanceGets the width of the field.org.wpilib.math.geometry.Pose2dgetMirroredPose(org.wpilib.math.geometry.Pose2d original) Gets the mirrored pose of a given pose per the field symmetry.org.wpilib.math.geometry.Rotation2dgetMirroredRotation(org.wpilib.math.geometry.Rotation2d original) Gets the mirrored rotation of a given rotation per the field symmetry.org.wpilib.math.geometry.Translation2dgetMirroredTranslation(org.wpilib.math.geometry.Translation2d original) Gets the mirrored translation of a given translation per the field symmetry.Gets the symmetry of the field.
-
Constructor Details
-
GameField
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
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.
-