CTRE Phoenix 6 C++ 25.2.1
Loading...
Searching...
No Matches
ctre::phoenix6::hardware::core::CoreCANdi Class Reference

Class for CANdi, a CAN digital input device that detects when a digital signal is asserted or deasserted. More...

#include <ctre/phoenix6/core/CoreCANdi.hpp>

Inheritance diagram for ctre::phoenix6::hardware::core::CoreCANdi:
ctre::phoenix6::hardware::ParentDevice ctre::phoenix6::hardware::CANdi

Public Types

using Configuration = configs::CANdiConfiguration
 

Public Member Functions

 CoreCANdi (int deviceId, std::string canbus="")
 Constructs a new CANdi object.
 
 CoreCANdi (int deviceId, CANBus canbus)
 Constructs a new CANdi object.
 
configs::CANdiConfiguratorGetConfigurator ()
 Gets the configurator for this CANdi.
 
configs::CANdiConfigurator const & GetConfigurator () const
 Gets the configurator for this CANdi.
 
sim::CANdiSimStateGetSimState ()
 Get the simulation state for this device.
 
StatusSignal< int > & GetVersionMajor (bool refresh=true)
 App Major Version number.
 
StatusSignal< int > & GetVersionMinor (bool refresh=true)
 App Minor Version number.
 
StatusSignal< int > & GetVersionBugfix (bool refresh=true)
 App Bugfix Version number.
 
StatusSignal< int > & GetVersionBuild (bool refresh=true)
 App Build Version number.
 
StatusSignal< int > & GetVersion (bool refresh=true)
 Full Version of firmware in device.
 
StatusSignal< int > & GetFaultField (bool refresh=true)
 Integer representing all fault flags reported by the device.
 
StatusSignal< int > & GetStickyFaultField (bool refresh=true)
 Integer representing all (persistent) sticky fault flags reported by the device.
 
StatusSignal< bool > & GetIsProLicensed (bool refresh=true)
 Whether the device is Phoenix Pro licensed.
 
StatusSignal< signals::S1StateValue > & GetS1State (bool refresh=true)
 State of the Signal 1 input (S1IN).
 
StatusSignal< signals::S2StateValue > & GetS2State (bool refresh=true)
 State of the Signal 2 input (S2IN).
 
StatusSignal< units::angle::turn_t > & GetQuadraturePosition (bool refresh=true)
 Position from a quadrature encoder sensor connected to both the S1IN and S2IN inputs.
 
StatusSignal< units::time::microsecond_t > & GetPWM1RiseToRise (bool refresh=true)
 Measured rise to rise time of the PWM signal at the S1 input of CANdi.
 
StatusSignal< units::angle::turn_t > & GetPWM1Position (bool refresh=true)
 Measured position of the PWM sensor at the S1 input of CANdi.
 
StatusSignal< units::angular_velocity::turns_per_second_t > & GetPWM1Velocity (bool refresh=true)
 Measured velocity of the PWM sensor at the S1 input of CANdi.
 
StatusSignal< units::time::microsecond_t > & GetPWM2RiseToRise (bool refresh=true)
 Measured rise to rise time of the PWM signal at the S2 input of CANdi.
 
StatusSignal< units::angle::turn_t > & GetPWM2Position (bool refresh=true)
 Measured position of the PWM sensor at the S2 input of CANdi.
 
StatusSignal< bool > & GetOvercurrent (bool refresh=true)
 True when the CANdi is in overcurrent protection mode.
 
StatusSignal< units::voltage::volt_t > & GetSupplyVoltage (bool refresh=true)
 Measured supply voltage to the CANdi.
 
StatusSignal< units::current::ampere_t > & GetOutputCurrent (bool refresh=true)
 Measured output current.
 
StatusSignal< units::angular_velocity::turns_per_second_t > & GetPWM2Velocity (bool refresh=true)
 Measured velocity of the PWM sensor at the S2 input of CANdi.
 
StatusSignal< units::angular_velocity::turns_per_second_t > & GetQuadratureVelocity (bool refresh=true)
 Velocity from a quadrature encoder sensor connected to both the S1IN and S2IN inputs.
 
StatusSignal< bool > & GetS1Closed (bool refresh=true)
 True if the Signal 1 input (S1IN) matches the configured S1 Closed State.
 
StatusSignal< bool > & GetS2Closed (bool refresh=true)
 True if the Signal 2 input (S2IN) matches the configured S2 Closed State.
 
StatusSignal< bool > & GetFault_Hardware (bool refresh=true)
 Hardware fault occurred.
 
StatusSignal< bool > & GetStickyFault_Hardware (bool refresh=true)
 Hardware fault occurred.
 
StatusSignal< bool > & GetFault_Undervoltage (bool refresh=true)
 Device supply voltage dropped to near brownout levels.
 
StatusSignal< bool > & GetStickyFault_Undervoltage (bool refresh=true)
 Device supply voltage dropped to near brownout levels.
 
StatusSignal< bool > & GetFault_BootDuringEnable (bool refresh=true)
 Device boot while detecting the enable signal.
 
StatusSignal< bool > & GetStickyFault_BootDuringEnable (bool refresh=true)
 Device boot while detecting the enable signal.
 
