EasyStack Docs

Trajectories

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

A trajectory is a path with time. It tells the robot where to be, how fast to go and how fast to speed up at every moment. EasyStack builds trajectories from a list of waypoints: it joins them with smooth quintic splines and then assigns a velocity to every point, respecting the limits you set.

#Generating a Trajectory

Java
TrajectoryConfig config = new TrajectoryConfig(40, 60)
        .setStartVelocity(0)
        .setEndVelocity(0)
        .addConstraint(new CentripetalAccelerationConstraint(50));

Trajectory path = TrajectoryGenerator.generate(Arrays.asList(
        new Pose2d(0, 0, 0),
        new Pose2d(36, 24, Math.toRadians(45))), config);

TrajectoryGenerator.generate needs at least two waypoints, otherwise it throws an IllegalArgumentException. Use one unit system everywhere. The dashboard draws trajectories in inches.

#TrajectoryConfig

The constructor takes the maximum velocity and the maximum acceleration. These methods return the config, so they can be chained:

  • setStartVelocity(v), setEndVelocity(v): the velocity at the start and at the end.
  • setReversed(boolean): drives the path backwards.
  • addConstraint(constraint): adds a TrajectoryConstraint. See the Constraints tab.
  • setSplineTolerance(maxDx, maxDy, maxDtheta): how finely the spline is sampled.

#Using a Trajectory

  • getTotalTime(): how long the trajectory takes.
  • sample(time): the state at a given time.
  • getInitialPose(): the first pose.
  • getStates(): all the states.
  • transformBy(transform), relativeTo(pose): move the whole trajectory.
  • concatenate(other): joins two trajectories.

A Trajectory.State holds the time, the velocity, the acceleration, the pose and the curvature at one point:

Java
Trajectory.State state = path.sample(1.2);
Pose2d target = state.pose;
double speed = state.velocity;

#Dashboard

Every generated trajectory is registered with the dashboard automatically and drawn on the Field panel. You can also draw one yourself with EasyDash.trajectory(name, trajectory).

EasyStack generates and samples trajectories. It does not follow them: your robot code decides how to use each sampled pose and velocity.

Ú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.