CTRE Phoenix 6 C++ 25.0.0-beta-4
Loading...
Searching...
No Matches
ctre::phoenix6::configs::HardwareLimitSwitchConfigs Class Reference

Configs that change how the motor controller behaves under different limit switch states. More...

#include <ctre/phoenix6/configs/Configs.hpp>

Inheritance diagram for ctre::phoenix6::configs::HardwareLimitSwitchConfigs:
ctre::phoenix6::configs::ParentConfiguration ctre::phoenix6::ISerializable

Public Member Functions

constexpr HardwareLimitSwitchConfigs ()=default
 
constexpr HardwareLimitSwitchConfigsWithForwardLimitType (signals::ForwardLimitTypeValue newForwardLimitType)
 Modifies this configuration's ForwardLimitType parameter and returns itself for method-chaining and easier to use config API.
 
constexpr HardwareLimitSwitchConfigsWithForwardLimitAutosetPositionEnable (bool newForwardLimitAutosetPositionEnable)
 Modifies this configuration's ForwardLimitAutosetPositionEnable parameter and returns itself for method-chaining and easier to use config API.
 
constexpr HardwareLimitSwitchConfigsWithForwardLimitAutosetPositionValue (units::angle::turn_t newForwardLimitAutosetPositionValue)
 Modifies this configuration's ForwardLimitAutosetPositionValue parameter and returns itself for method-chaining and easier to use config API.
 
constexpr HardwareLimitSwitchConfigsWithForwardLimitEnable (bool newForwardLimitEnable)
 Modifies this configuration's ForwardLimitEnable parameter and returns itself for method-chaining and easier to use config API.
 
constexpr HardwareLimitSwitchConfigsWithForwardLimitSource (signals::ForwardLimitSourceValue newForwardLimitSource)
 Modifies this configuration's ForwardLimitSource parameter and returns itself for method-chaining and easier to use config API.
 
constexpr HardwareLimitSwitchConfigsWithForwardLimitRemoteSensorID (int newForwardLimitRemoteSensorID)
 Modifies this configuration's ForwardLimitRemoteSensorID parameter and returns itself for method-chaining and easier to use config API.
 
constexpr HardwareLimitSwitchConfigsWithReverseLimitType (signals::ReverseLimitTypeValue newReverseLimitType)
 Modifies this configuration's ReverseLimitType parameter and returns itself for method-chaining and easier to use config API.
 
constexpr HardwareLimitSwitchConfigsWithReverseLimitAutosetPositionEnable (bool newReverseLimitAutosetPositionEnable)
 Modifies this configuration's ReverseLimitAutosetPositionEnable parameter and returns itself for method-chaining and easier to use config API.
 
constexpr HardwareLimitSwitchConfigsWithReverseLimitAutosetPositionValue (units::angle::turn_t newReverseLimitAutosetPositionValue)
 Modifies this configuration's ReverseLimitAutosetPositionValue parameter and returns itself for method-chaining and easier to use config API.
 
constexpr HardwareLimitSwitchConfigsWithReverseLimitEnable (bool newReverseLimitEnable)
 Modifies this configuration's ReverseLimitEnable parameter and returns itself for method-chaining and easier to use config API.
 
constexpr HardwareLimitSwitchConfigsWithReverseLimitSource (signals::ReverseLimitSourceValue newReverseLimitSource)
 Modifies this configuration's ReverseLimitSource parameter and returns itself for method-chaining and easier to use config API.
 
constexpr HardwareLimitSwitchConfigsWithReverseLimitRemoteSensorID (int newReverseLimitRemoteSensorID)
 Modifies this configuration's ReverseLimitRemoteSensorID parameter and returns itself for method-chaining and easier to use config API.
 
HardwareLimitSwitchConfigsWithForwardLimitRemoteTalonFX (const hardware::core::CoreTalonFX &device)
 Helper method to configure this feedback group to use RemoteTalonFX forward limit switch by passing in the TalonFX object.
 
