Class HardwareLimitSwitchConfigs

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

public class HardwareLimitSwitchConfigs extends Object implements ParentConfiguration
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

      Determines if the forward limit switch is normally-open (default) or normally-closed.
    • 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

      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

      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

      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

      Determines if the reverse limit switch is normally-open (default) or normally-closed.
    • 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

      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

      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

      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

  • Method Details

    • withForwardLimitType

      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 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 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 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

      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 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

      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 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

      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 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 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 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

      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 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

      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 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

      Helper method to configure this feedback group to use RemoteTalonFX forward limit switch by passing in the TalonFX 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 - TalonFX reference to use for RemoteTalonFX forward limit switch
      Returns:
      Itself
    • withForwardLimitRemoteCANcoder

      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

      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

      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 Signal 1 Input (S1IN) pin matches the configured closed state.
      Parameters:
      device - CANdi reference to use for RemoteCANdi forward limit switch
      Returns:
      Itself
    • withForwardLimitRemoteCANdiS2

      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 Signal 2 Input (S2IN) pin matches the configured closed state.
      Parameters:
      device - CANdi reference to use for RemoteCANdi forward limit switch
      Returns:
      Itself
    • withReverseLimitRemoteTalonFX

      Helper method to configure this feedback group to use RemoteTalonFX reverse limit switch by passing in the TalonFX 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 - TalonFX reference to use for RemoteTalonFX reverse limit switch
      Returns:
      Itself
    • withReverseLimitRemoteCANcoder

      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

      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

      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 Signal 1 Input (S1IN) pin matches the configured closed state.
      Parameters:
      device - CANdi reference to use for RemoteCANdi reverse limit switch
      Returns:
      Itself
    • withReverseLimitRemoteCANdiS2

      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 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
    • deserialize

      public StatusCode deserialize(String to_deserialize)
      Specified by:
      deserialize in interface ParentConfiguration
    • serialize

      public String serialize()
      Specified by:
      serialize in interface ISerializable