Package frc.robot.lib.BLine
Record Class Path.RotationTarget
java.lang.Object
java.lang.Record
frc.robot.lib.BLine.Path.RotationTarget
- Record Components:
rotation- The target holonomic rotationt_ratio- The position along the segment (0-1) where this rotation should be achievedprofiledRotation- Whether to interpolate the rotation based on position
- All Implemented Interfaces:
Path.PathElement
- Enclosing class:
- Path
public static record Path.RotationTarget(edu.wpi.first.math.geometry.Rotation2d rotation, double t_ratio, boolean profiledRotation)
extends Record
implements Path.PathElement
A rotation target defining a holonomic rotation the robot should achieve.
Rotation targets can be placed between translation targets and use a t_ratio to specify where along the segment the rotation should be achieved. A t_ratio of 0 means at the start of the segment, 1 means at the end.
When profiledRotation is true, the rotation is interpolated smoothly
from the previous rotation to this target based on progress along the segment.
When false, the robot immediately targets this rotation.
-
Constructor Summary
ConstructorsConstructorDescriptionRotationTarget(edu.wpi.first.math.geometry.Rotation2d rotation, double t_ratio) Creates a rotation target with profiled rotation enabled by default.RotationTarget(edu.wpi.first.math.geometry.Rotation2d rotation, double t_ratio, boolean profiledRotation) Creates an instance of aRotationTargetrecord class. -
Method Summary
Modifier and TypeMethodDescriptioncopy()Creates a copy of this rotation target.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanReturns the value of theprofiledRotationrecord component.edu.wpi.first.math.geometry.Rotation2drotation()Returns the value of therotationrecord component.doublet_ratio()Returns the value of thet_ratiorecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
RotationTarget
public RotationTarget(edu.wpi.first.math.geometry.Rotation2d rotation, double t_ratio) Creates a rotation target with profiled rotation enabled by default.- Parameters:
rotation- The target holonomic rotationt_ratio- The position along the segment (0-1) where this rotation should be achieved
-
RotationTarget
public RotationTarget(edu.wpi.first.math.geometry.Rotation2d rotation, double t_ratio, boolean profiledRotation) Creates an instance of aRotationTargetrecord class.- Parameters:
rotation- the value for therotationrecord componentt_ratio- the value for thet_ratiorecord componentprofiledRotation- the value for theprofiledRotationrecord component
-
-
Method Details
-
copy
Creates a copy of this rotation target.- Specified by:
copyin interfacePath.PathElement- Returns:
- A new RotationTarget with the same values
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
rotation
public edu.wpi.first.math.geometry.Rotation2d rotation()Returns the value of therotationrecord component.- Returns:
- the value of the
rotationrecord component
-
t_ratio
public double t_ratio()Returns the value of thet_ratiorecord component.- Returns:
- the value of the
t_ratiorecord component
-
profiledRotation
public boolean profiledRotation()Returns the value of theprofiledRotationrecord component.- Returns:
- the value of the
profiledRotationrecord component
-