HardwareLimitSwitchConfigsWithForwardLimitRemoteCANcoder (const hardware::core::CoreCANcoder &device)
 Helper method to configure this feedback group to use RemoteCANcoder forward limit switch by passing in the CANcoder object.
 
HardwareLimitSwitchConfigsWithReverseLimitRemoteTalonFX (const hardware::core::CoreTalonFX &device)
 Helper method to configure this feedback group to use RemoteTalonFX reverse limit switch by passing in the TalonFX object.
 
HardwareLimitSwitchConfigsWithReverseLimitRemoteCANcoder (const hardware::core::CoreCANcoder &device)
 Helper method to configure this feedback group to use RemoteCANcoder reverse limit switch by passing in the CANcoder object.
 
std::string ToString () const override
 
std::string Serialize () const override
 
ctre::phoenix::StatusCode Deserialize (const std::string &to_deserialize) override
 

Public Attributes

signals::ForwardLimitTypeValue ForwardLimitType = signals::ForwardLimitTypeValue::NormallyOpen
 Determines if the forward limit switch is normally-open (default) or normally-closed.
 
bool ForwardLimitAutosetPositionEnable = false
 If enabled, the position is automatically set to a specific value, specified by ForwardLimitAutosetPositionValue, when the forward limit switch is asserted.
 
units::angle::turn_t ForwardLimitAutosetPositionValue = 0_tr
 The value to automatically set the position to when the forward limit switch is asserted.
 
bool ForwardLimitEnable = true
 If enabled, motor output is set to neutral when the forward limit switch is asserted and positive output is requested.
 
signals::ForwardLimitSourceValue ForwardLimitSource = signals::ForwardLimitSourceValue::LimitSwitchPin
 Determines where to poll the forward limit switch.
 
int ForwardLimitRemoteSensorID = 0
 Device ID of the remote device if using remote limit switch features for the forward limit switch.
 
signals::ReverseLimitTypeValue ReverseLimitType = signals::ReverseLimitTypeValue::NormallyOpen
 Determines if the reverse limit switch is normally-open (default) or normally-closed.
 
bool ReverseLimitAutosetPositionEnable = false
 If enabled, the position is automatically set to a specific value, specified by ReverseLimitAutosetPositionValue, when the reverse limit switch is asserted.
 
units::angle::turn_t ReverseLimitAutosetPositionValue = 0_tr
 The value to automatically set the position to when the reverse limit switch is asserted.
 
bool ReverseLimitEnable = true
 If enabled, motor output is set to neutral when reverse limit switch is asseted and negative output is requested.
 
signals::ReverseLimitSourceValue ReverseLimitSource = signals::ReverseLimitSourceValue::LimitSwitchPin
 Determines where to poll the reverse limit switch.
 
int ReverseLimitRemoteSensorID = 0
 Device ID of the remote device if using remote limit switch features for the reverse limit switch.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ HardwareLimitSwitchConfigs()

constexpr ctre::phoenix6::configs::HardwareLimitSwitchConfigs::HardwareLimitSwitchConfigs ( )
constexprdefault

Member Function Documentation

◆ Deserialize()

ctre::phoenix::StatusCode ctre::phoenix6::configs::HardwareLimitSwitchConfigs::Deserialize ( const std::string & to_deserialize)
inlineoverridevirtual

◆ Serialize()

std::string ctre::phoenix6::configs::HardwareLimitSwitchConfigs::Serialize ( ) const
inlineoverridevirtual

◆ ToString()

std::string ctre::phoenix6::configs::HardwareLimitSwitchConfigs::ToString ( ) const
inlineoverridevirtual

◆ WithForwardLimitAutosetPositionEnable()

constexpr HardwareLimitSwitchConfigs & ctre::phoenix6::configs::HardwareLimitSwitchConfigs::WithForwardLimitAutosetPositionEnable ( bool newForwardLimitAutosetPositionEnable)
inlineconstexpr

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
newForwardLimitAutosetPositionEnableParameter to modify
Returns
Itself

