Table of Contents

Class HardwareLimitSwitchConfigs

Namespace
CTRE.Phoenix6.Configs
Assembly
Phoenix6.Hardware.dll

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.
public class HardwareLimitSwitchConfigs : IParentConfiguration, ISerializable, ICloneable
Inheritance
HardwareLimitSwitchConfigs
Implements
Inherited Members

Fields

ForwardLimitAutosetPositionEnable

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

  • Default ValueFalse
public bool ForwardLimitAutosetPositionEnable

Field Value

bool

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 Value3.4e+38
  • Default Value0
  • Unitsrotations
public double ForwardLimitAutosetPositionValue

Field Value

double

ForwardLimitEnable

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

  • Default ValueTrue
public bool ForwardLimitEnable

Field Value

bool

ForwardLimitRemoteSensorID

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

  • Minimum Value0
  • Maximum Value62
  • Default Value0
  • Units
public int ForwardLimitRemoteSensorID

Field Value

int

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).
public ForwardLimitSourceValue ForwardLimitSource

Field Value

ForwardLimitSourceValue

ForwardLimitType

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

public ForwardLimitTypeValue ForwardLimitType

Field Value

ForwardLimitTypeValue

ReverseLimitAutosetPositionEnable

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

  • Default ValueFalse
public bool ReverseLimitAutosetPositionEnable

Field Value

bool

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 Value3.4e+38
  • Default Value0
  • Unitsrotations
public double ReverseLimitAutosetPositionValue

Field Value

double

ReverseLimitEnable

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

  • Default ValueTrue
public bool ReverseLimitEnable

Field Value

bool

ReverseLimitRemoteSensorID

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

  • Minimum Value0
  • Maximum Value62
  • Default Value0
  • Units
public int ReverseLimitRemoteSensorID

Field Value

int

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).
public ReverseLimitSourceValue ReverseLimitSource

Field Value

ReverseLimitSourceValue

ReverseLimitType

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

public ReverseLimitTypeValue ReverseLimitType

Field Value

ReverseLimitTypeValue

Methods

Clone()

Creates a copy of this config group.

public HardwareLimitSwitchConfigs Clone()

Returns

HardwareLimitSwitchConfigs

Deserialize(string)

Deserialize string and put values into this object

public StatusCode Deserialize(string to_deserialize)

Parameters

to_deserialize string

String to deserialize

Returns

StatusCode

OK if deserialization is OK

Serialize()

Serialize this object into a string

public string Serialize()

Returns

string

This object's data serialized into a string

ToString()

Provides the string representation of this object

public override string ToString()

Returns

string

WithForwardLimitAutosetPositionEnable(bool)

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 ValueFalse
public HardwareLimitSwitchConfigs WithForwardLimitAutosetPositionEnable(bool newForwardLimitAutosetPositionEnable)

Parameters

newForwardLimitAutosetPositionEnable bool

Parameter to modify

Returns

HardwareLimitSwitchConfigs

Itself

WithForwardLimitAutosetPositionValue(double)

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 Value3.4e+38
  • Default Value0
  • Unitsrotations
public HardwareLimitSwitchConfigs WithForwardLimitAutosetPositionValue(double newForwardLimitAutosetPositionValue)

Parameters

newForwardLimitAutosetPositionValue double

Parameter to modify

Returns

HardwareLimitSwitchConfigs

Itself

WithForwardLimitEnable(bool)

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 ValueTrue
public HardwareLimitSwitchConfigs WithForwardLimitEnable(bool newForwardLimitEnable)

Parameters

newForwardLimitEnable bool

Parameter to modify

Returns

HardwareLimitSwitchConfigs

Itself

WithForwardLimitRemoteCANcoder(CoreCANcoder)

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

public HardwareLimitSwitchConfigs WithForwardLimitRemoteCANcoder(CoreCANcoder device)

Parameters

device CoreCANcoder

CANcoder reference to use for RemoteCANcoder forward limit switch

Returns

HardwareLimitSwitchConfigs

Itself

WithForwardLimitRemoteCANdiS1(CoreCANdi)

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.

public HardwareLimitSwitchConfigs WithForwardLimitRemoteCANdiS1(CoreCANdi device)

Parameters

device CoreCANdi

CANdi reference to use for RemoteCANdi forward limit switch

Returns

HardwareLimitSwitchConfigs

Itself

WithForwardLimitRemoteCANdiS2(CoreCANdi)

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.

public HardwareLimitSwitchConfigs WithForwardLimitRemoteCANdiS2(CoreCANdi device)

Parameters

device CoreCANdi

CANdi reference to use for RemoteCANdi forward limit switch

Returns

HardwareLimitSwitchConfigs

Itself

WithForwardLimitRemoteCANrange(CoreCANrange)

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.

public HardwareLimitSwitchConfigs WithForwardLimitRemoteCANrange(CoreCANrange device)

Parameters

device CoreCANrange

CANrange reference to use for RemoteCANrange forward limit switch

Returns

HardwareLimitSwitchConfigs

Itself

WithForwardLimitRemoteSensorID(int)

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 Value0
  • Maximum Value62
  • Default Value0
  • Units
