Package xbot.common.math
Class FieldPose
java.lang.Object
xbot.common.math.FieldPose
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 Summary
ConstructorsConstructorDescriptionFieldPose(double x, double y, double heading) FieldPose(XYPair point, Rotation2d heading) -
Method Summary
Modifier and TypeMethodDescriptionclone()doublegetAngleToPoint(XYPair point) doublegetDeltaAngleToRabbit(FieldPose other, double lookaheadDistance) doublegetDistanceAlongPoseLine(XYPair other) doublegetDistanceToLineFromPoint(XYPair currentPoint) getFieldPoseOffsetBy(FieldPose offset) Returns a FieldPose that's "subtracted" by the offset FieldPose.getPoint()getPointAlongPoseLine(double distance) Projects along the line created by the X,Y pair and the Heading.getRabbitPose(XYPair other, double lookaheadDistance) getVectorToRabbit(FieldPose other, double lookaheadDistance) toString()
-
Constructor Details
-
FieldPose
public FieldPose() -
FieldPose
-
FieldPose
public FieldPose(double x, double y, double heading)
-
-
Method Details
-
clone
-
getHeading
-
getPoint
-
getPerpendicularHeadingTowardsPoint
-
getPointAlongPoseClosestToPoint
-
getDistanceAlongPoseLine
-
getRabbitPose
-
getDeltaAngleToRabbit
-
getVectorToRabbit
-
getAngleToPoint
-
getDistanceToLineFromPoint
-
getPoseRelativeDisplacement
-
getPointAlongPoseLine
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
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
-