Class FieldPose

java.lang.Object
xbot.common.math.FieldPose

public class FieldPose extends Object
The FieldPose class represents a point on the field as well as a heading. It also keeps track of some linear equation parameters such as slope and y-intercept. These are used to calculate intersection points between multiple FieldPose instances, which can then be used as part of path-following logic.
  • Constructor Details

    • FieldPose

      public FieldPose()
    • FieldPose

      public FieldPose(XYPair point, Rotation2d heading)
    • FieldPose

      public FieldPose(double x, double y, double heading)
  • Method Details

    • clone

      public FieldPose clone()
      Overrides:
      clone in class Object
    • getHeading

      public WrappedRotation2d getHeading()
    • getPoint

      public XYPair getPoint()
    • getPerpendicularHeadingTowardsPoint

      public WrappedRotation2d getPerpendicularHeadingTowardsPoint(FieldPose other)
    • getPointAlongPoseClosestToPoint

      public XYPair getPointAlongPoseClosestToPoint(XYPair other)
    • getDistanceAlongPoseLine

      public double getDistanceAlongPoseLine(XYPair other)
    • getRabbitPose

      public FieldPose getRabbitPose(XYPair other, double lookaheadDistance)
    • getDeltaAngleToRabbit

      public double getDeltaAngleToRabbit(FieldPose other, double lookaheadDistance)
    • getVectorToRabbit

      public XYPair getVectorToRabbit(FieldPose other, double lookaheadDistance)
    • getAngleToPoint

      public double getAngleToPoint(XYPair point)
    • getDistanceToLineFromPoint

      public double getDistanceToLineFromPoint(XYPair currentPoint)
    • getPoseRelativeDisplacement

      public XYPair getPoseRelativeDisplacement(FieldPose other)
    • getPointAlongPoseLine

      public FieldPose getPointAlongPoseLine(double distance)
      Projects along the line created by the X,Y pair and the Heading. Positive distances are in front, negative are behind. Keeps the original heading.
      Parameters:
      distance - Positive distances are in front, negative are behind.
      Returns:
      FieldPose projected along the line
    • getFieldPoseOffsetBy

      public FieldPose getFieldPoseOffsetBy(FieldPose offset)
      Returns a FieldPose that's "subtracted" by the offset FieldPose. Useful for setting your current position as 0,0 and measuring relative to that as you move around the field.
      Parameters:
      offset - The offset location
      Returns:
      The FieldPose shifted by the given offset
    • toString

      public String toString()
      Overrides:
      toString in class Object