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.
BezierCurve represents a single cubic Bézier curve segment and is the fundamental building block for all Odyssey paths. Given four control points it precomputes the polynomial coefficients used by every query method, keeping per-call cost low. A HeadingInterpolator is required at construction time so that the curve knows how to report robot orientation at any point along it.
Package: org.firstinspires.ftc.teamcode.odyssey.path
Constructor
The curve’s start point (anchor at
t = 0). Coordinates are typically in millimetres in the field frame.The first control point. The curve leaves
p0 travelling in the direction of p1 − p0, scaled by 3.The second control point. The curve arrives at
p3 from the direction of p3 − p2, scaled by 3.The curve’s end point (anchor at
t = 1).Strategy object that maps a curve parameter
t to a robot heading (radians). Built-in implementations include TangentInterpolator, LinearInterpolator, ConstantInterpolator, and FaceTargetInterpolator. A heading-free overload does not exist in the public API; a HeadingInterpolator is always required.The constructor precomputes the four polynomial coefficient vectors
a, b, c, d from the control points. These are reused by getPoint, getSquaredDistanceAtT, and their callers to avoid redundant arithmetic.Methods
getPoint
t.
Curve parameter in
[0, 1]. t = 0 is p0; t = 1 is p3.The 2-D field position at
t, computed as the standard cubic Bernstein expansion:
(1−t)³·p0 + 3t(1−t)²·p1 + 3t²(1−t)·p2 + t³·p3.getTangentVector
t — the instantaneous direction of travel. The vector is not normalised; its magnitude is proportional to speed under uniform t-parameterisation.
Curve parameter in
[0, 1].First derivative
B'(t) = 3(1−t)²·(p1−p0) + 6t(1−t)·(p2−p1) + 3t²·(p3−p2).getTangentAngle
atan2(B'y, B'x) — the heading angle of the tangent vector in radians. If you already hold the tangent Vector2d, calling vector.getAngleFromCur() directly is more efficient.
Curve parameter in
[0, 1].Tangent heading angle in radians, range
(−π, π].getLength
t = 0 to t = b using 5-point Gauss–Legendre quadrature (tolerances 1e-9, up to 1 000 evaluations).
Upper limit of integration. Must be in
[0, 1]. Values ≤ 0 return 0 immediately.Arc length in the same units as the control points (millimetres for a standard FTC field).
getTAtDistance
t such that getLength(t) ≈ dist. Uses a Brent root-finding solver (tolerance 1e-9, up to 1 000 iterations).
Target arc-length distance from
p0. Clamped: values ≤ 0 return 0.0; values ≥ getLength(1) return 1.0.Parameter
t ∈ [0, 1] such that getLength(t) ≈ dist to within 1e-9.getClosestT (default steps)
t whose point is closest to pose using a two-phase search: a coarse scan with step 0.01 followed by a fine refinement with step 1e-5 around the best candidate.
The 2-D query position (typically the robot’s current field position).
Parameter
t ∈ [0, 1] that minimises the squared Euclidean distance to pose.getClosestT (custom steps)
getClosestT with explicit step sizes for both search phases.
The 2-D query position.
Step size for the initial coarse sweep over
[0, 1]. Larger values are faster but may miss narrow local minima. Default: 0.01.Step size for the local refinement window
[bestT − coarseStep, bestT + coarseStep]. Default: 1e-5.Parameter
t ∈ [0, 1] that minimises squared distance to pose at the given resolution.getSquaredDistanceAtT
t and pose. Uses the precomputed polynomial form a·t³ + b·t² + c·t + d for efficiency; avoids a sqrt compared with computing true distance.
Curve parameter in
[0, 1].Reference position to measure distance from.
Squared distance
|B(t) − pose|² in units².getCurvature
t.
Curve parameter in
[0, 1].Curvature
κ = |B'(t) × B''(t)| / |B'(t)|³ in units⁻¹ (e.g. mm⁻¹ for mm control points). Returns 0 if the tangent magnitude is zero (degenerate segment).getSecondDerivative
B''(t) of the curve.
Curve parameter in
[0, 1].B''(t) = 6(1−t)·(p2 − 2p1 + p0) + 6t·(p3 − 2p2 + p1).getCentripetalVector
VelocityProfile to enforce lateral acceleration limits.
Curve parameter in
[0, 1].B''(t) − (B''·B' / |B'|²)·B' — the rejection of B'' from the tangent direction.getHeadingAtT
HeadingInterpolator provided at construction. The interpolator receives both t and a reference to this curve so it can query any geometric property it needs.
Curve parameter in
[0, 1].Robot heading in radians as determined by the active
HeadingInterpolator.Heading Interpolation
HeadingInterpolator is a single-method interface:
| Class | Behaviour |
|---|---|
TangentInterpolator | Heading tracks the curve’s tangent angle — robot always faces its direction of travel. |
LinearInterpolator(startHeading, endHeading) | Linearly interpolates heading from startHeading at t=0 to endHeading at t=1, taking the shortest angular path. |
ConstantInterpolator(heading) | Holds a fixed heading for the entire segment. |
FaceTargetInterpolator(target) | Robot always faces a fixed 2-D field point (atan2 from current curve position). |
