EasyStack Docs

Motion Profiles

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

A motion profile generates a changing reference instead of asking a mechanism to jump to its final position. It produces intermediate position, velocity and acceleration setpoints that respect your limits, and a controller follows them.

#EasyMotionProfile

EasyMotionProfile is the interface that motors and servos accept. Any profile that implements it can be used:

Java
public interface EasyMotionProfile {
    void reset(State initial, State goal);
    State sample(double elapsedTime);
    double totalTime();
    default boolean isFinished(double elapsedTime) {
        return elapsedTime >= totalTime();
    }
}

A State holds a position, a velocity and an acceleration. Its constructors take (position, velocity) or (position, velocity, acceleration).

#Ready-Made Adapters

  • TrapezoidProfileAdapter(constraints): wraps TrapezoidProfile as an EasyMotionProfile.
  • TrapezoidProfileExAdapter(constraints): wraps TrapezoidProfileEx.
Java
TrapezoidProfileEx.Constraints limits = new TrapezoidProfileEx.Constraints(2000, 4000);

lift.setPositionProfile(new TrapezoidProfileExAdapter(limits));
lift.moveToPosition(1500);

Constraints take the maximum velocity and the maximum acceleration, both non-negative.

#TrapezoidProfile

A trapezoidal profile accelerates up to the maximum velocity, cruises and then decelerates to the goal. If the goal is too close to reach the maximum velocity, the profile becomes a triangle.

  • TrapezoidProfile(constraints, goal[, initial]): creates a profile for a goal state.
  • calculate(t): the state at time t.
  • totalTime(): how long the movement takes.
  • isFinished(t): true when t reached the end.

#TrapezoidProfileEx

TrapezoidProfileEx is the version used by EasyProfiledPID. It receives the current and the goal state each time, so you can change the goal while moving:

  • calculate(t, current, goal): the state after t seconds.
  • timeLeftUntil(target): the time until the profile reaches a position.
  • totalTime(), isFinished(t): the same as above.

#Using Profiles

  • Motors: setPositionProfile(profile) and setVelocityProfile(profile).
  • Commands: TrapezoidProfileCommand delivers the position and velocity to your output every loop.
  • Controllers: EasyProfiledPID combines a profile with a PID.
  • CR servos: update(positionRef, velocityRef, accelerationRef) accepts a reference from a profile.

Constraints govern the planned motion. They do not clamp motor power or guarantee that the mechanism can physically follow the plan.

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