Class HardwareLimitSwitchConfigs

java.lang.Object
com.ctre.phoenix6.configs.HardwareLimitSwitchConfigs
All Implemented Interfaces:
ParentConfiguration, Cloneable

public class HardwareLimitSwitchConfigs extends Object implements ParentConfiguration, Cloneable
Configs that change how the motor controller behaves under different limit switch states.

Includes configs such as enabling limit switches, configuring the remote sensor ID, the source, and the position to set on limit.

  • Field Details

    • ForwardLimitType

      public ForwardLimitTypeValue ForwardLimitType
      Determines if the forward limit switch is normally-open (default) or normally-closed.
    • ForwardLimitAutosetPositionEnable

      public boolean ForwardLimitAutosetPositionEnable
      If enabled, the position is automatically set to a specific value, specified by ForwardLimitAutosetPositionValue, when the forward limit switch is asserted.
      • Default Value: False
    • ForwardLimitAutosetPositionValue

      public double ForwardLimitAutosetPositionValue
      The value to automatically set the position to when the forward limit switch is asserted. This has no effect if ForwardLimitAutosetPositionEnable is false.
      • Minimum Value: -3.4e+38
      • Maximum Value: 3.4e+38
      • Default Value: 0
      • Units: rotations
    • ForwardLimitEnable

      public boolean ForwardLimitEnable
      If enabled, motor output is set to neutral when the forward limit switch is asserted and positive output is requested.
      • Default Value: True
    • ForwardLimitSource

      public ForwardLimitSourceValue ForwardLimitSource
      Determines where to poll the forward limit switch. This defaults to the forward limit switch pin on the limit switch connector.

      Choose RemoteTalonFX to use the forward limit switch attached to another Talon FX on the same CAN bus (this also requires setting ForwardLimitRemoteSensorID).

      Choose RemoteCANifier to use the forward limit switch attached to another CANifier on the same CAN bus (this also requires setting ForwardLimitRemoteSensorID).

      Choose RemoteCANcoder to use another CANcoder on the same CAN bus (this also requires setting ForwardLimitRemoteSensorID). The forward limit will assert when the CANcoder magnet strength changes from BAD (red) to ADEQUATE (orange) or GOOD (green).

    • ForwardLimitRemoteSensorID

      public int ForwardLimitRemoteSensorID
      Device ID of the remote device if using remote limit switch features for the forward limit switch.
      • Minimum Value: 0
      • Maximum Value: 62
      • Default Value: 0
      • Units:
    • ReverseLimitType

      public ReverseLimitTypeValue ReverseLimitType
      Determines if the reverse limit switch is normally-open (default) or normally-closed.
    • ReverseLimitAutosetPositionEnable

      public boolean ReverseLimitAutosetPositionEnable
      If enabled, the position is automatically set to a specific value, specified by ReverseLimitAutosetPositionValue, when the reverse limit switch is asserted.
      • Default Value: False
    • ReverseLimitAutosetPositionValue

      public double ReverseLimitAutosetPositionValue
      The value to automatically set the position to when the reverse limit switch is asserted. This has no effect if ReverseLimitAutosetPositionEnable is false.
      • Minimum Value: -3.4e+38
      • Maximum Value: 3.4e+38
      • Default Value: 0
      • Units: rotations
    • ReverseLimitEnable

      public boolean ReverseLimitEnable
      If enabled, motor output is set to neutral when reverse limit switch is asseted and negative output is requested.
      • Default Value: True
    • ReverseLimitSource

      public ReverseLimitSourceValue ReverseLimitSource
      Determines where to poll the reverse limit switch. This defaults to the reverse limit switch pin on the limit switch connector.

      Choose RemoteTalonFX to use the reverse limit switch attached to another Talon FX on the same CAN bus (this also requires setting ReverseLimitRemoteSensorID).

      Choose RemoteCANifier to use the reverse limit switch attached to another CANifier on the same CAN bus (this also requires setting ReverseLimitRemoteSensorID).

      Choose RemoteCANcoder to use another CANcoder on the same CAN bus (this also requires setting ReverseLimitRemoteSensorID). The reverse limit will assert when the CANcoder magnet strength changes from BAD (red) to ADEQUATE (orange) or GOOD (green).

    • ReverseLimitRemoteSensorID

      public int ReverseLimitRemoteSensorID
      Device ID of the remote device if using remote limit switch features for the reverse limit switch.
      • Minimum Value: 0
      • Maximum Value: 62
      • Default Value: 0
      • Units:
  • Constructor Details

    • HardwareLimitSwitchConfigs

      public HardwareLimitSwitchConfigs()
  • Method Details

    • withForwardLimitType

      public final HardwareLimitSwitchConfigs withForwardLimitType(ForwardLimitTypeValue newForwardLimitType)
      Modifies this configuration's ForwardLimitType parameter and returns itself for method-chaining and easier to use config API.

      Determines if the forward limit switch is normally-open (default) or normally-closed.

      Parameters:
      newForwardLimitType - Parameter to modify
      Returns:
      Itself
    • withForwardLimitAutosetPositionEnable

      public final HardwareLimitSwitchConfigs withForwardLimitAutosetPositionEnable(boolean newForwardLimitAutosetPositionEnable)
      Modifies this configuration's ForwardLimitAutosetPositionEnable parameter and returns itself for method-chaining and easier to use config API.

      If enabled, the position is automatically set to a specific value, specified by ForwardLimitAutosetPositionValue, when the forward limit switch is asserted.

      • Default Value: False
      Parameters:
      newForwardLimitAutosetPositionEnable - Parameter to modify
      Returns:
      Itself
    • withForwardLimitAutosetPositionValue

      public final HardwareLimitSwitchConfigs withForwardLimitAutosetPositionValue(double newForwardLimitAutosetPositionValue)
      Modifies this configuration's ForwardLimitAutosetPositionValue parameter and returns itself for method-chaining and easier to use config API.

      The value to automatically set the position to when the forward limit switch is asserted. This has no effect if ForwardLimitAutosetPositionEnable is false.

      • Minimum Value: -3.4e+38
      • Maximum Value: 3.4e+38
      • Default Value: 0
      • Units: rotations
      Parameters:
      newForwardLimitAutosetPositionValue - Parameter to modify
      Returns:
      Itself
    • withForwardLimitAutosetPositionValue

      public final HardwareLimitSwitchConfigs withForwardLimitAutosetPositionValue(Angle newForwardLimitAutosetPositionValue)
      Modifies this configuration's ForwardLimitAutosetPositionValue parameter and returns itself for method-chaining and easier to use config API.

      The value to automatically set the position to when the forward limit switch is asserted. This has no effect if ForwardLimitAutosetPositionEnable is false.

      • Minimum Value: -3.4e+38
      • Maximum Value: 3.4e+38
      • Default Value: 0
      • Units: rotations
      Parameters:
      newForwardLimitAutosetPositionValue - Parameter to modify
      Returns:
      Itself
    • getForwardLimitAutosetPositionValueMeasure

      public final Angle getForwardLimitAutosetPositionValueMeasure()
      Helper method to get this configuration's ForwardLimitAutosetPositionValue parameter converted to a unit type. If not using the Java units library, ForwardLimitAutosetPositionValue can be accessed directly instead.

      The value to automatically set the position to when the forward limit switch is asserted. This has no effect if ForwardLimitAutosetPositionEnable is false.

      • Minimum Value: -3.4e+38
      • Maximum Value: 3.4e+38
      • Default Value: 0
      • Units: rotations
      Returns:
      ForwardLimitAutosetPositionValue
    • withForwardLimitEnable

      public final HardwareLimitSwitchConfigs withForwardLimitEnable(boolean newForwardLimitEnable)
      Modifies this configuration's ForwardLimitEnable parameter and returns itself for method-chaining and easier to use config API.

      If enabled, motor output is set to neutral when the forward limit switch is asserted and positive output is requested.

      • Default Value: True
      Parameters:
      newForwardLimitEnable - Parameter to modify
      Returns:
      Itself
    • withForwardLimitSource

      public final HardwareLimitSwitchConfigs withForwardLimitSource(ForwardLimitSourceValue newForwardLimitSource)
      Modifies this configuration's ForwardLimitSource parameter and returns itself for method-chaining and easier to use config API.

      Determines where to poll the forward limit switch. This defaults to the forward limit switch pin on the limit switch connector.

      Choose RemoteTalonFX to use the forward limit switch attached to another Talon FX on the same CAN bus (this also requires setting ForwardLimitRemoteSensorID).

      Choose RemoteCANifier to use the forward limit switch attached to another CANifier on the same CAN bus (this also requires setting ForwardLimitRemoteSensorID).

      Choose RemoteCANcoder to use another CANcoder on the same CAN bus (this also requires setting ForwardLimitRemoteSensorID). The forward limit will assert when the CANcoder magnet strength changes from BAD (red) to ADEQUATE (orange) or GOOD (green).

      Parameters:
      newForwardLimitSource - Parameter to modify
      Returns:
      Itself
    • withForwardLimitRemoteSensorID

      public final HardwareLimitSwitchConfigs withForwardLimitRemoteSensorID(int newForwardLimitRemoteSensorID)
      Modifies this configuration's ForwardLimitRemoteSensorID parameter and returns itself for method-chaining and easier to use config API.

      Device ID of the remote device if using remote limit switch features for the forward limit switch.

      • Minimum Value: 0
      • Maximum Value: 62
      • Default Value: 0
      • Units:
      Parameters:
      newForwardLimitRemoteSensorID - Parameter to modify
      Returns:
      Itself
    • withReverseLimitType

      public final HardwareLimitSwitchConfigs withReverseLimitType(ReverseLimitTypeValue newReverseLimitType)
      Modifies this configuration's ReverseLimitType parameter and returns itself for method-chaining and easier to use config API.

      Determines if the reverse limit switch is normally-open (default) or normally-closed.

      Parameters:
      newReverseLimitType - Parameter to modify
      Returns:
      Itself
    • withReverseLimitAutosetPositionEnable

      public final HardwareLimitSwitchConfigs withReverseLimitAutosetPositionEnable(boolean newReverseLimitAutosetPositionEnable)
      Modifies this configuration's ReverseLimitAutosetPositionEnable parameter and returns itself for method-chaining and easier to use config API.

      If enabled, the position is automatically set to a specific value, specified by ReverseLimitAutosetPositionValue, when the reverse limit switch is asserted.

      • Default Value: False
      Parameters:
      newReverseLimitAutosetPositionEnable - Parameter to modify
      Returns:
      Itself
    • withReverseLimitAutosetPositionValue

      public final HardwareLimitSwitchConfigs withReverseLimitAutosetPositionValue(double newReverseLimitAutosetPositionValue)
      Modifies this configuration's ReverseLimitAutosetPositionValue parameter and returns itself for method-chaining and easier to use config API.

      The value to automatically set the position to when the reverse limit switch is asserted. This has no effect if ReverseLimitAutosetPositionEnable is false.

      • Minimum Value: -3.4e+38
      • Maximum Value: 3.4e+38
      • Default Value: 0
      • Units: rotations
      Parameters:
      newReverseLimitAutosetPositionValue - Parameter to modify
      Returns:
      Itself
    • withReverseLimitAutosetPositionValue

      public final HardwareLimitSwitchConfigs withReverseLimitAutosetPositionValue(Angle newReverseLimitAutosetPositionValue)
      Modifies this configuration's ReverseLimitAutosetPositionValue parameter and returns itself for method-chaining and easier to use config API.

      The value to automatically set the position to when the reverse limit switch is asserted. This has no effect if ReverseLimitAutosetPositionEnable is false.

      • Minimum Value: -3.4e+38
      • Maximum Value: 3.4e+38
      • Default Value: 0
      • Units: rotations
      Parameters:
      newReverseLimitAutosetPositionValue - Parameter to modify
      Returns:
      Itself
    • getReverseLimitAutosetPositionValueMeasure

      public final Angle getReverseLimitAutosetPositionValueMeasure()
      Helper method to get this configuration's ReverseLimitAutosetPositionValue parameter converted to a unit type. If not using the Java units library, ReverseLimitAutosetPositionValue can be accessed directly instead.

      The value to automatically set the position to when the reverse limit switch is asserted. This has no effect if ReverseLimitAutosetPositionEnable is false.

      • Minimum Value: -3.4e+38
      • Maximum Value: 3.4e+38
      • Default Value: 0
      • Units: rotations
      Returns:
      ReverseLimitAutosetPositionValue
    • withReverseLimitEnable

      public final HardwareLimitSwitchConfigs withReverseLimitEnable(boolean newReverseLimitEnable)
      Modifies this configuration's ReverseLimitEnable parameter and returns itself for method-chaining and easier to use config API.

      If enabled, motor output is set to neutral when reverse limit switch is asseted and negative output is requested.

      • Default Value: True
      Parameters:
      newReverseLimitEnable - Parameter to modify
      Returns:
      Itself
    • withReverseLimitSource

      public final HardwareLimitSwitchConfigs withReverseLimitSource(ReverseLimitSourceValue newReverseLimitSource)
      Modifies this configuration's ReverseLimitSource parameter and returns itself for method-chaining and easier to use config API.

      Determines where to poll the reverse limit switch. This defaults to the reverse limit switch pin on the limit switch connector.

      Choose RemoteTalonFX to use the reverse limit switch attached to another Talon FX on the same CAN bus (this also requires setting ReverseLimitRemoteSensorID).

      Choose RemoteCANifier to use the reverse limit switch attached to another CANifier on the same CAN bus (this also requires setting ReverseLimitRemoteSensorID).

      Choose RemoteCANcoder to use another CANcoder on the same CAN bus (this also requires setting ReverseLimitRemoteSensorID). The reverse limit will assert when the CANcoder magnet strength changes from BAD (red) to ADEQUATE (orange) or GOOD (green).

      Parameters:
      newReverseLimitSource - Parameter to modify
      Returns:
      Itself
    • withReverseLimitRemoteSensorID

      public final HardwareLimitSwitchConfigs withReverseLimitRemoteSensorID(int newReverseLimitRemoteSensorID)
      Modifies this configuration's ReverseLimitRemoteSensorID parameter and returns itself for method-chaining and easier to use config API.

      Device ID of the remote device if using remote limit switch features for the reverse limit switch.

      • Minimum Value: 0
      • Maximum Value: 62
      • Default Value: 0
      • Units:
      Parameters:
      newReverseLimitRemoteSensorID - Parameter to modify
      Returns:
      Itself
    • withForwardLimitRemoteTalonFX

      public final HardwareLimitSwitchConfigs withForwardLimitRemoteTalonFX(CommonTalon device)
      Helper method to configure this feedback group to use RemoteTalonFX forward limit switch by passing in the CommonTalon object. When using RemoteTalonFX, the Talon FX will use the forward limit switch attached to another Talon FX on the same CAN bus.
      Parameters:
      device - CommonTalon reference to use for RemoteTalonFX forward limit switch
      Returns:
      Itself
    • withForwardLimitRemoteCANcoder

      public final HardwareLimitSwitchConfigs withForwardLimitRemoteCANcoder(CoreCANcoder device)
      Helper method to configure this feedback group to use RemoteCANcoder forward limit switch by passing in the CANcoder object. When using RemoteCANcoder, the Talon FX will use another CANcoder on the same CAN bus. The forward limit will assert when the CANcoder magnet strength changes from BAD (red) to ADEQUATE (orange) or GOOD (green).
      Parameters:
      device - CANcoder reference to use for RemoteCANcoder forward limit switch
      Returns:
      Itself
    • withForwardLimitRemoteCANrange

      public final HardwareLimitSwitchConfigs withForwardLimitRemoteCANrange(CoreCANrange device)
      Helper method to configure this feedback group to use the RemoteCANrange by passing in the CANrange object. The forward limit will assert when the CANrange proximity detect is tripped.
      Parameters:
      device - CANrange reference to use for RemoteCANrange forward limit switch
      Returns:
      Itself
    • withForwardLimitRemoteCANdiS1

      public final HardwareLimitSwitchConfigs withForwardLimitRemoteCANdiS1(CoreCANdi device)
      Helper method to configure this feedback group to use RemoteCANdi forward limit switch on Signal 1 Input (S1IN) by passing in the CANdi object. The forward limit will assert when the CANdi™ branded device's Signal 1 Input (S1IN) pin matches the configured closed state.
      Parameters:
      device - CANdi reference to use for RemoteCANdi forward limit switch
      Returns:
      Itself
    • withForwardLimitRemoteCANdiS2

      public final HardwareLimitSwitchConfigs withForwardLimitRemoteCANdiS2(CoreCANdi device)
      Helper method to configure this feedback group to use RemoteCANdi forward limit switch on Signal 2 Input (S2IN) by passing in the CANdi object. The forward limit will assert when the CANdi™ branded device's Signal 2 Input (S2IN) pin matches the configured closed state.
      Parameters:
      device - CANdi reference to use for RemoteCANdi forward limit switch
      Returns:
      Itself
    • withReverseLimitRemoteTalonFX

      public final HardwareLimitSwitchConfigs withReverseLimitRemoteTalonFX(CommonTalon device)
      Helper method to configure this feedback group to use RemoteTalonFX reverse limit switch by passing in the CommonTalon object. When using RemoteTalonFX, the Talon FX will use the reverse limit switch attached to another Talon FX on the same CAN bus.
      Parameters:
      device - CommonTalon reference to use for RemoteTalonFX reverse limit switch
      Returns:
      Itself
    • withReverseLimitRemoteCANcoder

      public final HardwareLimitSwitchConfigs withReverseLimitRemoteCANcoder(CoreCANcoder device)
      Helper method to configure this feedback group to use RemoteCANcoder reverse limit switch by passing in the CANcoder object. When using RemoteCANcoder, the Talon FX will use another CANcoder on the same CAN bus. The reverse limit will assert when the CANcoder magnet strength changes from BAD (red) to ADEQUATE (orange) or GOOD (green).
      Parameters:
      device - CANcoder reference to use for RemoteCANcoder reverse limit switch
      Returns:
      Itself
    • withReverseLimitRemoteCANrange

      public final HardwareLimitSwitchConfigs withReverseLimitRemoteCANrange(CoreCANrange device)
      Helper method to configure this feedback group to use the RemoteCANrange by passing in the CANrange object. The reverse limit will assert when the CANrange proximity detect is tripped.
      Parameters:
      device - CANrange reference to use for RemoteCANrange reverse limit switch
      Returns:
      Itself
    • withReverseLimitRemoteCANdiS1

      public final HardwareLimitSwitchConfigs withReverseLimitRemoteCANdiS1(CoreCANdi device)
      Helper method to configure this feedback group to use RemoteCANdi reverse limit switch on Signal 1 Input (S1IN) by passing in the CANdi object. The reverse limit will assert when the CANdi™ branded device's Signal 1 Input (S1IN) pin matches the configured closed state.
      Parameters:
      device - CANdi reference to use for RemoteCANdi reverse limit switch
      Returns:
      Itself
    • withReverseLimitRemoteCANdiS2

      public final HardwareLimitSwitchConfigs withReverseLimitRemoteCANdiS2(CoreCANdi device)
      Helper method to configure this feedback group to use RemoteCANdi reverse limit switch on Signal 2 Input (S2IN) by passing in the CANdi object. The reverse limit will assert when the CANdi™ branded device's Signal 2 Input (S2IN) pin matches the configured closed state.
      Parameters:
      device - CANdi reference to use for RemoteCANdi reverse limit switch
      Returns:
      Itself
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • serialize

      public final String serialize()
      Get the serialized form of this configuration group.
      Specified by:
      serialize in interface ParentConfiguration
      Returns:
      Serialized form of this config group
    • deserialize

      public final StatusCode deserialize(String to_deserialize)
      Take a string and deserialize it to this configuration group.
      Specified by:
      deserialize in interface ParentConfiguration
      Parameters:
      to_deserialize - The serialized configuration
      Returns:
      Return code of the deserialize method
    • clone

      Overrides:
      clone in class Object