◆ WithForwardLimitAutosetPositionValue()

constexpr HardwareLimitSwitchConfigs & ctre::phoenix6::configs::HardwareLimitSwitchConfigs::WithForwardLimitAutosetPositionValue ( units::angle::turn_t newForwardLimitAutosetPositionValue)
inlineconstexpr

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
newForwardLimitAutosetPositionValueParameter to modify
Returns
Itself

◆ WithForwardLimitEnable()

constexpr HardwareLimitSwitchConfigs & ctre::phoenix6::configs::HardwareLimitSwitchConfigs::WithForwardLimitEnable ( bool newForwardLimitEnable)
inlineconstexpr

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
newForwardLimitEnableParameter to modify
Returns
Itself

◆ WithForwardLimitRemoteCANcoder()

HardwareLimitSwitchConfigs & ctre::phoenix6::configs::HardwareLimitSwitchConfigs::WithForwardLimitRemoteCANcoder ( const hardware::core::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
deviceCANcoder reference to use for RemoteCANcoder forward limit switch
Returns
Itself

◆ WithForwardLimitRemoteSensorID()

constexpr HardwareLimitSwitchConfigs & ctre::phoenix6::configs::HardwareLimitSwitchConfigs::WithForwardLimitRemoteSensorID ( int newForwardLimitRemoteSensorID)
inlineconstexpr

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
newForwardLimitRemoteSensorIDParameter to modify
Returns
Itself

◆ WithForwardLimitRemoteTalonFX()

HardwareLimitSwitchConfigs & ctre::phoenix6::configs::HardwareLimitSwitchConfigs::WithForwardLimitRemoteTalonFX ( const hardware::core::CoreTalonFX & device)

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
deviceTalonFX reference to use for RemoteTalonFX forward limit switch
Returns
Itself

◆ WithForwardLimitSource()

constexpr HardwareLimitSwitchConfigs & ctre::phoenix6::configs::HardwareLimitSwitchConfigs::WithForwardLimitSource ( signals::ForwardLimitSourceValue newForwardLimitSource)
inlineconstexpr

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
newForwardLimitSourceParameter to modify
Returns
Itself

◆ WithForwardLimitType()

constexpr HardwareLimitSwitchConfigs & ctre::phoenix6::configs::HardwareLimitSwitchConfigs::WithForwardLimitType ( signals::ForwardLimitTypeValue newForwardLimitType)
inlineconstexpr

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
newForwardLimitTypeParameter to modify
Returns
Itself

◆ WithReverseLimitAutosetPositionEnable()

constexpr HardwareLimitSwitchConfigs & ctre::phoenix6::configs::HardwareLimitSwitchConfigs::WithReverseLimitAutosetPositionEnable ( bool newReverseLimitAutosetPositionEnable)
inlineconstexpr

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
newReverseLimitAutosetPositionEnableParameter to modify
Returns
Itself

◆ WithReverseLimitAutosetPositionValue()

constexpr HardwareLimitSwitchConfigs & ctre::phoenix6::configs::HardwareLimitSwitchConfigs::WithReverseLimitAutosetPositionValue ( units::angle::turn_t newReverseLimitAutosetPositionValue)
inlineconstexpr

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
newReverseLimitAutosetPositionValueParameter to modify
Returns
Itself

◆ WithReverseLimitEnable()

constexpr HardwareLimitSwitchConfigs & ctre::phoenix6::configs::HardwareLimitSwitchConfigs::WithReverseLimitEnable ( bool newReverseLimitEnable)
inlineconstexpr

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
newReverseLimitEnableParameter to modify
Returns
Itself

◆ WithReverseLimitRemoteCANcoder()

HardwareLimitSwitchConfigs & ctre::phoenix6::configs::HardwareLimitSwitchConfigs::WithReverseLimitRemoteCANcoder ( const hardware::core::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
deviceCANcoder reference to use for RemoteCANcoder reverse limit switch
Returns
Itself

◆ WithReverseLimitRemoteSensorID()

constexpr HardwareLimitSwitchConfigs & ctre::phoenix6::configs::HardwareLimitSwitchConfigs::WithReverseLimitRemoteSensorID ( int newReverseLimitRemoteSensorID)
inlineconstexpr

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
newReverseLimitRemoteSensorIDParameter to modify
Returns
Itself

◆ WithReverseLimitRemoteTalonFX()

HardwareLimitSwitchConfigs & ctre::phoenix6::configs::HardwareLimitSwitchConfigs::WithReverseLimitRemoteTalonFX ( const hardware::core::CoreTalonFX & device)

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
deviceTalonFX reference to use for RemoteTalonFX reverse limit switch
Returns
Itself

◆ WithReverseLimitSource()

constexpr HardwareLimitSwitchConfigs & ctre::phoenix6::configs::HardwareLimitSwitchConfigs::WithReverseLimitSource ( signals::ReverseLimitSourceValue newReverseLimitSource)
inlineconstexpr

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
newReverseLimitSourceParameter to modify
Returns
Itself

◆ WithReverseLimitType()

constexpr HardwareLimitSwitchConfigs & ctre::phoenix6::configs::HardwareLimitSwitchConfigs::WithReverseLimitType ( signals::ReverseLimitTypeValue newReverseLimitType)
inlineconstexpr

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
newReverseLimitTypeParameter to modify
Returns
Itself

Member Data Documentation

◆ ForwardLimitAutosetPositionEnable

bool ctre::phoenix6::configs::HardwareLimitSwitchConfigs::ForwardLimitAutosetPositionEnable = false

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

units::angle::turn_t ctre::phoenix6::configs::HardwareLimitSwitchConfigs::ForwardLimitAutosetPositionValue = 0_tr

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

bool ctre::phoenix6::configs::HardwareLimitSwitchConfigs::ForwardLimitEnable = true

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

  • Default Value: True

◆ ForwardLimitRemoteSensorID

int ctre::phoenix6::configs::HardwareLimitSwitchConfigs::ForwardLimitRemoteSensorID = 0

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:

◆ ForwardLimitSource

signals::ForwardLimitSourceValue ctre::phoenix6::configs::HardwareLimitSwitchConfigs::ForwardLimitSource = signals::ForwardLimitSourceValue::LimitSwitchPin

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

◆ ForwardLimitType

signals::ForwardLimitTypeValue ctre::phoenix6::configs::HardwareLimitSwitchConfigs::ForwardLimitType = signals::ForwardLimitTypeValue::NormallyOpen

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

◆ ReverseLimitAutosetPositionEnable

bool ctre::phoenix6::configs::HardwareLimitSwitchConfigs::ReverseLimitAutosetPositionEnable = false

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

units::angle::turn_t ctre::phoenix6::configs::HardwareLimitSwitchConfigs::ReverseLimitAutosetPositionValue = 0_tr

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

bool ctre::phoenix6::configs::HardwareLimitSwitchConfigs::ReverseLimitEnable = true

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

  • Default Value: True

◆ ReverseLimitRemoteSensorID

int ctre::phoenix6::configs::HardwareLimitSwitchConfigs::ReverseLimitRemoteSensorID = 0

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:

◆ ReverseLimitSource

signals::ReverseLimitSourceValue ctre::phoenix6::configs::HardwareLimitSwitchConfigs::ReverseLimitSource = signals::ReverseLimitSourceValue::LimitSwitchPin

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

◆ ReverseLimitType

signals::ReverseLimitTypeValue ctre::phoenix6::configs::HardwareLimitSwitchConfigs::ReverseLimitType = signals::ReverseLimitTypeValue::NormallyOpen

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


The documentation for this class was generated from the following file: