EasyStack Docs

Constraints

Esta página aún no está traducida. Se muestra la versión en inglés.

A constraint limits how fast the robot may go at a point of the path, or how much it may accelerate there. You add constraints to a TrajectoryConfig and the generator respects all of them together with the maximum velocity and acceleration.

#TrajectoryConstraint

The interface has two methods. A constraint receives the pose, the curvature and the velocity at a point:

Java
public interface TrajectoryConstraint {
    double getMaxVelocity(Pose2d pose, double curvature, double velocity);
    MinMax getMinMaxAcceleration(Pose2d pose, double curvature, double velocity);
}
  • getMaxVelocity: the maximum velocity allowed at that point.
  • getMinMaxAcceleration: the minimum and the maximum acceleration allowed at that point.

#Ready-Made Constraints

  • MaxVelocityConstraint(maxVelocity): caps the velocity everywhere.
  • CentripetalAccelerationConstraint(maxCentripetalAcceleration): slows the robot down in tight curves so the sideways acceleration stays below the limit.
  • RectangularRegionConstraint(bottomLeft, topRight, constraint): applies another constraint only inside a rectangle.
Java
config.addConstraint(new MaxVelocityConstraint(30));
config.addConstraint(new CentripetalAccelerationConstraint(40));

config.addConstraint(new RectangularRegionConstraint(
        new Translation2d(24, -12),
        new Translation2d(48, 12),
        new MaxVelocityConstraint(10)));

The last constraint limits the velocity to 10 only while the robot is inside the rectangle, for example near a game element.

#Writing Your Own

Implement TrajectoryConstraint and return the limits you need. For example, a constraint that slows the robot near the end of the path can use the pose to measure the distance to a target and return a smaller maximum velocity as the distance shrinks.

Última actualización 2026-11-16

EasyStack - FTC Java library

This site records page views of visitors to understand how the documentation is used. Nothing is sold or shared with third parties.