StatusSignal< bool > & GetFault_UnlicensedFeatureInUse (bool refresh=true)
 An unlicensed feature is in use, device may not behave as expected.
 
StatusSignal< bool > & GetStickyFault_UnlicensedFeatureInUse (bool refresh=true)
 An unlicensed feature is in use, device may not behave as expected.
 
StatusSignal< bool > & GetFault_5V (bool refresh=true)
 CANdi has detected a 5V fault.
 
StatusSignal< bool > & GetStickyFault_5V (bool refresh=true)
 CANdi has detected a 5V fault.
 
ctre::phoenix::StatusCode SetControl (const controls::ControlRequest &request)
 Control device with generic control request object.
 
ctre::phoenix::StatusCode SetQuadraturePosition (units::angle::turn_t newValue, units::time::second_t timeoutSeconds)
 Sets the position of the quadrature input.
 
ctre::phoenix::StatusCode SetQuadraturePosition (units::angle::turn_t newValue)
 Sets the position of the quadrature input.
 
ctre::phoenix::StatusCode ClearStickyFaults (units::time::second_t timeoutSeconds)
 Clear the sticky faults in the device.
 
ctre::phoenix::StatusCode ClearStickyFaults ()
 Clear the sticky faults in the device.
 
ctre::phoenix::StatusCode ClearStickyFault_Hardware (units::time::second_t timeoutSeconds)
 Clear sticky fault: Hardware fault occurred.
 
ctre::phoenix::StatusCode ClearStickyFault_Hardware ()
 Clear sticky fault: Hardware fault occurred.
 
ctre::phoenix::StatusCode ClearStickyFault_Undervoltage (units::time::second_t timeoutSeconds)
 Clear sticky fault: Device supply voltage dropped to near brownout levels.
 
ctre::phoenix::StatusCode ClearStickyFault_Undervoltage ()
 Clear sticky fault: Device supply voltage dropped to near brownout levels.
 
ctre::phoenix::StatusCode ClearStickyFault_BootDuringEnable (units::time::second_t timeoutSeconds)
 Clear sticky fault: Device boot while detecting the enable signal.
 
ctre::phoenix::StatusCode ClearStickyFault_BootDuringEnable ()
 Clear sticky fault: Device boot while detecting the enable signal.
 
ctre::phoenix::StatusCode ClearStickyFault_UnlicensedFeatureInUse (units::time::second_t timeoutSeconds)
 Clear sticky fault: An unlicensed feature is in use, device may not behave as expected.
 
ctre::phoenix::StatusCode ClearStickyFault_UnlicensedFeatureInUse ()
 Clear sticky fault: An unlicensed feature is in use, device may not behave as expected.
 
ctre::phoenix::StatusCode ClearStickyFault_5V (units::time::second_t timeoutSeconds)
 Clear sticky fault: CANdi has detected a 5V fault.
 
ctre::phoenix::StatusCode ClearStickyFault_5V ()
 Clear sticky fault: CANdi has detected a 5V fault.
 
- Public Member Functions inherited from ctre::phoenix6::hardware::ParentDevice
 ParentDevice (int deviceID, std::string model, std::string canbus)
 
virtual ~ParentDevice ()=default
 
 ParentDevice (ParentDevice const &)=delete
 
ParentDeviceoperator= (ParentDevice const &)=delete
 
int GetDeviceID () const
 
const std::string & GetNetwork () const
 
uint64_t GetDeviceHash () const
 Gets a number unique for this device's hardware type and ID.
 
std::shared_ptr< const controls::ControlRequestGetAppliedControl () const
 Get the latest applied control.
 
std::shared_ptr< controls::ControlRequestGetAppliedControl ()
 Get the latest applied control.
 
bool HasResetOccurred ()
 
std::function< bool()> GetResetOccurredChecker () const
 
bool IsConnected (units::second_t maxLatencySeconds=500_ms)
 Returns whether the device is still connected to the robot.
 
StatusSignal< double > & GetGenericSignal (uint32_t signal, bool refresh=true)
 This is a reserved routine for internal testing.
 
ctre::phoenix::StatusCode OptimizeBusUtilization (units::frequency::hertz_t optimizedFreqHz=0_Hz, units::time::second_t timeoutSeconds=100_ms)
 Optimizes the device's bus utilization by reducing the update frequencies of its status signals.
 
ctre::phoenix::StatusCode ResetSignalFrequencies (units::time::second_t timeoutSeconds=100_ms)
 Resets the update frequencies of all the device's status signals to the defaults.
 

Additional Inherited Members

- Static Public Member Functions inherited from ctre::phoenix6::hardware::ParentDevice
template<typename... Devices, typename = std::enable_if_t<is_all_device_v<Devices...>>>
static ctre::phoenix::StatusCode OptimizeBusUtilizationForAll (Devices &... devices)
 Optimizes the bus utilization of the provided devices by reducing the update frequencies of their status signals.
 
static ctre::phoenix::StatusCode OptimizeBusUtilizationForAll (const std::vector< ParentDevice * > &devices)
 Optimizes the bus utilization of the provided devices by reducing the update frequencies of their status signals.
 
