Class PositionFeedforwardController

java.lang.Object
com.stuypulse.stuylib.control.Controller
com.stuypulse.stuylib.control.feedforward.PositionFeedforwardController

public class PositionFeedforwardController extends Controller
A positional controller that uses a feedforward model to calculate motor outputs given positional setpoints.

The feedforward model takes in velocity setpoints, so the derivative of the positional setpoints must be calculated. This is done implicitly by this controller though.

  • Constructor Details

    • PositionFeedforwardController

      public PositionFeedforwardController(MotorFeedforward feedforward)
      Create a position controller with a feedforward model
      Parameters:
      feedforward - feedforward model
  • Method Details

    • calculate

      protected double calculate(double setpoint, double measurement)
      Calculates a motor output by feeding the derivative of a positional setpoint to a feedforward model
      Specified by:
      calculate in class Controller
      Parameters:
      setpoint - positional setpoint
      measurement - position measurement, which is not used by the feedforward model
      Returns:
      motor output from feedforward model