Record Class Path.TranslationTarget

java.lang.Object
java.lang.Record
frc.robot.lib.BLine.Path.TranslationTarget
Record Components:
translation - The target position in field coordinates
intermediateHandoffRadiusMeters - Optional radius at which to switch to the next target. If empty, the global default is used.
All Implemented Interfaces:
Path.PathElement
Enclosing class:
Path

public static record Path.TranslationTarget(edu.wpi.first.math.geometry.Translation2d translation, Optional<Double> intermediateHandoffRadiusMeters) extends Record implements Path.PathElement
A translation target defining a position the robot should drive through.

Translation targets form the "backbone" of a path. The robot will drive through each translation target in sequence. An optional intermediate handoff radius determines when the path follower switches to the next target.

  • Constructor Details

    • TranslationTarget

      public TranslationTarget(edu.wpi.first.math.geometry.Translation2d translation)
      Creates a translation target using the default handoff radius.
      Parameters:
      translation - The target position
    • TranslationTarget

      public TranslationTarget(double x, double y)
      Creates a translation target from x, y coordinates using default handoff radius.
      Parameters:
      x - The x coordinate in meters
      y - The y coordinate in meters
    • TranslationTarget

      public TranslationTarget(double x, double y, double handoffRadius)
      Creates a translation target from x, y coordinates with custom handoff radius.
      Parameters:
      x - The x coordinate in meters
      y - The y coordinate in meters
      handoffRadius - The intermediate handoff radius in meters
    • TranslationTarget

      public TranslationTarget(edu.wpi.first.math.geometry.Translation2d translation, Optional<Double> intermediateHandoffRadiusMeters)
      Creates an instance of a TranslationTarget record class.
      Parameters:
      translation - the value for the translation record component
      intermediateHandoffRadiusMeters - the value for the intermediateHandoffRadiusMeters record component
  • Method Details

    • copy

      public Path.TranslationTarget copy()
      Creates a copy of this translation target.
      Specified by:
      copy in interface Path.PathElement
      Returns:
      A new TranslationTarget 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • translation

      public edu.wpi.first.math.geometry.Translation2d translation()
      Returns the value of the translation record component.
      Returns:
      the value of the translation record component
    • intermediateHandoffRadiusMeters

      public Optional<Double> intermediateHandoffRadiusMeters()
      Returns the value of the intermediateHandoffRadiusMeters record component.
      Returns:
      the value of the intermediateHandoffRadiusMeters record component