Class CompoundController

java.lang.Object
com.cdarobotics.cdalib.controllers.Controller
com.cdarobotics.cdalib.controllers.CompoundController

public class CompoundController extends Controller
A Controller that combines several sub-controllers, summing their outputs each loop. Typically used to add a feedforward term to a PID feedback term (e.g. PIDController plus FFController).

Note that each sub-controller keeps its own Controller.target; setting the target on this compound controller does not propagate to the sub-controllers.

  • Constructor Details

    • CompoundController

      public CompoundController(double target, Controller... controllers)
      Parameters:
      target - the initial setpoint of the compound controller itself
      controllers - the sub-controllers whose outputs are summed each update
  • Method Details

    • update

      public double update(double current, double dt)
      Description copied from class: Controller
      Computes the control output for this loop.
      Specified by:
      update in class Controller
      Parameters:
      current - the current measured value
      dt - the time elapsed since the previous update, in seconds
      Returns:
      the control output to apply