Class AngleController

java.lang.Object
com.stuypulse.stuylib.control.angle.AngleController
Direct Known Subclasses:
AngleArmFeedforward, AngleControllerGroup, AnglePIDController, AnglePositionFeedforwardController

public abstract class AngleController extends Object
Base class of controller classes of continuous systems. This means that both the setpoint and measurement are angles, as opposed to just numbers.

Other than this, works the same as the Controller class.

See Also:
  • Constructor Details

    • AngleController

      public AngleController()
      Default initialization of an angle controller
  • Method Details

    • setSetpointFilter

      public final AngleController setSetpointFilter(AFilter... setpointFilter)
      Set the setpoint filter of the controller
      Parameters:
      setpointFilter - angular setpoint filters
      Returns:
      reference to the controller
    • setMeasurementFilter

      public final AngleController setMeasurementFilter(AFilter... measurementFilter)
      Set the measurement filter of the controller
      Parameters:
      measurementFilter - angular measurement filters
      Returns:
      reference to the controller
    • setOutputFilter

      public final AngleController setOutputFilter(IFilter... outputFilter)
      Set the output filter of the controller
      Parameters:
      outputFilter - output filters
      Returns:
      reference to the controller
    • getSetpoint

      public final Angle getSetpoint()
      Returns:
      the most recent setpoint of the controller
    • getMeasurement

      public final Angle getMeasurement()
      Returns:
      the most recent measurement of the controller
    • getOutput

      public final double getOutput()
      Returns:
      the most recent output of the controller
    • getError

      public final Angle getError()
      Returns:
      the most recent error of the controller
    • isDoneRadians

      public final boolean isDoneRadians(double acceptableError)
      Determines if the controller is finished based on an acceptable radian error.
      Parameters:
      acceptableError - acceptable error for the controller
      Returns:
      whether or not the controller is done
    • isDoneDegrees

      public final boolean isDoneDegrees(double acceptableError)
      Determines if the controller is finished based on an acceptable degree error.
      Parameters:
      acceptableError - acceptable error for the controller
      Returns:
      whether or not the controller is done
    • add

      public final AngleControllerGroup add(AngleController... other)
      Combines this controller into a group with other controllers that share the same setpoint and measurement.
      Parameters:
      other - the other controllers
      Returns:
      the group of controllers that
    • update

      public final double update(Angle setpoint, Angle measurement)
      Updates the state of the controller.

      Applies filters to setpoint and measurement, calculates output with filtered values, filters and returns output

      Parameters:
      setpoint - setpoint of the variable being controlled
      measurement - measurement of the variable being controlled
      Returns:
      the final output
    • calculate

      protected abstract double calculate(Angle setpoint, Angle measurement)
      Calculates the output of the controller given a setpoint and measurement.
      Parameters:
      setpoint - setpoint
      measurement - measurement
      Returns:
      calculated output