Interface SparkMaxPIDController

    • Method Summary

      All Methods Instance Methods Abstract Methods Deprecated Methods 
      Modifier and Type Method Description
      double getD()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Get the Derivative Gain constant of the PIDF controller on the SPARK MAX.
      double getD​(int slotID)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Get the Derivative Gain constant of the PIDF controller on the SPARK MAX.
      double getDFilter​(int slotID)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Get the Derivative Filter constant of the PIDF controller on the SPARK MAX.
      double getFF()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Get the Feed-forward Gain constant of the PIDF controller on the SPARK MAX.
      double getFF​(int slotID)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Get the Feed-forward Gain constant of the PIDF controller on the SPARK MAX.
      double getI()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Get the Integral Gain constant of the PIDF controller on the SPARK MAX.
      double getI​(int slotID)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Get the Integral Gain constant of the PIDF controller on the SPARK MAX.
      double getIAccum()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Get the I accumulator of the PID controller.
      double getIMaxAccum​(int slotID)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Get the maximum I accumulator of the PID controller.
      double getIZone()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Get the IZone constant of the PIDF controller on the SPARK MAX.
      double getIZone​(int slotID)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Get the IZone constant of the PIDF controller on the SPARK MAX.
      double getOutputMax()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Get the max output of the PIDF controller on the SPARK MAX.
      double getOutputMax​(int slotID)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Get the max output of the PIDF controller on the SPARK MAX.
      double getOutputMin()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Get the min output of the PIDF controller on the SPARK MAX.
      double getOutputMin​(int slotID)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Get the min output of the PIDF controller on the SPARK MAX.
      double getP()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Get the Proportional Gain constant of the PIDF controller on the SPARK MAX.
      double getP​(int slotID)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Get the Proportional Gain constant of the PIDF controller on the SPARK MAX.
      boolean getPositionPIDWrappingEnabled()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Get whether or not PID Wrapping for position closed loop control is enabled
      double getPositionPIDWrappingMaxInput()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Get the maximum input value for PID Wrapping with position closed loop control
      double getPositionPIDWrappingMinInput()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Get the minimum input value for PID Wrapping with position closed loop control
      SparkPIDController.AccelStrategy getSmartMotionAccelStrategy​(int slotID)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Get the acceleration strategy used to control acceleration on the motor.
      double getSmartMotionAllowedClosedLoopError​(int slotID)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Get the allowed closed loop error of SmartMotion mode.
      double getSmartMotionMaxAccel​(int slotID)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Get the maximum acceleration of the SmartMotion mode.
      double getSmartMotionMaxVelocity​(int slotID)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Get the maximum velocity of the SmartMotion mode.
      double getSmartMotionMinOutputVelocity​(int slotID)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Get the mimimum velocity of the SmartMotion mode.
      REVLibError setD​(double gain)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set the Derivative Gain constant of the PIDF controller on the SPARK MAX.
      REVLibError setD​(double gain, int slotID)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set the Derivative Gain constant of the PIDF controller on the SPARK MAX.
      REVLibError setDFilter​(double gain)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set the Derivative Filter constant of the PIDF controller on the SPARK MAX.
      REVLibError setDFilter​(double gain, int slotID)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set the Derivative Filter constant of the PIDF controller on the SPARK MAX.
      REVLibError setFeedbackDevice​(CANSensor sensor)
      Deprecated, for removal: This API element is subject to removal in a future version.
      REVLibError setFeedbackDevice​(MotorFeedbackSensor sensor)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set the controller's feedback device
      REVLibError setFF​(double gain)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set the Feed-forward Gain constant of the PIDF controller on the SPARK MAX.
      REVLibError setFF​(double gain, int slotID)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set the Feed-forward Gain constant of the PIDF controller on the SPARK MAX.
      REVLibError setI​(double gain)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set the Integral Gain constant of the PIDF controller on the SPARK MAX.
      REVLibError setI​(double gain, int slotID)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set the Integral Gain constant of the PIDF controller on the SPARK MAX.
      REVLibError setIAccum​(double iAccum)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set the I accumulator of the PID controller.
      REVLibError setIMaxAccum​(double iMaxAccum, int slotID)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Configure the maximum I accumulator of the PID controller.
      REVLibError setIZone​(double IZone)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set the IZone range of the PIDF controller on the SPARK MAX.
      REVLibError setIZone​(double IZone, int slotID)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set the IZone range of the PIDF controller on the SPARK MAX.
      REVLibError setOutputRange​(double min, double max)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set the min amd max output for the closed loop mode.
      REVLibError setOutputRange​(double min, double max, int slotID)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set the min amd max output for the closed loop mode.
      REVLibError setP​(double gain)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set the Proportional Gain constant of the PIDF controller on the SPARK MAX.
      REVLibError setP​(double gain, int slotID)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set the Proportional Gain constant of the PIDF controller on the SPARK MAX.
      REVLibError setPositionPIDWrappingEnabled​(boolean enable)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Enable or disable PID Wrapping for position closed loop control
      REVLibError setPositionPIDWrappingMaxInput​(double max)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set the maximum input value for PID Wrapping with position closed loop control
      REVLibError setPositionPIDWrappingMinInput​(double min)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set the minimum input value for PID Wrapping with position closed loop control
      REVLibError setReference​(double value, CANSparkBase.ControlType ctrl)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set the controller reference value based on the selected control mode.
      REVLibError setReference​(double value, CANSparkBase.ControlType ctrl, int pidSlot)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set the controller reference value based on the selected control mode.
      REVLibError setReference​(double value, CANSparkBase.ControlType ctrl, int pidSlot, double arbFeedforward)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set the controller reference value based on the selected control mode.
      REVLibError setReference​(double value, CANSparkBase.ControlType ctrl, int pidSlot, double arbFeedforward, SparkMaxPIDController.ArbFFUnits arbFFUnits)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set the controller reference value based on the selected control mode.
      REVLibError setReference​(double value, ControlType ctrl)
      Deprecated, for removal: This API element is subject to removal in a future version.
      REVLibError setReference​(double value, ControlType ctrl, int pidSlot)
      Deprecated, for removal: This API element is subject to removal in a future version.
      REVLibError setReference​(double value, ControlType ctrl, int pidSlot, double arbFeedforward)
      Deprecated, for removal: This API element is subject to removal in a future version.
      REVLibError setReference​(double value, ControlType ctrl, int pidSlot, double arbFeedforward, CANPIDController.ArbFFUnits arbFFUnits)
      Deprecated, for removal: This API element is subject to removal in a future version.
      REVLibError setSmartMotionAccelStrategy​(CANPIDController.AccelStrategy accelStrategy, int slotID)
      Deprecated, for removal: This API element is subject to removal in a future version.
      REVLibError setSmartMotionAccelStrategy​(SparkMaxPIDController.AccelStrategy accelStrategy, int slotID)
      Deprecated, for removal: This API element is subject to removal in a future version.
      NOTE: As of the 2022 FRC season, the firmware only supports the trapezoidal motion profiling acceleration strategy.
      REVLibError setSmartMotionAllowedClosedLoopError​(double allowedErr, int slotID)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Configure the allowed closed loop error of SmartMotion mode.
      REVLibError setSmartMotionMaxAccel​(double maxAccel, int slotID)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Configure the maximum acceleration of the SmartMotion mode.
      REVLibError setSmartMotionMaxVelocity​(double maxVel, int slotID)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Configure the maximum velocity of the SmartMotion mode.
      REVLibError setSmartMotionMinOutputVelocity​(double minVel, int slotID)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Configure the mimimum velocity of the SmartMotion mode.
    • Method Detail

      • setReference

        REVLibError setReference​(double value,
                                 CANSparkBase.ControlType ctrl)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Set the controller reference value based on the selected control mode.
        Specified by:
        setReference in interface CANPIDController
        Parameters:
        value - The value to set depending on the control mode. For basic duty cycle control this should be a value between -1 and 1 Otherwise: Voltage Control: Voltage (volts) Velocity Control: Velocity (RPM) Position Control: Position (Rotations) Current Control: Current (Amps). Native units can be changed using the setPositionConversionFactor() or setVelocityConversionFactor() methods of the CANEncoder class
        ctrl - the control type
        Returns:
        REVLibError.kOk if successful
      • setReference

        @Deprecated(forRemoval=true)
        REVLibError setReference​(double value,
                                 ControlType ctrl)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Set the controller reference value based on the selected control mode.
        Specified by:
        setReference in interface CANPIDController
        Parameters:
        value - The value to set depending on the control mode. For basic duty cycle control this should be a value between -1 and 1 Otherwise: Voltage Control: Voltage (volts) Velocity Control: Velocity (RPM) Position Control: Position (Rotations) Current Control: Current (Amps). Native units can be changed using the setPositionConversionFactor() or setVelocityConversionFactor() methods of the CANEncoder class
        ctrl - the control type
        Returns:
        REVLibError.kOk if successful
      • setReference

        REVLibError setReference​(double value,
                                 CANSparkBase.ControlType ctrl,
                                 int pidSlot)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Set the controller reference value based on the selected control mode. This will override the pre-programmed control mode but not change what is programmed to the controller.
        Specified by:
        setReference in interface CANPIDController
        Parameters:
        value - The value to set depending on the control mode. For basic duty cycle control this should be a value between -1 and 1 Otherwise: Voltage Control: Voltage (volts) Velocity Control: Velocity (RPM) Position Control: Position (Rotations) Current Control: Current (Amps). Native units can be changed using the setPositionConversionFactor() or setVelocityConversionFactor() methods of the CANEncoder class
        ctrl - Is the control type to override with
        pidSlot - for this command
        Returns:
        REVLibError.kOk if successful
      • setReference

        @Deprecated(forRemoval=true)
        REVLibError setReference​(double value,
                                 ControlType ctrl,
                                 int pidSlot)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Set the controller reference value based on the selected control mode. This will override the pre-programmed control mode but not change what is programmed to the controller.
        Specified by:
        setReference in interface CANPIDController
        Parameters:
        value - The value to set depending on the control mode. For basic duty cycle control this should be a value between -1 and 1 Otherwise: Voltage Control: Voltage (volts) Velocity Control: Velocity (RPM) Position Control: Position (Rotations) Current Control: Current (Amps). Native units can be changed using the setPositionConversionFactor() or setVelocityConversionFactor() methods of the CANEncoder class
        ctrl - Is the control type to override with
        pidSlot - for this command
        Returns:
        REVLibError.kOk if successful
      • setReference

        REVLibError setReference​(double value,
                                 CANSparkBase.ControlType ctrl,
                                 int pidSlot,
                                 double arbFeedforward)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Set the controller reference value based on the selected control mode. This will override the pre-programmed control mode but not change what is programmed to the controller.
        Specified by:
        setReference in interface CANPIDController
        Parameters:
        value - The value to set depending on the control mode. For basic duty cycle control this should be a value between -1 and 1 Otherwise: Voltage Control: Voltage (volts) Velocity Control: Velocity (RPM) Position Control: Position (Rotations) Current Control: Current (Amps). Native units can be changed using the setPositionConversionFactor() or setVelocityConversionFactor() methods of the CANEncoder class
        ctrl - Is the control type to override with
        pidSlot - for this command
        arbFeedforward - A value from which is represented in voltage applied to the motor after the result of the specified control mode. The units for the parameter is Volts. This value is set after the control mode, but before any current limits or ramp rates.
        Returns:
        REVLibError.kOk if successful
      • setReference

        @Deprecated(forRemoval=true)
        REVLibError setReference​(double value,
                                 ControlType ctrl,
                                 int pidSlot,
                                 double arbFeedforward)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Set the controller reference value based on the selected control mode. This will override the pre-programmed control mode but not change what is programmed to the controller.
        Specified by:
        setReference in interface CANPIDController
        Parameters:
        value - The value to set depending on the control mode. For basic duty cycle control this should be a value between -1 and 1 Otherwise: Voltage Control: Voltage (volts) Velocity Control: Velocity (RPM) Position Control: Position (Rotations) Current Control: Current (Amps). Native units can be changed using the setPositionConversionFactor() or setVelocityConversionFactor() methods of the CANEncoder class
        ctrl - Is the control type to override with
        pidSlot - for this command
        arbFeedforward - A value from which is represented in voltage applied to the motor after the result of the specified control mode. The units for the parameter is Volts. This value is set after the control mode, but before any current limits or ramp rates.
        Returns:
        REVLibError.kOk if successful
      • setReference

        REVLibError setReference​(double value,
                                 CANSparkBase.ControlType ctrl,
                                 int pidSlot,
                                 double arbFeedforward,
                                 SparkMaxPIDController.ArbFFUnits arbFFUnits)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Set the controller reference value based on the selected control mode. This will override the pre-programmed control mode but not change what is programmed to the controller.
        Specified by:
        setReference in interface CANPIDController
        Parameters:
        value - The value to set depending on the control mode. For basic duty cycle control this should be a value between -1 and 1 Otherwise: Voltage Control: Voltage (volts) Velocity Control: Velocity (RPM) Position Control: Position (Rotations) Current Control: Current (Amps). Native units can be changed using the setPositionConversionFactor() or setVelocityConversionFactor() methods of the CANEncoder class
        ctrl - Is the control type to override with
        pidSlot - for this command
        arbFeedforward - A value from which is represented in voltage applied to the motor after the result of the specified control mode. The units for the parameter is Volts. This value is set after the control mode, but before any current limits or ramp rates.
        arbFFUnits - The units the arbitrary feed forward term is in
        Returns:
        REVLibError.kOk if successful
      • setReference

        @Deprecated(forRemoval=true)
        REVLibError setReference​(double value,
                                 ControlType ctrl,
                                 int pidSlot,
                                 double arbFeedforward,
                                 CANPIDController.ArbFFUnits arbFFUnits)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Set the controller reference value based on the selected control mode. This will override the pre-programmed control mode but not change what is programmed to the controller.
        Specified by:
        setReference in interface CANPIDController
        Parameters:
        value - The value to set depending on the control mode. For basic duty cycle control this should be a value between -1 and 1 Otherwise: Voltage Control: Voltage (volts) Velocity Control: Velocity (RPM) Position Control: Position (Rotations) Current Control: Current (Amps). Native units can be changed using the setPositionConversionFactor() or setVelocityConversionFactor() methods of the CANEncoder class
        ctrl - Is the control type to override with
        pidSlot - for this command
        arbFeedforward - A value from which is represented in voltage applied to the motor after the result of the specified control mode. The units for the parameter is Volts. This value is set after the control mode, but before any current limits or ramp rates.
        arbFFUnits - The units the arbitrary feed forward term is in
        Returns:
        REVLibError.kOk if successful
      • setP

        REVLibError setP​(double gain)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Set the Proportional Gain constant of the PIDF controller on the SPARK MAX. This uses the Set Parameter API and should be used infrequently. The parameter does not presist unless burnFlash() is called. The recommended method to configure this parameter is use to SPARK MAX GUI to tune and save parameters.
        Specified by:
        setP in interface CANPIDController
        Parameters:
        gain - The proportional gain value, must be positive
        Returns:
        REVLibError.kOk if successful
      • setP

        REVLibError setP​(double gain,
                         int slotID)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Set the Proportional Gain constant of the PIDF controller on the SPARK MAX. This uses the Set Parameter API and should be used infrequently. The parameter does not presist unless burnFlash() is called. The recommended method to configure this parameter is use to SPARK MAX GUI to tune and save parameters.
        Specified by:
        setP in interface CANPIDController
        Parameters:
        gain - The proportional gain value, must be positive
        slotID - Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference().
        Returns:
        REVLibError.kOk if successful
      • setI

        REVLibError setI​(double gain)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Set the Integral Gain constant of the PIDF controller on the SPARK MAX. This uses the Set Parameter API and should be used infrequently. The parameter does not presist unless burnFlash() is called. The recommended method to configure this parameter is use to SPARK MAX GUI to tune and save parameters.
        Specified by:
        setI in interface CANPIDController
        Parameters:
        gain - The integral gain value, must be positive
        Returns:
        REVLibError.kOk if successful
      • setI

        REVLibError setI​(double gain,
                         int slotID)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Set the Integral Gain constant of the PIDF controller on the SPARK MAX. This uses the Set Parameter API and should be used infrequently. The parameter does not presist unless burnFlash() is called. The recommended method to configure this parameter is use to SPARK MAX GUI to tune and save parameters.
        Specified by:
        setI in interface CANPIDController
        Parameters:
        gain - The integral gain value, must be positive
        slotID - Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference().
        Returns:
        REVLibError.kOk if successful
      • setD

        REVLibError setD​(double gain)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Set the Derivative Gain constant of the PIDF controller on the SPARK MAX. This uses the Set Parameter API and should be used infrequently. The parameter does not presist unless burnFlash() is called. The recommended method to configure this parameter is use to SPARK MAX GUI to tune and save parameters.
        Specified by:
        setD in interface CANPIDController
        Parameters:
        gain - The derivative gain value, must be positive
        Returns:
        REVLibError.kOk if successful
      • setD

        REVLibError setD​(double gain,
                         int slotID)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Set the Derivative Gain constant of the PIDF controller on the SPARK MAX. This uses the Set Parameter API and should be used infrequently. The parameter does not presist unless burnFlash() is called. The recommended method to configure this parameter is use to SPARK MAX GUI to tune and save parameters.
        Specified by:
        setD in interface CANPIDController
        Parameters:
        gain - The derivative gain value, must be positive
        slotID - Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference().
        Returns:
        REVLibError.kOk if successful
      • setDFilter

        REVLibError setDFilter​(double gain)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Set the Derivative Filter constant of the PIDF controller on the SPARK MAX. This uses the Set Parameter API and should be used infrequently. The parameter does not presist unless burnFlash() is called.
        Specified by:
        setDFilter in interface CANPIDController
        Parameters:
        gain - The derivative filter value, must be a positive number between 0 and 1
        Returns:
        REVLibError.kOk if successful
      • setDFilter

        REVLibError setDFilter​(double gain,
                               int slotID)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Set the Derivative Filter constant of the PIDF controller on the SPARK MAX. This uses the Set Parameter API and should be used infrequently. The parameter does not presist unless burnFlash() is called.
        Specified by:
        setDFilter in interface CANPIDController
        Parameters:
        gain - The derivative filter value, must be a positive number between 0 and 1
        slotID - Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference().
        Returns:
        REVLibError.kOk if successful
      • setFF

        REVLibError setFF​(double gain)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Set the Feed-forward Gain constant of the PIDF controller on the SPARK MAX. This uses the Set Parameter API and should be used infrequently. The parameter does not presist unless burnFlash() is called. The recommended method to configure this parameter is use to SPARK MAX GUI to tune and save parameters.
        Specified by:
        setFF in interface CANPIDController
        Parameters:
        gain - The feed-forward gain value
        Returns:
        REVLibError.kOk if successful
      • setFF

        REVLibError setFF​(double gain,
                          int slotID)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Set the Feed-forward Gain constant of the PIDF controller on the SPARK MAX. This uses the Set Parameter API and should be used infrequently. The parameter does not presist unless burnFlash() is called. The recommended method to configure this parameter is use to SPARK MAX GUI to tune and save parameters.
        Specified by:
        setFF in interface CANPIDController
        Parameters:
        gain - The feed-forward gain value
        slotID - Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference().
        Returns:
        REVLibError.kOk if successful
      • setIZone

        REVLibError setIZone​(double IZone)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Set the IZone range of the PIDF controller on the SPARK MAX. This value specifies the range the |error| must be within for the integral constant to take effect.

        This uses the Set Parameter API and should be used infrequently. The parameter does not presist unless burnFlash() is called. The recommended method to configure this parameter is to use the SPARK MAX GUI to tune and save parameters.

        Specified by:
        setIZone in interface CANPIDController
        Parameters:
        IZone - The IZone value, must be positive. Set to 0 to disable
        Returns:
        REVLibError.kOk if successful
      • setIZone

        REVLibError setIZone​(double IZone,
                             int slotID)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Set the IZone range of the PIDF controller on the SPARK MAX. This value specifies the range the |error| must be within for the integral constant to take effect.

        This uses the Set Parameter API and should be used infrequently. The parameter does not presist unless burnFlash() is called. The recommended method to configure this parameter is to use the SPARK MAX GUI to tune and save parameters.

        Specified by:
        setIZone in interface CANPIDController
        Parameters:
        IZone - The IZone value, must be positive. Set to 0 to disable
        slotID - Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference().
        Returns:
        REVLibError.kOk if successful
      • setOutputRange

        REVLibError setOutputRange​(double min,
                                   double max)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Set the min amd max output for the closed loop mode.

        This uses the Set Parameter API and should be used infrequently. The parameter does not presist unless burnFlash() is called. The recommended method to configure this parameter is to use the SPARK MAX GUI to tune and save parameters.

        Specified by:
        setOutputRange in interface CANPIDController
        Parameters:
        min - Reverse power minimum to allow the controller to output
        max - Forward power maximum to allow the controller to output
        Returns:
        REVLibError.kOk if successful
      • setOutputRange

        REVLibError setOutputRange​(double min,
                                   double max,
                                   int slotID)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Set the min amd max output for the closed loop mode.

        This uses the Set Parameter API and should be used infrequently. The parameter does not presist unless burnFlash() is called. The recommended method to configure this parameter is to use the SPARK MAX GUI to tune and save parameters.

        Specified by:
        setOutputRange in interface CANPIDController
        Parameters:
        min - Reverse power minimum to allow the controller to output
        max - Forward power maximum to allow the controller to output
        slotID - Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference().
        Returns:
        REVLibError.kOk if successful
      • getP

        double getP()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Get the Proportional Gain constant of the PIDF controller on the SPARK MAX.

        This uses the Get Parameter API and should be used infrequently. This function uses a non-blocking call and will return a cached value if the parameter is not returned by the timeout. The timeout can be changed by calling SetCANTimeout(int milliseconds)

        Specified by:
        getP in interface CANPIDController
        Returns:
        double P Gain value
      • getP

        double getP​(int slotID)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Get the Proportional Gain constant of the PIDF controller on the SPARK MAX.

        This uses the Get Parameter API and should be used infrequently. This function uses a non-blocking call and will return a cached value if the parameter is not returned by the timeout. The timeout can be changed by calling SetCANTimeout(int milliseconds)

        Specified by:
        getP in interface CANPIDController
        Parameters:
        slotID - Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference().
        Returns:
        double P Gain value
      • getI

        double getI()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Get the Integral Gain constant of the PIDF controller on the SPARK MAX.

        This uses the Get Parameter API and should be used infrequently. This function uses a non-blocking call and will return a cached value if the parameter is not returned by the timeout. The timeout can be changed by calling SetCANTimeout(int milliseconds)

        Specified by:
        getI in interface CANPIDController
        Returns:
        double I Gain value
      • getI

        double getI​(int slotID)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Get the Integral Gain constant of the PIDF controller on the SPARK MAX.

        This uses the Get Parameter API and should be used infrequently. This function uses a non-blocking call and will return a cached value if the parameter is not returned by the timeout. The timeout can be changed by calling SetCANTimeout(int milliseconds)

        Specified by:
        getI in interface CANPIDController
        Parameters:
        slotID - Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference().
        Returns:
        double I Gain value
      • getD

        double getD()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Get the Derivative Gain constant of the PIDF controller on the SPARK MAX.

        This uses the Get Parameter API and should be used infrequently. This function uses a non-blocking call and will return a cached value if the parameter is not returned by the timeout. The timeout can be changed by calling SetCANTimeout(int milliseconds)

        Specified by:
        getD in interface CANPIDController
        Returns:
        double D Gain value
      • getD

        double getD​(int slotID)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Get the Derivative Gain constant of the PIDF controller on the SPARK MAX.

        This uses the Get Parameter API and should be used infrequently. This function uses a non-blocking call and will return a cached value if the parameter is not returned by the timeout. The timeout can be changed by calling SetCANTimeout(int milliseconds)

        Specified by:
        getD in interface CANPIDController
        Parameters:
        slotID - Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference().
        Returns:
        double D Gain value
      • getDFilter

        double getDFilter​(int slotID)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Get the Derivative Filter constant of the PIDF controller on the SPARK MAX.

        This uses the Get Parameter API and should be used infrequently. This function uses a non-blocking call and will return a cached value if the parameter is not returned by the timeout. The timeout can be changed by calling SetCANTimeout(int milliseconds)

        Specified by:
        getDFilter in interface CANPIDController
        Parameters:
        slotID - Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference().
        Returns:
        double D Filter value
      • getFF

        double getFF()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Get the Feed-forward Gain constant of the PIDF controller on the SPARK MAX.

        This uses the Get Parameter API and should be used infrequently. This function uses a non-blocking call and will return a cached value if the parameter is not returned by the timeout. The timeout can be changed by calling SetCANTimeout(int milliseconds)

        Specified by:
        getFF in interface CANPIDController
        Returns:
        double F Gain value
      • getFF

        double getFF​(int slotID)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Get the Feed-forward Gain constant of the PIDF controller on the SPARK MAX.

        This uses the Get Parameter API and should be used infrequently. This function uses a non-blocking call and will return a cached value if the parameter is not returned by the timeout. The timeout can be changed by calling SetCANTimeout(int milliseconds)

        Specified by:
        getFF in interface CANPIDController
        Parameters:
        slotID - Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference().
        Returns:
        double F Gain value
      • getIZone

        double getIZone()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Get the IZone constant of the PIDF controller on the SPARK MAX.

        This uses the Get Parameter API and should be used infrequently. This function uses a non-blocking call and will return a cached value if the parameter is not returned by the timeout. The timeout can be changed by calling SetCANTimeout(int milliseconds)

        Specified by:
        getIZone in interface CANPIDController
        Returns:
        double IZone value
      • getIZone

        double getIZone​(int slotID)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Get the IZone constant of the PIDF controller on the SPARK MAX.

        This uses the Get Parameter API and should be used infrequently. This function uses a non-blocking call and will return a cached value if the parameter is not returned by the timeout. The timeout can be changed by calling SetCANTimeout(int milliseconds)

        Specified by:
        getIZone in interface CANPIDController
        Parameters:
        slotID - Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference().
        Returns:
        double IZone value
      • getOutputMin

        double getOutputMin()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Get the min output of the PIDF controller on the SPARK MAX.

        This uses the Get Parameter API and should be used infrequently. This function uses a non-blocking call and will return a cached value if the parameter is not returned by the timeout. The timeout can be changed by calling SetCANTimeout(int milliseconds)

        Specified by:
        getOutputMin in interface CANPIDController
        Returns:
        double min value
      • getOutputMin

        double getOutputMin​(int slotID)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Get the min output of the PIDF controller on the SPARK MAX.

        This uses the Get Parameter API and should be used infrequently. This function uses a non-blocking call and will return a cached value if the parameter is not returned by the timeout. The timeout can be changed by calling SetCANTimeout(int milliseconds)

        Specified by:
        getOutputMin in interface CANPIDController
        Parameters:
        slotID - Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference().
        Returns:
        double min value
      • getOutputMax

        double getOutputMax()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Get the max output of the PIDF controller on the SPARK MAX.

        This uses the Get Parameter API and should be used infrequently. This function uses a non-blocking call and will return a cached value if the parameter is not returned by the timeout. The timeout can be changed by calling SetCANTimeout(int milliseconds)

        Specified by:
        getOutputMax in interface CANPIDController
        Returns:
        double max value
      • getOutputMax

        double getOutputMax​(int slotID)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Get the max output of the PIDF controller on the SPARK MAX.

        This uses the Get Parameter API and should be used infrequently. This function uses a non-blocking call and will return a cached value if the parameter is not returned by the timeout. The timeout can be changed by calling SetCANTimeout(int milliseconds)

        Specified by:
        getOutputMax in interface CANPIDController
        Parameters:
        slotID - Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference().
        Returns:
        double max value
      • setSmartMotionMaxVelocity

        REVLibError setSmartMotionMaxVelocity​(double maxVel,
                                              int slotID)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Configure the maximum velocity of the SmartMotion mode. This is the velocity that is reached in the middle of the profile and is what the motor should spend most of its time at
        Specified by:
        setSmartMotionMaxVelocity in interface CANPIDController
        Parameters:
        maxVel - The maxmimum cruise velocity for the motion profile in RPM
        slotID - Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference().
        Returns:
        REVLibError.kOk if successful
      • setSmartMotionMaxAccel

        REVLibError setSmartMotionMaxAccel​(double maxAccel,
                                           int slotID)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Configure the maximum acceleration of the SmartMotion mode. This is the accleration that the motor velocity will increase at until the max velocity is reached
        Specified by:
        setSmartMotionMaxAccel in interface CANPIDController
        Parameters:
        maxAccel - The maxmimum acceleration for the motion profile in RPM per second
        slotID - Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference().
        Returns:
        REVLibError.kOk if successful
      • setSmartMotionMinOutputVelocity

        REVLibError setSmartMotionMinOutputVelocity​(double minVel,
                                                    int slotID)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Configure the mimimum velocity of the SmartMotion mode. Any requested velocities below this value will be set to 0.
        Specified by:
        setSmartMotionMinOutputVelocity in interface CANPIDController
        Parameters:
        minVel - The minimum velocity for the motion profile in RPM
        slotID - Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference().
        Returns:
        REVLibError.kOk if successful
      • setSmartMotionAllowedClosedLoopError

        REVLibError setSmartMotionAllowedClosedLoopError​(double allowedErr,
                                                         int slotID)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Configure the allowed closed loop error of SmartMotion mode. This value is how much deviation from your setpoint is tolerated and is useful in preventing oscillation around your setpoint.
        Specified by:
        setSmartMotionAllowedClosedLoopError in interface CANPIDController
        Parameters:
        allowedErr - The allowed deviation for your setpoint vs actual position in rotations
        slotID - Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference().
        Returns:
        REVLibError.kOk if successful
      • setSmartMotionAccelStrategy

        REVLibError setSmartMotionAccelStrategy​(SparkMaxPIDController.AccelStrategy accelStrategy,
                                                int slotID)
        Deprecated, for removal: This API element is subject to removal in a future version.
        NOTE: As of the 2022 FRC season, the firmware only supports the trapezoidal motion profiling acceleration strategy.

        Configure the acceleration strategy used to control acceleration on the motor.

        Parameters:
        accelStrategy - The acceleration strategy to use for the automatically generated motion profile
        slotID - Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference().
        Returns:
        REVLibError.kOk if successful
      • setSmartMotionAccelStrategy

        @Deprecated(forRemoval=true)
        REVLibError setSmartMotionAccelStrategy​(CANPIDController.AccelStrategy accelStrategy,
                                                int slotID)
        Deprecated, for removal: This API element is subject to removal in a future version.
        NOTE: As of the 2022 FRC season, the firmware only supports the trapezoidal motion profiling acceleration strategy.

        Configure the acceleration strategy used to control acceleration on the motor. The current strategy is trapezoidal motion profiling.

        Specified by:
        setSmartMotionAccelStrategy in interface CANPIDController
        Parameters:
        accelStrategy - The acceleration strategy to use for the automatically generated motion profile
        slotID - Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference().
        Returns:
        REVLibError.kOk if successful
      • getSmartMotionMaxVelocity

        double getSmartMotionMaxVelocity​(int slotID)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Get the maximum velocity of the SmartMotion mode. This is the velocity that is reached in the middle of the profile and is what the motor should spend most of its time at
        Specified by:
        getSmartMotionMaxVelocity in interface CANPIDController
        Parameters:
        slotID - Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference().
        Returns:
        The maxmimum cruise velocity for the motion profile in RPM
      • getSmartMotionMaxAccel

        double getSmartMotionMaxAccel​(int slotID)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Get the maximum acceleration of the SmartMotion mode. This is the accleration that the motor velocity will increase at until the max velocity is reached
        Specified by:
        getSmartMotionMaxAccel in interface CANPIDController
        Parameters:
        slotID - Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference().
        Returns:
        The maxmimum acceleration for the motion profile in RPM per second
      • getSmartMotionMinOutputVelocity

        double getSmartMotionMinOutputVelocity​(int slotID)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Get the mimimum velocity of the SmartMotion mode. Any requested velocities below this value will be set to 0.
        Specified by:
        getSmartMotionMinOutputVelocity in interface CANPIDController
        Parameters:
        slotID - Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference().
        Returns:
        The minimum velocity for the motion profile in RPM
      • getSmartMotionAllowedClosedLoopError

        double getSmartMotionAllowedClosedLoopError​(int slotID)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Get the allowed closed loop error of SmartMotion mode. This value is how much deviation from your setpoint is tolerated and is useful in preventing oscillation around your setpoint.
        Specified by:
        getSmartMotionAllowedClosedLoopError in interface CANPIDController
        Parameters:
        slotID - Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference().
        Returns:
        The allowed deviation for your setpoint vs actual position in rotations
      • getSmartMotionAccelStrategy

        SparkPIDController.AccelStrategy getSmartMotionAccelStrategy​(int slotID)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Get the acceleration strategy used to control acceleration on the motor. As of the 2022 FRC season, the strategy is always trapezoidal motion profiling, regardless of what the device may report.
        Specified by:
        getSmartMotionAccelStrategy in interface CANPIDController
        Parameters:
        slotID - Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference().
        Returns:
        The acceleration strategy to use for the automatically generated motion profile.
      • setIMaxAccum

        REVLibError setIMaxAccum​(double iMaxAccum,
                                 int slotID)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Configure the maximum I accumulator of the PID controller. This value is used to constrain the I accumulator to help manage integral wind-up
        Specified by:
        setIMaxAccum in interface CANPIDController
        Parameters:
        iMaxAccum - The max value to contrain the I accumulator to
        slotID - Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference().
        Returns:
        REVLibError.kOk if successful
      • getIMaxAccum

        double getIMaxAccum​(int slotID)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Get the maximum I accumulator of the PID controller. This value is used to constrain the I accumulator to help manage integral wind-up
        Specified by:
        getIMaxAccum in interface CANPIDController
        Parameters:
        slotID - Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference().
        Returns:
        The max value to contrain the I accumulator to
      • setIAccum

        REVLibError setIAccum​(double iAccum)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Set the I accumulator of the PID controller. This is useful when wishing to force a reset on the I accumulator of the PID controller. You can also preset values to see how it will respond to certain I characteristics

        To use this function, the controller must be in a closed loop control mode by calling setReference()

        Specified by:
        setIAccum in interface CANPIDController
        Parameters:
        iAccum - The value to set the I accumulator to
        Returns:
        REVLibError.kOk if successful
      • getIAccum

        double getIAccum()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Get the I accumulator of the PID controller. This is useful when wishing to see what the I accumulator value is to help with PID tuning
        Specified by:
        getIAccum in interface CANPIDController
        Returns:
        The value of the I accumulator
      • setPositionPIDWrappingEnabled

        REVLibError setPositionPIDWrappingEnabled​(boolean enable)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Enable or disable PID Wrapping for position closed loop control
        Parameters:
        enable - Whether position PID wrapping should be enabled
      • setPositionPIDWrappingMinInput

        REVLibError setPositionPIDWrappingMinInput​(double min)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Set the minimum input value for PID Wrapping with position closed loop control
        Parameters:
        min - The value of min input for the position
        Returns:
        REVLibError.kOk if successful
      • setPositionPIDWrappingMaxInput

        REVLibError setPositionPIDWrappingMaxInput​(double max)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Set the maximum input value for PID Wrapping with position closed loop control
        Parameters:
        max - The value of max input for the position
        Returns:
        REVLibError.kOk if successful
      • getPositionPIDWrappingEnabled

        boolean getPositionPIDWrappingEnabled()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Get whether or not PID Wrapping for position closed loop control is enabled
        Returns:
        true if PID Wrapping is enabled
      • getPositionPIDWrappingMinInput

        double getPositionPIDWrappingMinInput()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Get the minimum input value for PID Wrapping with position closed loop control
        Returns:
        The minimum input value
      • getPositionPIDWrappingMaxInput

        double getPositionPIDWrappingMaxInput()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Get the maximum input value for PID Wrapping with position closed loop control
        Returns:
        The maximum input value
      • setFeedbackDevice

        REVLibError setFeedbackDevice​(MotorFeedbackSensor sensor)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Set the controller's feedback device

        The default feedback device in brushless mode is assumed to be the integrated encoder and the default feedback device in brushed mode is assumed to be a quadrature encoder. This is used to changed to another feedback device for the controller, such as an analog sensor.

        If there is a limited range on the feedback sensor that should be observed by the PIDController, it can be set by calling SetFeedbackSensorRange() on the sensor object.

        Specified by:
        setFeedbackDevice in interface CANPIDController
        Parameters:
        sensor - The sensor to use as a feedback device
        Returns:
        REVLibError.kOk if successful