EasyStack Docs

EasyFFController

Esta página ainda não foi traduzida. Mostrando a versão em inglês.

EasyFFController is the feedforward model that EasyMotor and EasyCRServo use for velocity. It estimates the output needed to reach a requested velocity and acceleration from three gains, without waiting for an error to appear.

#Creating an EasyFFController

Provide the gains in this order: kS, kV and, optionally, kA. You can pass the three gains directly or an EasyFFCoefficients object:

Java
EasyFFController ff = new EasyFFController(0.05, 0.0004);
EasyFFController withAcceleration = new EasyFFController(0.05, 0.0004, 0.00002);
EasyFFController fromObject = new EasyFFController(new EasyFFCoefficients(0.05, 0.0004, 0.0));
  • kS: static friction. The constant output needed to start moving.
  • kV: the output per unit of velocity.
  • kA: the output per unit of acceleration.

#The Model

Java
output = kS * sign(velocity) + kV * velocity + kA * acceleration

#Voltage Compensation

Every constructor has a version that also takes the HardwareMap. In that case the controller reads the battery voltage and divides the result by it, so the output is a motor power fraction that stays consistent while the battery drains:

Java
EasyFFController compensated = new EasyFFController(0.05, 0.0004, hardwareMap);

Without the HardwareMap, the controller returns the raw value from the model. isVoltageCompensated() tells which mode is active.

#Calculating

  • calculate(velocity): the output for a velocity, with zero acceleration.
  • calculate(velocity, acceleration): the output for a velocity and an acceleration.
  • getCoefficients(): the EasyFFCoefficients used by the controller.

#Achievable Limits

These methods tell what the model can reach with a given maximum voltage:

  • maxAchievableVelocity(maxVoltage, acceleration)
  • minAchievableVelocity(maxVoltage, acceleration)
  • maxAchievableAcceleration(maxVoltage, velocity)
  • minAchievableAcceleration(maxVoltage, velocity)

#Using It With Motors

Java
shooter.setVelocityFF(ff);
shooter.setVelocityFF(0.05, 0.0004);
shooter.setVelocityPIDF(0.002, 0, 0, 0.0004);

Feedforward gives the first estimate and the PID corrects what remains. Tune kS and kV first, then add feedback.

Última atualização 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.