Class ArmFeedforward

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

public class ArmFeedforward extends Controller
A feedforward term to account for gravity for motorized arms.

The motor feedforward used in the context of an arm will not account for gravity that is acting on the arm.

Can be paired with MotorFeedforward or other controllers with .add

  • Constructor Details

    • ArmFeedforward

      public ArmFeedforward(Number kG)
      Create arm feedforward
      Parameters:
      kG - term to hold arm vertical against gravity (volts)
    • ArmFeedforward

      public ArmFeedforward(Number kG, IFilter cosine)
      Create arm feedforward
      Parameters:
      kG - term to hold arm vertical against gravity (volts)
      cosine - function to calculate cosine of setpoint
  • Method Details

    • calculate

      protected double calculate(double setpoint, double measurement)
      Calculates voltage to hold arm at the setpoint angle
      Specified by:
      calculate in class Controller
      Parameters:
      setpoint - setpoint
      measurement - measurement
      Returns:
      kG * cos(setpoint)