template<size_t N>
static ctre::phoenix::StatusCode OptimizeBusUtilizationForAll (const std::array< ParentDevice *, N > &devices)
 Optimizes the bus utilization of the provided devices by reducing the update frequencies of their status signals.
 
template<typename... Devices, typename = std::enable_if_t<is_all_device_v<Devices...>>>
static ctre::phoenix::StatusCode OptimizeBusUtilizationForAll (units::frequency::hertz_t optimizedFreqHz, Devices &... devices)
 Optimizes the bus utilization of the provided devices by reducing the update frequencies of their status signals.
 
static ctre::phoenix::StatusCode OptimizeBusUtilizationForAll (units::frequency::hertz_t optimizedFreqHz, const std::vector< ParentDevice * > &devices)
 Optimizes the bus utilization of the provided devices by reducing the update frequencies of their status signals.
 
template<size_t N>
static ctre::phoenix::StatusCode OptimizeBusUtilizationForAll (units::frequency::hertz_t optimizedFreqHz, const std::array< ParentDevice *, N > &devices)
 Optimizes the bus utilization of the provided devices by reducing the update frequencies of their status signals.
 
template<typename... Devices, typename = std::enable_if_t<is_all_device_v<Devices...>>>
static ctre::phoenix::StatusCode ResetSignalFrequenciesForAll (Devices &... devices)
 Resets the update frequencies of all the devices' status signals to the defaults.
 
static ctre::phoenix::StatusCode ResetSignalFrequenciesForAll (const std::vector< ParentDevice * > &devices)
 Resets the update frequencies of all the devices' status signals to the defaults.
 
template<size_t N>
static ctre::phoenix::StatusCode ResetSignalFrequenciesForAll (const std::array< ParentDevice *, N > &devices)
 Resets the update frequencies of all the devices' status signals to the defaults.
 
- Protected Member Functions inherited from ctre::phoenix6::hardware::ParentDevice
virtual ctre::phoenix::StatusCode SetControlPrivate (const controls::ControlRequest &request)
 
template<typename T >
StatusSignal< T > & LookupStatusSignal (uint16_t spn, std::string signalName, bool reportOnConstruction, bool refresh)
 
template<typename T >
StatusSignal< T > & LookupStatusSignal (uint16_t spn, std::function< std::map< uint16_t, std::string >()> mapFiller, std::string signalName, bool reportOnConstruction, bool refresh)
 
template<typename T , typename U >
StatusSignal< T > LookupDimensionlessStatusSignal (uint16_t spn, std::string signalName, bool refresh)
 Returns a unitless version of the StatusSignal by value.
 
- Protected Attributes inherited from ctre::phoenix6::hardware::ParentDevice
DeviceIdentifier deviceIdentifier
 
- Static Protected Attributes inherited from ctre::phoenix6::hardware::ParentDevice
static controls::EmptyControl _emptyControl {}
 
template<typename... Devices>
static constexpr bool is_all_device_v = is_all_device<Devices...>::value
 Whether all types passed in are subclasses of ParentDevice.
 

Detailed Description

Class for CANdi, a CAN digital input device that detects when a digital signal is asserted or deasserted.

Member Typedef Documentation

◆ Configuration

Constructor & Destructor Documentation

◆ CoreCANdi() [1/2]

ctre::phoenix6::hardware::core::CoreCANdi::CoreCANdi ( int deviceId,
std::string canbus = "" )

Constructs a new CANdi object.

Parameters
deviceIdID of the device, as configured in Phoenix Tuner.
canbusName of the CAN bus this device is on. Possible CAN bus strings are:
  • "rio" for the native roboRIO CAN bus
  • CANivore name or serial number
  • SocketCAN interface (non-FRC Linux only)
  • "*" for any CANivore seen by the program
  • empty string (default) to select the default for the system:
    • "rio" on roboRIO
    • "can0" on Linux
    • "*" on Windows

◆ CoreCANdi() [2/2]

ctre::phoenix6::hardware::core::CoreCANdi::CoreCANdi ( int deviceId,
CANBus canbus )
inline

Constructs a new CANdi object.

Parameters
deviceIdID of the device, as configured in Phoenix Tuner.
canbusThe CAN bus this device is on.

Member Function Documentation

◆ ClearStickyFault_5V() [1/2]

ctre::phoenix::StatusCode ctre::phoenix6::hardware::core::CoreCANdi::ClearStickyFault_5V ( )
inline

Clear sticky fault: CANdi has detected a 5V fault.

This may be due to overcurrent or a short-circuit.

This will wait up to 0.100 seconds (100ms) by default.

Returns
StatusCode of the set command

◆ ClearStickyFault_5V() [2/2]

ctre::phoenix::StatusCode ctre::phoenix6::hardware::core::CoreCANdi::ClearStickyFault_5V ( units::time::second_t timeoutSeconds)
inline

Clear sticky fault: CANdi has detected a 5V fault.

This may be due to overcurrent or a short-circuit.

Parameters
timeoutSecondsMaximum time to wait up to in seconds.
Returns
StatusCode of the set command

◆ ClearStickyFault_BootDuringEnable() [1/2]

