Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/saquer916/odyssey/llms.txt

Use this file to discover all available pages before exploring further.

Pose2d represents a 2D robot pose — x and y coordinates in millimetres plus a heading in radians. The heading is always normalized to the half-open interval (−π, π] via MathUtils.normalizeAngle in every constructor, so you never need to clamp it manually. Pose2d is used throughout Odyssey wherever a complete robot state is required: localization output, path targets, and error computation in the Follower. Package: org.firstinspires.ftc.teamcode.odyssey.geometry

Constructors

Pose2d(double x, double y, double heading)
constructor
Primary constructor. Creates a pose from explicit coordinates and a heading.
x
double
required
X position of the robot in millimetres.
y
double
required
Y position of the robot in millimetres.
heading
double
required
Robot heading in radians. Automatically normalized to (−π, π] on construction.
Pose2d(Vector2d vector2d, double heading)
constructor
Convenience overload that unpacks a Vector2d for the position. Internally reads vector2d.getX() and vector2d.getY(), then normalizes heading identically to the primary constructor.
vector2d
Vector2d
required
Position vector whose x and y components are used.
heading
double
required
Robot heading in radians. Automatically normalized to (−π, π].

Methods

getX()
double
Returns the x coordinate of the pose in millimetres.
getY()
double
Returns the y coordinate of the pose in millimetres.
getHeading()
double
Returns the heading in radians, already normalized to (−π, π]. This value is fixed at construction and does not change.
getPosition()
Vector2d
Returns the translational component of this pose as a Vector2d(x, y). Useful when you need a position vector to pass into geometry operations.
toRobotFrame(Vector2d fieldPoint)
Vector2d
Transforms a point expressed in the field frame into the robot frame. The implementation first subtracts the robot’s field position, then rotates by −heading:
// step 1: translate into robot-origin space
Vector2d translated = fieldPoint.subtract(new Vector2d(x, y));
// step 2: rotate by −heading to align with the robot's local axes
Vector2d result = translated.rotateVector(-heading);
Use this when you need to express a field-frame target in the robot’s local coordinate system (e.g. for PID error computation).
fieldPoint
Vector2d
required
A point in field-frame coordinates (mm).
toFieldFrame(Vector2d robotPoint)
Vector2d
Transforms a point expressed in the robot frame into the field frame — the inverse of toRobotFrame. Rotates the point by +heading and then adds the robot’s field position.
robotPoint
Vector2d
required
A point in robot-frame coordinates (mm).
relativeTo(Pose2d other)
Pose2d
Expresses this pose relative to other. The translational component is obtained by calling other.toRobotFrame(this.getPosition()); the heading component is this.heading − other.heading, normalized. Primarily used by Follower to compute the pose error between the current robot pose and the target pose on the path.
other
Pose2d
required
The reference pose to measure relative to.
toString()
String
Returns a human-readable string in the format "Pose2d(x=..., y=..., heading=...)". Useful for telemetry logging.

Example

Pose2d robot = new Pose2d(1200, 600, Math.PI / 4);
Vector2d fieldPoint = new Vector2d(1500, 900);
Vector2d inRobotFrame = robot.toRobotFrame(fieldPoint);
The round-trip identity holds for any pose and point:
Pose2d pose = new Pose2d(2, 2, Math.PI / 3);
Vector2d original = new Vector2d(7, 1);
Vector2d back = pose.toFieldFrame(pose.toRobotFrame(original));
// back.getX() ≈ 7.0,  back.getY() ≈ 1.0
The constructor always normalizes heading. Passing 3π/2 radians (270°) produces a stored heading of −π/2 (−90°). Use getHeading() rather than caching the raw value you passed in.

Build docs developers (and LLMs) love