Package org.team1126.lib.math.geometry
Class ExtPose
java.lang.Object
org.team1126.lib.math.geometry.ExtPose
- All Implemented Interfaces:
Supplier<edu.wpi.first.math.geometry.Pose2d>,Tunables.Tunable
A container for
Pose2d objects that enables live tuning via
NetworkTables, and dynamically returns flipped variants of the original
pose based on the robot's current alliance via Supplier.get().-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected edu.wpi.first.math.geometry.Pose2dprotected edu.wpi.first.math.geometry.Pose2dprotected edu.wpi.first.math.geometry.Pose2dprotected edu.wpi.first.math.geometry.Pose2d -
Constructor Summary
ConstructorsConstructorDescriptionExtPose(double x, double y, edu.wpi.first.math.geometry.Rotation2d rotation) Creates an extendedPose2d.ExtPose(edu.wpi.first.math.geometry.Pose2d pose) Creates an extendedPose2d.ExtPose(edu.wpi.first.math.geometry.Translation2d translation, edu.wpi.first.math.geometry.Rotation2d rotation) Creates an extendedPose2d. -
Method Summary
Modifier and TypeMethodDescriptionedu.wpi.first.math.geometry.Pose2dget()Gets the value for the robot's current alliance.edu.wpi.first.math.geometry.Pose2dget(boolean flipWidth) Gets the value for the robot's current alliance.edu.wpi.first.math.geometry.Pose2dget(boolean blue, boolean flipWidth) Gets the value for the specified alliance.edu.wpi.first.math.geometry.Pose2dgetBlue()Gets the value for the blue alliance.edu.wpi.first.math.geometry.Pose2dgetBlue(boolean flipWidth) Gets the value for the blue alliance.edu.wpi.first.math.geometry.Pose2dgetRed()Gets the value for the red alliance.edu.wpi.first.math.geometry.Pose2dgetRed(boolean flipWidth) Gets the value for the red alliance.voidinitTunable(TunableTable table) Initializes the object to be tuned.protected voidset(edu.wpi.first.math.geometry.Pose2d newValue) Saves a new value to the container, with all flipped variations.
-
Field Details
-
original
protected edu.wpi.first.math.geometry.Pose2d original -
overWidth
protected edu.wpi.first.math.geometry.Pose2d overWidth -
overLength
protected edu.wpi.first.math.geometry.Pose2d overLength -
overDiagonal
protected edu.wpi.first.math.geometry.Pose2d overDiagonal
-
-
Constructor Details
-
ExtPose
public ExtPose(double x, double y, edu.wpi.first.math.geometry.Rotation2d rotation) Creates an extendedPose2d. All parameters are expected to be blue origin relative.- Parameters:
x- The x component of the translational component of the pose.y- The y component of the translational component of the pose.rotation- The rotational component of the pose.
-
ExtPose
public ExtPose(edu.wpi.first.math.geometry.Translation2d translation, edu.wpi.first.math.geometry.Rotation2d rotation) Creates an extendedPose2d. All parameters are expected to be blue origin relative.- Parameters:
translation- The translational component of the pose.rotation- The rotational component of the pose.
-
ExtPose
public ExtPose(edu.wpi.first.math.geometry.Pose2d pose) Creates an extendedPose2d.- Parameters:
pose- The blue origin relative pose.
-
-
Method Details
-
set
protected void set(edu.wpi.first.math.geometry.Pose2d newValue) Saves a new value to the container, with all flipped variations. This method is invoked in the constructor, and can also be utilized byTunables.Tunable.initTunable(TunableTable).This method should implement setting the values of
original,overWidth,overLength, andoverDiagonal.- Parameters:
newValue- The new blue origin relative value.
-
initTunable
Description copied from interface:Tunables.TunableInitializes the object to be tuned. This method is called when adding the object to aTunableTable.- Parameters:
table- The table the object is being added to.
-
get
public edu.wpi.first.math.geometry.Pose2d get()Gets the value for the robot's current alliance. Flipping behavior is inherited fromFieldInfo.symmetryType(). -
get
public edu.wpi.first.math.geometry.Pose2d get(boolean flipWidth) Gets the value for the robot's current alliance. Flipping behavior is inherited fromFieldInfo.symmetryType().- Parameters:
flipWidth- If the value should also be flipped over the field's width, regardless of the robot's alliance.
-
get
public edu.wpi.first.math.geometry.Pose2d get(boolean blue, boolean flipWidth) Gets the value for the specified alliance. Flipping behavior is inherited fromFieldInfo.symmetryType().- Parameters:
blue- If the blue alliance value should be returned.flipWidth- If the value should also be flipped over the field's width, regardless of the alliance.
-
getBlue
public edu.wpi.first.math.geometry.Pose2d getBlue()Gets the value for the blue alliance. -
getBlue
public edu.wpi.first.math.geometry.Pose2d getBlue(boolean flipWidth) Gets the value for the blue alliance.- Parameters:
flipWidth- If the value should also be flipped over the field's width.
-
getRed
public edu.wpi.first.math.geometry.Pose2d getRed()Gets the value for the red alliance. -
getRed
public edu.wpi.first.math.geometry.Pose2d getRed(boolean flipWidth) Gets the value for the red alliance.- Parameters:
flipWidth- If the value should also be flipped over the field's width.
-