ctre::phoenix::StatusCode ctre::phoenix6::hardware::core::CoreCANdi::ClearStickyFault_BootDuringEnable ( )
inline

Clear sticky fault: Device boot while detecting the enable signal.

This will wait up to 0.100 seconds (100ms) by default.

Returns
StatusCode of the set command

◆ ClearStickyFault_BootDuringEnable() [2/2]

ctre::phoenix::StatusCode ctre::phoenix6::hardware::core::CoreCANdi::ClearStickyFault_BootDuringEnable ( units::time::second_t timeoutSeconds)
inline

Clear sticky fault: Device boot while detecting the enable signal.

Parameters
timeoutSecondsMaximum time to wait up to in seconds.
Returns
StatusCode of the set command

◆ ClearStickyFault_Hardware() [1/2]

ctre::phoenix::StatusCode ctre::phoenix6::hardware::core::CoreCANdi::ClearStickyFault_Hardware ( )
inline

Clear sticky fault: Hardware fault occurred.

This will wait up to 0.100 seconds (100ms) by default.

Returns
StatusCode of the set command

◆ ClearStickyFault_Hardware() [2/2]

ctre::phoenix::StatusCode ctre::phoenix6::hardware::core::CoreCANdi::ClearStickyFault_Hardware ( units::time::second_t timeoutSeconds)
inline

Clear sticky fault: Hardware fault occurred.

Parameters
timeoutSecondsMaximum time to wait up to in seconds.
Returns
StatusCode of the set command

◆ ClearStickyFault_Undervoltage() [1/2]

ctre::phoenix::StatusCode ctre::phoenix6::hardware::core::CoreCANdi::ClearStickyFault_Undervoltage ( )
inline

Clear sticky fault: Device supply voltage dropped to near brownout levels.

This will wait up to 0.100 seconds (100ms) by default.

Returns
StatusCode of the set command

◆ ClearStickyFault_Undervoltage() [2/2]

ctre::phoenix::StatusCode ctre::phoenix6::hardware::core::CoreCANdi::ClearStickyFault_Undervoltage ( units::time::second_t timeoutSeconds)
inline

Clear sticky fault: Device supply voltage dropped to near brownout levels.

Parameters
timeoutSecondsMaximum time to wait up to in seconds.
Returns
StatusCode of the set command

◆ ClearStickyFault_UnlicensedFeatureInUse() [1/2]

ctre::phoenix::StatusCode ctre::phoenix6::hardware::core::CoreCANdi::ClearStickyFault_UnlicensedFeatureInUse ( )
inline

Clear sticky fault: An unlicensed feature is in use, device may not behave as expected.

This will wait up to 0.100 seconds (100ms) by default.

Returns
StatusCode of the set command

◆ ClearStickyFault_UnlicensedFeatureInUse() [2/2]

ctre::phoenix::StatusCode ctre::phoenix6::hardware::core::CoreCANdi::ClearStickyFault_UnlicensedFeatureInUse ( units::time::second_t timeoutSeconds)
inline

Clear sticky fault: An unlicensed feature is in use, device may not behave as expected.

Parameters
timeoutSecondsMaximum time to wait up to in seconds.
Returns
StatusCode of the set command

◆ ClearStickyFaults() [1/2]

ctre::phoenix::StatusCode ctre::phoenix6::hardware::core::CoreCANdi::ClearStickyFaults ( )
inline

Clear the sticky faults in the device.

This typically has no impact on the device functionality. Instead, it just clears telemetry faults that are accessible via API and Tuner Self-Test.

This will wait up to 0.100 seconds (100ms) by default.

Returns
StatusCode of the set command

◆ ClearStickyFaults() [2/2]

ctre::phoenix::StatusCode ctre::phoenix6::hardware::core::CoreCANdi::ClearStickyFaults ( units::time::second_t timeoutSeconds)
inline

Clear the sticky faults in the device.

This typically has no impact on the device functionality. Instead, it just clears telemetry faults that are accessible via API and Tuner Self-Test.

Parameters
timeoutSecondsMaximum time to wait up to in seconds.
Returns
StatusCode of the set command

◆ GetConfigurator() [1/2]

configs::CANdiConfigurator & ctre::phoenix6::hardware::core::CoreCANdi::GetConfigurator ( )
inline

Gets the configurator for this CANdi.

Gets the configurator for this CANdi

Returns
Configurator for this CANdi

◆ GetConfigurator() [2/2]

configs::CANdiConfigurator const & ctre::phoenix6::hardware::core::CoreCANdi::GetConfigurator ( ) const
inline

Gets the configurator for this CANdi.

Gets the configurator for this CANdi

Returns
Configurator for this CANdi

◆ GetFault_5V()

StatusSignal< bool > & ctre::phoenix6::hardware::core::CoreCANdi::GetFault_5V ( bool refresh = true)

CANdi has detected a 5V fault.

This may be due to overcurrent or a short-circuit.

  • Default Value: False

Default Rates:

  • CAN: 4.0 Hz

This refreshes and returns a cached StatusSignal object.

Parameters
refreshWhether to refresh the StatusSignal before returning it; defaults to true
Returns
Fault_5V Status Signal Object

◆ GetFault_BootDuringEnable()

