Class MAXMotionConfig

java.lang.Object
com.revrobotics.spark.config.BaseConfig
com.revrobotics.spark.config.MAXMotionConfig

public class MAXMotionConfig extends BaseConfig
  • Constructor Details

    • MAXMotionConfig

      public MAXMotionConfig()
  • Method Details

    • apply

      public MAXMotionConfig apply(MAXMotionConfig config)
      Applies settings from another MAXMotionConfig to this one.

      Settings in the provided config will overwrite existing values in this object. Settings not specified in the provided config remain unchanged.

      Parameters:
      config - The MAXMotionConfig to copy settings from
      Returns:
      The updated MAXMotionConfig for method chaining
    • maxVelocity

      public MAXMotionConfig maxVelocity(double maxVelocity)
      Set the maximum velocity for the MAXMotion mode of the controller. This is the cruising velocity of the profile. Natively, the units are in RPM but will be affected by the velocity conversion factor.

      This will set the value for closed loop slot 0. To set the value for a specific closed loop slot, use maxVelocity(double, ClosedLoopSlot).

      Parameters:
      maxVelocity - The maximum velocity with the velocity conversion factor applied
      Returns:
      The modified MAXMotionConfig object for method chaining
    • maxVelocity

      public MAXMotionConfig maxVelocity(double maxVelocity, ClosedLoopConfig.ClosedLoopSlot slot)
      Set the maximum velocity for the MAXMotion mode of the controller for a specific closed loop slot. This is the cruising velocity of the profile. Natively, the units are in RPM but will be affected by the velocity conversion factor.
      Parameters:
      maxVelocity - The maximum velocity with the velocity conversion factor applied
      slot - The closed loop slot to set the values for
      Returns:
      The modified MAXMotionConfig object for method chaining
    • maxAcceleration

      public MAXMotionConfig maxAcceleration(double maxAcceleration)
      Set the maximum acceleration for the MAXMotion mode of the controller. This is the rate at which the velocity will increase until the max velocity is reached. Natively, the units are in RPM per second but will be affected by the velocity conversion factor.

      This will set the value for closed loop slot 0. To set the value for a specific closed loop slot, use maxAcceleration(double, ClosedLoopSlot).

      Parameters:
      maxAcceleration - The maximum acceleration with the velocity conversion factor applied
      Returns:
      The modified MAXMotionConfig object for method chaining
    • maxAcceleration

      public MAXMotionConfig maxAcceleration(double maxAcceleration, ClosedLoopConfig.ClosedLoopSlot slot)
      Set the maximum acceleration for the MAXMotion mode of the controller for a specific closed loop slot. This is the rate at which the velocity will increase until the max velocity is reached. Natively, the units are in RPM per second but will be affected by the velocity conversion factor.
      Parameters:
      maxAcceleration - The maximum acceleration with the velocity conversion factor applied
      slot - The closed loop slot to set the values for
      Returns:
      The modified MAXMotionConfig object for method chaining
    • allowedClosedLoopError

      public MAXMotionConfig allowedClosedLoopError(double allowedError)
      Set the allowed closed loop error for the MAXMotion mode of the controller. This value is how much deviation from the setpoint is tolerated and is useful in preventing oscillation around the setpoint. Natively, the units are in rotations but will be affected by the position conversion factor.

      This will set the value for closed loop slot 0. To set the value for a specific closed loop slot, use allowedClosedLoopError(double, ClosedLoopSlot).

      Parameters:
      allowedError - The allowed error with the position conversion factor applied
      Returns:
      The modified MAXMotionConfig object for method chaining
    • allowedClosedLoopError

      public MAXMotionConfig allowedClosedLoopError(double allowedError, ClosedLoopConfig.ClosedLoopSlot slot)
      Set the allowed closed loop error for the MAXMotion mode of the controller for a specific PID slot. This value is how much deviation from the setpoint is tolerated and is useful in preventing oscillation around the setpoint. Natively, the units are in rotations but will be affected by the position conversion factor.
      Parameters:
      allowedError - The allowed error with the position conversion factor applied
      slot - The closed loop slot to set the values for
      Returns:
      The modified MAXMotionConfig object for method chaining
    • positionMode

      Set the MAXMotion position control mode of the controller.

      This will set the value for closed loop slot 0. To set the value for a specific closed loop slot, use positionMode(MAXMotionPositionMode, ClosedLoopSlot).

      Parameters:
      mode - The MAXmotion position mode
      Returns:
      The modified MAXMotionConfig object for method chaining
    • positionMode

      Set the MAXMotion position control mode of the controller for a specific closed loop slot.
      Parameters:
      mode - The MAXmotion position mode
      slot - The closed loop slot to set the values for
      Returns:
      The modified MAXMotionConfig object for method chaining