Interface FeedbackController

All Known Implementing Classes:
ComposedFeedbackController, PID

public interface FeedbackController
Interface for the feedback (past state-dependent and -varying) controllers of the library.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final double
     
    static final double
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns whether the controller has reached the setpoint with minimal velocity.
    double
    calculate(double measurement)
    Returns an output from the controller with the default robot loop time.
    double
    calculate(double measurement, double dt)
    Returns an output from the controller with a given dt.
    double
    Returns the last output of the controller without updating with a new value.
    double
    Returns the current setpoint (target) of the controller.
    void
    Resets the controller.
    void
    setSetpoint(double newSetpoint)
    Sets the setpoint (target) of the controller.
    void
    setSetpointTolerance(double positionErrorProportion, double velocityErrorProportion)
    Sets the maximum error of both position and velocity allowed for atSetpoint() to return true.
  • Field Details

    • defaultPositionErrorToleranceProportion

      static final double defaultPositionErrorToleranceProportion
      See Also:
    • defaultVelocityErrorToleranceProportion

      static final double defaultVelocityErrorToleranceProportion
      See Also:
  • Method Details

    • reset

      void reset()
      Resets the controller.
    • setSetpoint

      void setSetpoint(double newSetpoint)
      Sets the setpoint (target) of the controller.
      Parameters:
      newSetpoint - The new target of the controller.
    • getSetpoint

      double getSetpoint()
      Returns the current setpoint (target) of the controller.
      Returns:
      The current setpoint.
    • setSetpointTolerance

      void setSetpointTolerance(double positionErrorProportion, double velocityErrorProportion)
      Sets the maximum error of both position and velocity allowed for atSetpoint() to return true.
      Parameters:
      positionErrorProportion - The maximum allowed position error, as a proportion of the setpoint.
      velocityErrorProportion - The maximum allowed absolute velocity per second, as a proportion of the setpoint / second.
    • calculate

      double calculate(double measurement)
      Returns an output from the controller with the default robot loop time.

      This must be called at a rate of once every robot loop to be consistent.

      Parameters:
      measurement - The value of the measured feedback.
      Returns:
      The output of the controller.
    • calculate

      double calculate(double measurement, double dt)
      Returns an output from the controller with a given dt.
      Parameters:
      measurement - The value of the measured feedback.
      dt - The time, in seconds, since the last update of this controller.
      Returns:
      The output of the controller.
    • getCurrentValue

      double getCurrentValue()
      Returns the last output of the controller without updating with a new value.
      Returns:
      The last ouptut of the controller.
    • atSetpoint

      boolean atSetpoint()
      Returns whether the controller has reached the setpoint with minimal velocity.
      Returns:
      Whether the controller is within the minimum position and velocity errors.