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.
VelocityProfile pre-computes a physically realizable speed schedule for a Path that simultaneously respects maximum velocity, acceleration, braking, and centripetal acceleration limits. The profile is built entirely at construction time by sampling the path at a fixed distance step, applying a curvature-based speed cap, running a forward acceleration pass, and then a backward braking pass. The result is a dense array of (distance, velocity) pairs that getTargetVelocity and getTargetTangentialAcceleration can query in O(1) via index arithmetic and v²-linear interpolation.
Package: org.firstinspires.ftc.teamcode.odyssey.path
Constructor
The path to profile. The constructor calls
path.getTotalLength() and path.getCurvatureFromPathDistance() once per sample, so path must be fully constructed before being passed here.Absolute speed cap in mm/s. No sample in the profile will exceed this value.
Maximum forward (tangential) acceleration in mm/s². Applied during the forward pass:
v[i] ≤ sqrt(v[i-1]² + 2 · maxAcceleration · Δs).Maximum deceleration magnitude in mm/s². Applied during the backward pass:
v[i] ≤ sqrt(v[i+1]² + 2 · maxBrake · Δs). Can differ from maxAcceleration to model asymmetric drivetrains or conservative stopping behaviour.Centripetal acceleration limit in mm/s². At any sample with curvature κ, the speed is capped at
sqrt(maxCentripetalAccel / κ) before the forward/backward passes. Samples where κ < 1e-4 (effectively straight) are treated as unconstrained and receive the full maxVelocity cap instead.Distance between consecutive profile samples in mm. Smaller values produce a finer-grained profile at the cost of more memory and a longer construction time. Typical values range from
1.0 mm (high precision) to 10.0 mm (fast builds for long paths).The profile is guaranteed to start and end at rest:
velocities[0] and velocities[arraySize - 1] are forced to 0 before the forward and backward passes respectively, so the robot always begins and ends stationary regardless of the other limits.Methods
getTargetVelocity
Distance from path start in mm.
Target speed in mm/s. The interpolation is v²-linear (linear in v²) between the two bracketing samples, which matches the physics of constant-acceleration motion:
v = sqrt(v1² + (d − d1) · (v2² − v1²) / (d2 − d1)). Values for distance ≤ 0 return velocities[0] (always 0); values beyond the profile end return velocities[last] (always 0).getTargetTangentialAcceleration
Distance from path start in mm.
Tangential acceleration in mm/s², computed as
(vf² − v0²) / (2 · Δs) over the bracketing interval. Positive values indicate the robot should be accelerating; negative values indicate braking. Returns 0 for queries outside the profile range.Implementation Notes
The profile is built in three sequential passes over the sample array:- Curvature cap — each sample
iis initialised tomin(maxVelocity, sqrt(maxCentripetalAccel / κ)). Samples withκ < 1e-4receivemaxVelocitydirectly. - Forward acceleration pass — iterates from index
1toend, clamping each sample tosqrt(v[i-1]² + 2 · maxAcceleration · Δs). The first sample is pinned to0before this pass. - Backward braking pass — iterates from
end−1back to0, clamping each sample tosqrt(v[i+1]² + 2 · maxBrake · Δs). The last sample is pinned to0before this pass.