public HardwareLimitSwitchConfigs WithForwardLimitRemoteSensorID(int newForwardLimitRemoteSensorID)

Parameters

newForwardLimitRemoteSensorID int

Parameter to modify

Returns

HardwareLimitSwitchConfigs

Itself

WithForwardLimitRemoteTalonFX(CommonTalon)

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.

public HardwareLimitSwitchConfigs WithForwardLimitRemoteTalonFX(CommonTalon device)

Parameters

device CommonTalon

CommonTalon reference to use for RemoteTalonFX forward limit switch

Returns

HardwareLimitSwitchConfigs

Itself

WithForwardLimitSource(ForwardLimitSourceValue)

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).
public HardwareLimitSwitchConfigs WithForwardLimitSource(ForwardLimitSourceValue newForwardLimitSource)

Parameters

newForwardLimitSource ForwardLimitSourceValue

Parameter to modify

Returns

HardwareLimitSwitchConfigs

Itself

WithForwardLimitType(ForwardLimitTypeValue)

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.
public HardwareLimitSwitchConfigs WithForwardLimitType(ForwardLimitTypeValue newForwardLimitType)

Parameters

newForwardLimitType ForwardLimitTypeValue

Parameter to modify

Returns

HardwareLimitSwitchConfigs

Itself

WithReverseLimitAutosetPositionEnable(bool)

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 ValueFalse
public HardwareLimitSwitchConfigs WithReverseLimitAutosetPositionEnable(bool newReverseLimitAutosetPositionEnable)

Parameters

newReverseLimitAutosetPositionEnable bool

Parameter to modify

Returns

HardwareLimitSwitchConfigs

Itself

WithReverseLimitAutosetPositionValue(double)

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 Value3.4e+38
  • Default Value0
  • Unitsrotations
public HardwareLimitSwitchConfigs WithReverseLimitAutosetPositionValue(double newReverseLimitAutosetPositionValue)

Parameters

newReverseLimitAutosetPositionValue double

Parameter to modify

Returns

HardwareLimitSwitchConfigs

Itself

WithReverseLimitEnable(bool)

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 ValueTrue
public HardwareLimitSwitchConfigs WithReverseLimitEnable(bool newReverseLimitEnable)

Parameters

newReverseLimitEnable bool

Parameter to modify

Returns

HardwareLimitSwitchConfigs

Itself

WithReverseLimitRemoteCANcoder(CoreCANcoder)

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

public HardwareLimitSwitchConfigs WithReverseLimitRemoteCANcoder(CoreCANcoder device)

Parameters

device CoreCANcoder

CANcoder reference to use for RemoteCANcoder reverse limit switch

Returns

HardwareLimitSwitchConfigs

Itself

WithReverseLimitRemoteCANdiS1(CoreCANdi)

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.

public HardwareLimitSwitchConfigs WithReverseLimitRemoteCANdiS1(CoreCANdi device)

Parameters

device CoreCANdi

CANdi reference to use for RemoteCANdi reverse limit switch

Returns

HardwareLimitSwitchConfigs

Itself

WithReverseLimitRemoteCANdiS2(CoreCANdi)

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.

public HardwareLimitSwitchConfigs WithReverseLimitRemoteCANdiS2(CoreCANdi device)

Parameters

device CoreCANdi

CANdi reference to use for RemoteCANdi reverse limit switch

Returns

HardwareLimitSwitchConfigs

Itself

WithReverseLimitRemoteCANrange(CoreCANrange)

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.

public HardwareLimitSwitchConfigs WithReverseLimitRemoteCANrange(CoreCANrange device)

Parameters

device CoreCANrange

CANrange reference to use for RemoteCANrange reverse limit switch

Returns

HardwareLimitSwitchConfigs

Itself

WithReverseLimitRemoteSensorID(int)

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 Value0
  • Maximum Value62
  • Default Value0
  • Units
public HardwareLimitSwitchConfigs WithReverseLimitRemoteSensorID(int newReverseLimitRemoteSensorID)

Parameters

newReverseLimitRemoteSensorID int

Parameter to modify

Returns

HardwareLimitSwitchConfigs

Itself

WithReverseLimitRemoteTalonFX(CommonTalon)

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.

public HardwareLimitSwitchConfigs WithReverseLimitRemoteTalonFX(CommonTalon device)

Parameters

device CommonTalon

CommonTalon reference to use for RemoteTalonFX reverse limit switch

Returns

HardwareLimitSwitchConfigs

Itself

WithReverseLimitSource(ReverseLimitSourceValue)

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).
public HardwareLimitSwitchConfigs WithReverseLimitSource(ReverseLimitSourceValue newReverseLimitSource)

Parameters

newReverseLimitSource ReverseLimitSourceValue

Parameter to modify

Returns

HardwareLimitSwitchConfigs

Itself

WithReverseLimitType(ReverseLimitTypeValue)

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.
public HardwareLimitSwitchConfigs WithReverseLimitType(ReverseLimitTypeValue newReverseLimitType)

Parameters

newReverseLimitType ReverseLimitTypeValue

Parameter to modify

Returns

HardwareLimitSwitchConfigs

Itself