StatusSignal< bool > & ctre::phoenix6::hardware::core::CoreCANdi::GetFault_BootDuringEnable ( bool refresh = true)

Device boot while detecting the enable signal.

  • Default Value: False

Default Rates:

  • CAN: 4.0 Hz

This refreshes and returns a cached StatusSignal object.

Parameters
refreshWhether to refresh the StatusSignal before returning it; defaults to true
Returns
Fault_BootDuringEnable Status Signal Object

◆ GetFault_Hardware()

StatusSignal< bool > & ctre::phoenix6::hardware::core::CoreCANdi::GetFault_Hardware ( bool refresh = true)

Hardware fault occurred.

  • Default Value: False

Default Rates:

  • CAN: 4.0 Hz

This refreshes and returns a cached StatusSignal object.

Parameters
refreshWhether to refresh the StatusSignal before returning it; defaults to true
Returns
Fault_Hardware Status Signal Object

◆ GetFault_Undervoltage()

StatusSignal< bool > & ctre::phoenix6::hardware::core::CoreCANdi::GetFault_Undervoltage ( bool refresh = true)

Device supply voltage dropped to near brownout levels.

  • Default Value: False

Default Rates:

  • CAN: 4.0 Hz

This refreshes and returns a cached StatusSignal object.

Parameters
refreshWhether to refresh the StatusSignal before returning it; defaults to true
Returns
Fault_Undervoltage Status Signal Object

◆ GetFault_UnlicensedFeatureInUse()

StatusSignal< bool > & ctre::phoenix6::hardware::core::CoreCANdi::GetFault_UnlicensedFeatureInUse ( bool refresh = true)

An unlicensed feature is in use, device may not behave as expected.

  • Default Value: False

Default Rates:

  • CAN: 4.0 Hz

This refreshes and returns a cached StatusSignal object.

Parameters
refreshWhether to refresh the StatusSignal before returning it; defaults to true
Returns
Fault_UnlicensedFeatureInUse Status Signal Object

◆ GetFaultField()

StatusSignal< int > & ctre::phoenix6::hardware::core::CoreCANdi::GetFaultField ( bool refresh = true)

Integer representing all fault flags reported by the device.

These are device specific and are not used directly in typical applications. Use the signal specific GetFault_*() methods instead.

  • Minimum Value: 0
  • Maximum Value: 4294967295
  • Default Value: 0
  • Units:

Default Rates:

  • CAN: 4.0 Hz

This refreshes and returns a cached StatusSignal object.

Parameters
refreshWhether to refresh the StatusSignal before returning it; defaults to true
Returns
FaultField Status Signal Object

◆ GetIsProLicensed()

StatusSignal< bool > & ctre::phoenix6::hardware::core::CoreCANdi::GetIsProLicensed ( bool refresh = true)

Whether the device is Phoenix Pro licensed.

  • Default Value: False

Default Rates:

  • CAN: 4.0 Hz

This refreshes and returns a cached StatusSignal object.

Parameters
refreshWhether to refresh the StatusSignal before returning it; defaults to true
Returns
IsProLicensed Status Signal Object

◆ GetOutputCurrent()

StatusSignal< units::current::ampere_t > & ctre::phoenix6::hardware::core::CoreCANdi::GetOutputCurrent ( bool refresh = true)

Measured output current.

This includes both Vbat and 5V output current.

  • Minimum Value: 0.0
  • Maximum Value: 0.51
  • Default Value: 0
  • Units: A

Default Rates:

  • CAN 2.0: 100.0 Hz
  • CAN FD: 100.0 Hz (TimeSynced with Pro)

This refreshes and returns a cached StatusSignal object.

Parameters
refreshWhether to refresh the StatusSignal before returning it; defaults to true
Returns
OutputCurrent Status Signal Object

◆ GetOvercurrent()

StatusSignal< bool > & ctre::phoenix6::hardware::core::CoreCANdi::GetOvercurrent ( bool refresh = true)

True when the CANdi is in overcurrent protection mode.

This may be due to either overcurrent or a short-circuit.

  • Default Value: 0

Default Rates:

  • CAN 2.0: 100.0 Hz
  • CAN FD: 100.0 Hz (TimeSynced with Pro)

This refreshes and returns a cached StatusSignal object.

Parameters
refreshWhether to refresh the StatusSignal before returning it; defaults to true
Returns
Overcurrent Status Signal Object

◆ GetPWM1Position()

StatusSignal< units::angle::turn_t > & ctre::phoenix6::hardware::core::CoreCANdi::GetPWM1Position ( bool refresh = true)

Measured position of the PWM sensor at the S1 input of CANdi.

  • Minimum Value: -16384.0
  • Maximum Value: 16383.999755859375
  • Default Value: 0
  • Units: rotations

Default Rates:

  • CAN 2.0: 20.0 Hz
  • CAN FD: 100.0 Hz (TimeSynced with Pro)

This refreshes and returns a cached StatusSignal object.

Parameters
refreshWhether to refresh the StatusSignal before returning it; defaults to true
Returns
PWM1Position Status Signal Object

◆ GetPWM1RiseToRise()

