Class LimitSwitchConfig

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

public class LimitSwitchConfig extends BaseConfig
  • Constructor Details

    • LimitSwitchConfig

      public LimitSwitchConfig()
  • Method Details

    • apply

      public LimitSwitchConfig apply(LimitSwitchConfig config)
      Applies settings from another LimitSwitchConfig 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 LimitSwitchConfig to copy settings from
      Returns:
      The updated LimitSwitchConfig for method chaining
    • setSparkMaxDataPortConfig

      public LimitSwitchConfig setSparkMaxDataPortConfig()
      Configures the data port to use limit switches, which is specifically required for SPARK MAX.

      NOTE: This method is only necessary when using limit switches with a SPARK MAX without configuring any of its settings

      IMPORTANT: SPARK MAX does not support using limit switches in conjunction with an alternate encoder.

      Returns:
      The modified LimitSwitchConfig object for method chaining
    • forwardLimitSwitchEnabled

      public LimitSwitchConfig forwardLimitSwitchEnabled(boolean enabled)
      Set whether to enable or disable motor shutdown based on the forward limit switch state. This does not not affect the result of the isPressed() command.
      Parameters:
      enabled - True to enable motor shutdown behavior
      Returns:
      The modified LimitSwitchConfig object for method chaining
    • forwardLimitSwitchType

      public LimitSwitchConfig forwardLimitSwitchType(LimitSwitchConfig.Type type)
      Set the normal state of the forward limit switch.
      Parameters:
      type - kNormallyOpen or kNormallyClosed
      Returns:
      The modified LimitSwitchConfig object for method chaining
    • reverseLimitSwitchEnabled

      public LimitSwitchConfig reverseLimitSwitchEnabled(boolean enabled)
      Set whether to enable or disable motor shutdown based on the reverse limit switch state. This does not not affect the result of the isPressed() command.
      Parameters:
      enabled - True to enable motor shutdown behavior
      Returns:
      The modified LimitSwitchConfig object for method chaining
    • reverseLimitSwitchType

      public LimitSwitchConfig reverseLimitSwitchType(LimitSwitchConfig.Type type)
      Set the normal state of the reverse limit switch.
      Parameters:
      type - kNormallyOpen or kNormallyClosed
      Returns:
      The modified LimitSwitchConfig object for method chaining