Record Class Path.RotationTarget

java.lang.Object
java.lang.Record
frc.robot.lib.BLine.Path.RotationTarget
Record Components:
rotation - The target holonomic rotation
t_ratio - The position along the segment (0-1) where this rotation should be achieved
profiledRotation - 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

    Constructors
    Constructor
    Description
    RotationTarget(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 a RotationTarget record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    Creates a copy of this rotation target.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    boolean
    Returns the value of the profiledRotation record component.
    edu.wpi.first.math.geometry.Rotation2d
    Returns the value of the rotation record component.
    double
    Returns the value of the t_ratio record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • 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 rotation
      t_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 a RotationTarget record class.
      Parameters:
      rotation - the value for the rotation record component
      t_ratio - the value for the t_ratio record component
      profiledRotation - the value for the profiledRotation record component
  • Method Details

    • copy

      public Path.RotationTarget copy()
      Creates a copy of this rotation target.
      Specified by:
      copy in interface Path.PathElement
      Returns:
      A new RotationTarget with the same values
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • rotation

      public edu.wpi.first.math.geometry.Rotation2d rotation()
      Returns the value of the rotation record component.
      Returns:
      the value of the rotation record component
    • t_ratio

      public double t_ratio()
      Returns the value of the t_ratio record component.
      Returns:
      the value of the t_ratio record component
    • profiledRotation

      public boolean profiledRotation()
      Returns the value of the profiledRotation record component.
      Returns:
      the value of the profiledRotation record component