StatusSignal< units::time::microsecond_t > & ctre::phoenix6::hardware::core::CoreCANdi::GetPWM1RiseToRise ( bool refresh = true)

Measured rise to rise time of the PWM signal at the S1 input of CANdi.

  • Minimum Value: 0
  • Maximum Value: 131070
  • Default Value: 0
  • Units: us

Default Rates:

  • CAN 2.0: 20.0 Hz
  • CAN FD: 100.0 Hz (TimeSynced with Pro)

This refreshes and returns a cached StatusSignal object.

Parameters
refreshWhether to refresh the StatusSignal before returning it; defaults to true
Returns
PWM1RiseToRise Status Signal Object

◆ GetPWM1Velocity()

StatusSignal< units::angular_velocity::turns_per_second_t > & ctre::phoenix6::hardware::core::CoreCANdi::GetPWM1Velocity ( bool refresh = true)

Measured velocity of the PWM sensor at the S1 input of CANdi.

  • Minimum Value: -512.0
  • Maximum Value: 511.998046875
  • Default Value: 0
  • Units: rotations per second

Default Rates:

  • CAN 2.0: 20.0 Hz
  • CAN FD: 100.0 Hz (TimeSynced with Pro)

This refreshes and returns a cached StatusSignal object.

Parameters
refreshWhether to refresh the StatusSignal before returning it; defaults to true
Returns
PWM1Velocity Status Signal Object

◆ GetPWM2Position()

StatusSignal< units::angle::turn_t > & ctre::phoenix6::hardware::core::CoreCANdi::GetPWM2Position ( bool refresh = true)

Measured position of the PWM sensor at the S2 input of CANdi.

  • Minimum Value: -16384.0
  • Maximum Value: 16383.999755859375
  • Default Value: 0
  • Units: rotations

Default Rates:

  • CAN 2.0: 20.0 Hz
  • CAN FD: 100.0 Hz (TimeSynced with Pro)

This refreshes and returns a cached StatusSignal object.

Parameters
refreshWhether to refresh the StatusSignal before returning it; defaults to true
Returns
PWM2Position Status Signal Object

◆ GetPWM2RiseToRise()

StatusSignal< units::time::microsecond_t > & ctre::phoenix6::hardware::core::CoreCANdi::GetPWM2RiseToRise ( bool refresh = true)

Measured rise to rise time of the PWM signal at the S2 input of CANdi.

  • Minimum Value: 0
  • Maximum Value: 131070
  • Default Value: 0
  • Units: us

Default Rates:

  • CAN 2.0: 20.0 Hz
  • CAN FD: 100.0 Hz (TimeSynced with Pro)

This refreshes and returns a cached StatusSignal object.

Parameters
refreshWhether to refresh the StatusSignal before returning it; defaults to true
Returns
PWM2RiseToRise Status Signal Object

◆ GetPWM2Velocity()

StatusSignal< units::angular_velocity::turns_per_second_t > & ctre::phoenix6::hardware::core::CoreCANdi::GetPWM2Velocity ( bool refresh = true)

Measured velocity of the PWM sensor at the S2 input of CANdi.

  • Minimum Value: -512.0
  • Maximum Value: 511.998046875
  • Default Value: 0
  • Units: rotations per second

Default Rates:

  • CAN 2.0: 20.0 Hz
  • CAN FD: 100.0 Hz (TimeSynced with Pro)

This refreshes and returns a cached StatusSignal object.

Parameters
refreshWhether to refresh the StatusSignal before returning it; defaults to true
Returns
PWM2Velocity Status Signal Object

◆ GetQuadraturePosition()

StatusSignal< units::angle::turn_t > & ctre::phoenix6::hardware::core::CoreCANdi::GetQuadraturePosition ( bool refresh = true)

Position from a quadrature encoder sensor connected to both the S1IN and S2IN inputs.

  • Minimum Value: -16384.0
  • Maximum Value: 16383.999755859375
  • Default Value: 0
  • Units: rotations

Default Rates:

  • CAN 2.0: 20.0 Hz
  • CAN FD: 100.0 Hz (TimeSynced with Pro)

This refreshes and returns a cached StatusSignal object.

Parameters
refreshWhether to refresh the StatusSignal before returning it; defaults to true
Returns
QuadraturePosition Status Signal Object

◆ GetQuadratureVelocity()

StatusSignal< units::angular_velocity::turns_per_second_t > & ctre::phoenix6::hardware::core::CoreCANdi::GetQuadratureVelocity ( bool refresh = true)

Velocity from a quadrature encoder sensor connected to both the S1IN and S2IN inputs.

  • Minimum Value: -512.0
  • Maximum Value: 511.998046875
  • Default Value: 0
  • Units: rotations per second

Default Rates:

  • CAN 2.0: 20.0 Hz
  • CAN FD: 100.0 Hz (TimeSynced with Pro)

This refreshes and returns a cached StatusSignal object.

Parameters
refreshWhether to refresh the StatusSignal before returning it; defaults to true
Returns
QuadratureVelocity Status Signal Object

◆ GetS1Closed()

StatusSignal< bool > & ctre::phoenix6::hardware::core::CoreCANdi::GetS1Closed ( bool refresh = true)

True if the Signal 1 input (S1IN) matches the configured S1 Closed State.

Configure the S1 closed state in the Digitals configuration object to change when this is asserted.

  • Default Value: False

Default Rates:

  • CAN 2.0: 100.0 Hz
  • CAN FD: 100.0 Hz (TimeSynced with Pro)

This refreshes and returns a cached StatusSignal object.

Parameters
refreshWhether to refresh the StatusSignal before returning it; defaults to true
Returns
S1Closed Status Signal Object

◆ GetS1State()

StatusSignal< signals::S1StateValue > & ctre::phoenix6::hardware::core::CoreCANdi::GetS1State ( bool refresh = true)

State of the Signal 1 input (S1IN).

Default Rates:

  • CAN 2.0: 100.0 Hz
  • CAN FD: 100.0 Hz (TimeSynced with Pro)

This refreshes and returns a cached StatusSignal object.

Parameters
refreshWhether to refresh the StatusSignal before returning it; defaults to true
Returns
S1State Status Signal Object

◆ GetS2Closed()

StatusSignal< bool > & ctre::phoenix6::hardware::core::CoreCANdi::GetS2Closed ( bool refresh = true)

True if the Signal 2 input (S2IN) matches the configured S2 Closed State.

Configure the S2 closed state in the Digitals configuration object to change when this is asserted.

  • Default Value: False

Default Rates:

  • CAN 2.0: 100.0 Hz
  • CAN FD: 100.0 Hz (TimeSynced with Pro)

This refreshes and returns a cached StatusSignal object.

Parameters
refreshWhether to refresh the StatusSignal before returning it; defaults to true
Returns
S2Closed Status Signal Object

◆ GetS2State()

StatusSignal< signals::S2StateValue > & ctre::phoenix6::hardware::core::CoreCANdi::GetS2State ( bool refresh = true)

State of the Signal 2 input (S2IN).

Default Rates:

  • CAN 2.0: 100.0 Hz
  • CAN FD: 100.0 Hz (TimeSynced with Pro)

This refreshes and returns a cached StatusSignal object.

Parameters
refreshWhether to refresh the StatusSignal before returning it; defaults to true
Returns
S2State Status Signal Object

◆ GetSimState()

sim::CANdiSimState & ctre::phoenix6::hardware::core::CoreCANdi::GetSimState ( )
inline

Get the simulation state for this device.

This function reuses an allocated simulation state object, so it is safe to call this function multiple times in a robot loop.

Returns
Simulation state

◆ GetStickyFault_5V()

StatusSignal< bool > & ctre::phoenix6::hardware::core::CoreCANdi::GetStickyFault_5V ( bool refresh = true)

CANdi has detected a 5V fault.

This may be due to overcurrent or a short-circuit.

  • Default Value: False

Default Rates:

  • CAN: 4.0 Hz

This refreshes and returns a cached StatusSignal object.

Parameters
refreshWhether to refresh the StatusSignal before returning it; defaults to true
Returns
StickyFault_5V Status Signal Object

◆ GetStickyFault_BootDuringEnable()

StatusSignal< bool > & ctre::phoenix6::hardware::core::CoreCANdi::GetStickyFault_BootDuringEnable ( bool refresh = true)

Device boot while detecting the enable signal.

  • Default Value: False

Default Rates:

  • CAN: 4.0 Hz

This refreshes and returns a cached StatusSignal object.

Parameters
refreshWhether to refresh the StatusSignal before returning it; defaults to true
Returns
StickyFault_BootDuringEnable Status Signal Object

◆ GetStickyFault_Hardware()

StatusSignal< bool > & ctre::phoenix6::hardware::core::CoreCANdi::GetStickyFault_Hardware ( bool refresh = true)

Hardware fault occurred.

  • Default Value: False

Default Rates:

  • CAN: 4.0 Hz

This refreshes and returns a cached StatusSignal object.

Parameters
refreshWhether to refresh the StatusSignal before returning it; defaults to true
Returns
StickyFault_Hardware Status Signal Object

◆ GetStickyFault_Undervoltage()

StatusSignal< bool > & ctre::phoenix6::hardware::core::CoreCANdi::GetStickyFault_Undervoltage ( bool refresh = true)

Device supply voltage dropped to near brownout levels.

  • Default Value: False

Default Rates:

  • CAN: 4.0 Hz

This refreshes and returns a cached StatusSignal object.

Parameters
refreshWhether to refresh the StatusSignal before returning it; defaults to true
Returns
StickyFault_Undervoltage Status Signal Object

◆ GetStickyFault_UnlicensedFeatureInUse()

StatusSignal< bool > & ctre::phoenix6::hardware::core::CoreCANdi::GetStickyFault_UnlicensedFeatureInUse ( bool refresh = true)

An unlicensed feature is in use, device may not behave as expected.

  • Default Value: False

Default Rates:

  • CAN: 4.0 Hz

This refreshes and returns a cached StatusSignal object.

Parameters
refreshWhether to refresh the StatusSignal before returning it; defaults to true
Returns
StickyFault_UnlicensedFeatureInUse Status Signal Object

◆ GetStickyFaultField()

StatusSignal< int > & ctre::phoenix6::hardware::core::CoreCANdi::GetStickyFaultField ( bool refresh = true)

Integer representing all (persistent) sticky fault flags reported by the device.

These are device specific and are not used directly in typical applications. Use the signal specific GetStickyFault_*() methods instead.

  • Minimum Value: 0
  • Maximum Value: 4294967295
  • Default Value: 0
  • Units:

Default Rates:

  • CAN: 4.0 Hz

This refreshes and returns a cached StatusSignal object.

Parameters
refreshWhether to refresh the StatusSignal before returning it; defaults to true
Returns
StickyFaultField Status Signal Object

◆ GetSupplyVoltage()

StatusSignal< units::voltage::volt_t > & ctre::phoenix6::hardware::core::CoreCANdi::GetSupplyVoltage ( bool refresh = true)

Measured supply voltage to the CANdi.

  • Minimum Value: 4.0
  • Maximum Value: 29.5
  • Default Value: 0
  • Units: V

Default Rates:

  • CAN 2.0: 100.0 Hz
  • CAN FD: 100.0 Hz (TimeSynced with Pro)

This refreshes and returns a cached StatusSignal object.

Parameters
refreshWhether to refresh the StatusSignal before returning it; defaults to true
Returns
SupplyVoltage Status Signal Object

◆ GetVersion()

StatusSignal< int > & ctre::phoenix6::hardware::core::CoreCANdi::GetVersion ( bool refresh = true)

Full Version of firmware in device.

The format is a four byte value.

  • Minimum Value: 0
  • Maximum Value: 4294967295
  • Default Value: 0
  • Units:

Default Rates:

  • CAN: 4.0 Hz

This refreshes and returns a cached StatusSignal object.

Parameters
refreshWhether to refresh the StatusSignal before returning it; defaults to true
Returns
Version Status Signal Object

◆ GetVersionBugfix()

StatusSignal< int > & ctre::phoenix6::hardware::core::CoreCANdi::GetVersionBugfix ( bool refresh = true)

App Bugfix Version number.

  • Minimum Value: 0
  • Maximum Value: 255
  • Default Value: 0
  • Units:

Default Rates:

  • CAN: 4.0 Hz

This refreshes and returns a cached StatusSignal object.

Parameters
refreshWhether to refresh the StatusSignal before returning it; defaults to true
Returns
VersionBugfix Status Signal Object

◆ GetVersionBuild()

StatusSignal< int > & ctre::phoenix6::hardware::core::CoreCANdi::GetVersionBuild ( bool refresh = true)

App Build Version number.

  • Minimum Value: 0
  • Maximum Value: 255
  • Default Value: 0
  • Units:

Default Rates:

  • CAN: 4.0 Hz

This refreshes and returns a cached StatusSignal object.

Parameters
refreshWhether to refresh the StatusSignal before returning it; defaults to true
Returns
VersionBuild Status Signal Object

◆ GetVersionMajor()

StatusSignal< int > & ctre::phoenix6::hardware::core::CoreCANdi::GetVersionMajor ( bool refresh = true)

App Major Version number.

  • Minimum Value: 0
  • Maximum Value: 255
  • Default Value: 0
  • Units:

Default Rates:

  • CAN: 4.0 Hz

This refreshes and returns a cached StatusSignal object.

Parameters
refreshWhether to refresh the StatusSignal before returning it; defaults to true
Returns
VersionMajor Status Signal Object

◆ GetVersionMinor()

StatusSignal< int > & ctre::phoenix6::hardware::core::CoreCANdi::GetVersionMinor ( bool refresh = true)

App Minor Version number.

  • Minimum Value: 0
  • Maximum Value: 255
  • Default Value: 0
  • Units:

Default Rates:

  • CAN: 4.0 Hz

This refreshes and returns a cached StatusSignal object.

Parameters
refreshWhether to refresh the StatusSignal before returning it; defaults to true
Returns
VersionMinor Status Signal Object

◆ SetControl()

ctre::phoenix::StatusCode ctre::phoenix6::hardware::core::CoreCANdi::SetControl ( const controls::ControlRequest & request)
inline

Control device with generic control request object.

User must make sure the specified object is castable to a valid control request, otherwise this function will fail at run-time and return the NotSupported StatusCode

Parameters
requestControl object to request of the device
Returns
Status Code of the request, 0 is OK

◆ SetQuadraturePosition() [1/2]

ctre::phoenix::StatusCode ctre::phoenix6::hardware::core::CoreCANdi::SetQuadraturePosition ( units::angle::turn_t newValue)
inline

Sets the position of the quadrature input.

This will wait up to 0.100 seconds (100ms) by default.

Parameters
newValueValue to set to. Units are in rotations.
Returns
StatusCode of the set command

◆ SetQuadraturePosition() [2/2]

ctre::phoenix::StatusCode ctre::phoenix6::hardware::core::CoreCANdi::SetQuadraturePosition ( units::angle::turn_t newValue,
units::time::second_t timeoutSeconds )
inline

Sets the position of the quadrature input.

Parameters
newValueValue to set to. Units are in rotations.
timeoutSecondsMaximum time to wait up to in seconds.
Returns
StatusCode of the set command

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