CTRE Phoenix 6 C++ 24.3.0
ctre::phoenix6::hardware::core::CoreCANcoder Class Reference

Class for CANcoder, a CAN based magnetic encoder that provides absolute and relative position along with filtered velocity. More...

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

Inheritance diagram for ctre::phoenix6::hardware::core::CoreCANcoder:
ctre::phoenix6::hardware::ParentDevice ctre::phoenix6::hardware::CANcoder

Public Member Functions

 CoreCANcoder (int deviceId, std::string canbus="")
 Constructs a new CANcoder object. More...
 
 CoreCANcoder (CoreCANcoder &&)=default
 
CoreCANcoderoperator= (CoreCANcoder &&)=default
 
configs::CANcoderConfiguratorGetConfigurator ()
 Gets the configurator for this CANcoder. More...
 
configs::CANcoderConfigurator const & GetConfigurator () const
 Gets the configurator for this CANcoder. More...
 
sim::CANcoderSimStateGetSimState ()
 Get the simulation state for this device. More...
 
StatusSignal< int > & GetVersionMajor ()
 App Major Version number. More...
 
StatusSignal< int > & GetVersionMinor ()
 App Minor Version number. More...
 
StatusSignal< int > & GetVersionBugfix ()
 App Bugfix Version number. More...
 
StatusSignal< int > & GetVersionBuild ()
 App Build Version number. More...
 
StatusSignal< int > & GetVersion ()
 Full Version. More...
 
StatusSignal< int > & GetFaultField ()
 Integer representing all faults. More...
 
StatusSignal< int > & GetStickyFaultField ()
 Integer representing all sticky faults. More...
 
StatusSignal< units::angular_velocity::turns_per_second_t > & GetVelocity ()
 Velocity of the device. More...
 
StatusSignal< units::angle::turn_t > & GetPosition ()
 Position of the device. More...
 
StatusSignal< units::angle::turn_t > & GetAbsolutePosition ()
 Absolute Position of the device. More...
 
StatusSignal< units::angular_velocity::turns_per_second_t > & GetUnfilteredVelocity ()
 The unfiltered velocity reported by CANcoder. More...
 
StatusSignal< units::angle::turn_t > & GetPositionSinceBoot ()
 The relative position reported by the CANcoder since boot. More...
 
StatusSignal< units::voltage::volt_t > & GetSupplyVoltage ()
 Measured supply voltage to the CANcoder. More...
 
StatusSignal< signals::MagnetHealthValue > & GetMagnetHealth ()
 Magnet health as measured by CANcoder. More...
 
StatusSignal< bool > & GetIsProLicensed ()
 Whether the device is Phoenix Pro licensed. More...
 
StatusSignal< bool > & GetFault_Hardware ()
 Hardware fault occurred. More...
 
StatusSignal< bool > & GetStickyFault_Hardware ()
 Hardware fault occurred. More...
 
StatusSignal< bool > & GetFault_Undervoltage ()
 Device supply voltage dropped to near brownout levels. More...
 
StatusSignal< bool > & GetStickyFault_Undervoltage ()
 Device supply voltage dropped to near brownout levels. More...
 
StatusSignal< bool > & GetFault_BootDuringEnable ()
 Device boot while detecting the enable signal. More...
 
StatusSignal< bool > & GetStickyFault_BootDuringEnable ()
 Device boot while detecting the enable signal. More...
 
StatusSignal< bool > & GetFault_UnlicensedFeatureInUse ()
 An unlicensed feature is in use, device may not behave as expected. More...
 
StatusSignal< bool > & GetStickyFault_UnlicensedFeatureInUse ()
 An unlicensed feature is in use, device may not behave as expected. More...
 
StatusSignal< bool > & GetFault_BadMagnet ()
 The magnet distance is not correct or magnet is missing. More...
 
StatusSignal< bool > & GetStickyFault_BadMagnet ()
 The magnet distance is not correct or magnet is missing. More...
 
ctre::phoenix::StatusCode SetControl (controls::ControlRequest &request)
 Control motor with generic control request object. More...
 
ctre::phoenix::StatusCode SetControl (controls::ControlRequest &&request)
 Control motor with generic control request object. More...
 
ctre::phoenix::StatusCode SetPosition (units::angle::turn_t newValue, units::time::second_t timeoutSeconds)
 Sets the current position of the device. More...
 
ctre::phoenix::StatusCode SetPosition (units::angle::turn_t newValue)
 Sets the current position of the device. More...
 
ctre::phoenix::StatusCode ClearStickyFaults (units::time::second_t timeoutSeconds)
 Clear the sticky faults in the device. More...
 
ctre::phoenix::StatusCode ClearStickyFaults ()
 Clear the sticky faults in the device. More...
 
ctre::phoenix::StatusCode ClearStickyFault_Hardware (units::time::second_t timeoutSeconds)
 Clear sticky fault: Hardware fault occurred. More...
 
ctre::phoenix::StatusCode ClearStickyFault_Hardware ()
 Clear sticky fault: Hardware fault occurred. More...
 
ctre::phoenix::StatusCode ClearStickyFault_Undervoltage (units::time::second_t timeoutSeconds)
 Clear sticky fault: Device supply voltage dropped to near brownout levels. More...
 
ctre::phoenix::StatusCode ClearStickyFault_Undervoltage ()
 Clear sticky fault: Device supply voltage dropped to near brownout levels. More...
 
ctre::phoenix::StatusCode ClearStickyFault_BootDuringEnable (units::time::second_t timeoutSeconds)
 Clear sticky fault: Device boot while detecting the enable signal. More...
 
ctre::phoenix::StatusCode ClearStickyFault_BootDuringEnable ()
 Clear sticky fault: Device boot while detecting the enable signal. More...
 
ctre::phoenix::StatusCode ClearStickyFault_BadMagnet (units::time::second_t timeoutSeconds)
 Clear sticky fault: The magnet distance is not correct or magnet is missing. More...
 
ctre::phoenix::StatusCode ClearStickyFault_BadMagnet ()
 Clear sticky fault: The magnet distance is not correct or magnet is missing. More...
 
- Public Member Functions inherited from ctre::phoenix6::hardware::ParentDevice
 ParentDevice (int deviceID, std::string model, std::string canbus)
 
virtual ~ParentDevice ()=default
 
 ParentDevice (ParentDevice &&)=default
 
ParentDeviceoperator= (ParentDevice &&)=default
 
int GetDeviceID () const
 
const std::string & GetNetwork () const
 
uint64_t GetDeviceHash () const
 Gets a number unique for this device's hardware type and ID. More...
 
std::shared_ptr< const controls::ControlRequestGetAppliedControl () const
 Get the latest applied control. More...
 
std::shared_ptr< controls::ControlRequestGetAppliedControl ()
 Get the latest applied control. More...
 
bool HasResetOccurred ()
 
std::function< bool()> GetResetOccurredChecker () const
 
StatusSignal< double > & GetGenericSignal (uint32_t signal)
 This is a reserved routine for internal testing. More...
 
ctre::phoenix::StatusCode OptimizeBusUtilization (units::frequency::hertz_t optimizedFreqHz=0_Hz, units::time::second_t timeoutSeconds=50_ms)
 Optimizes the device's bus utilization by reducing the update frequencies of its status signals. More...
 

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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
- Protected Member Functions inherited from ctre::phoenix6::hardware::ParentDevice
virtual ctre::phoenix::StatusCode SetControlPrivate (controls::ControlRequest &request)
 
template<typename T >
StatusSignal< T > & LookupStatusSignal (uint16_t spn, std::string signalName, bool reportOnConstruction)
 
template<typename T >
StatusSignal< T > & LookupStatusSignal (uint16_t spn, uint16_t mapper_iter, std::function< std::map< int, StatusSignal< T > >()> map_filler, std::string signalName, bool reportOnConstruction)
 
template<typename T , typename U >
StatusSignal< T > LookupDimensionlessStatusSignal (uint16_t spn, std::string signalName)
 Returns a unitless version of the StatusSignal by value. More...
 
- 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. More...
 

Detailed Description

Class for CANcoder, a CAN based magnetic encoder that provides absolute and relative position along with filtered velocity.

Constructor & Destructor Documentation

◆ CoreCANcoder() [1/2]

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

Constructs a new CANcoder 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

◆ CoreCANcoder() [2/2]

ctre::phoenix6::hardware::core::CoreCANcoder::CoreCANcoder ( CoreCANcoder &&  )
default

Member Function Documentation

◆ ClearStickyFault_BadMagnet() [1/2]

ctre::phoenix::StatusCode ctre::phoenix6::hardware::core::CoreCANcoder::ClearStickyFault_BadMagnet ( )
inline

Clear sticky fault: The magnet distance is not correct or magnet is missing.

This will wait up to 0.050 seconds (50ms) by default.

Returns
StatusCode of the set command

◆ ClearStickyFault_BadMagnet() [2/2]

ctre::phoenix::StatusCode ctre::phoenix6::hardware::core::CoreCANcoder::ClearStickyFault_BadMagnet ( units::time::second_t  timeoutSeconds)
inline

Clear sticky fault: The magnet distance is not correct or magnet is missing.

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::CoreCANcoder::ClearStickyFault_BootDuringEnable ( )
inline

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

This will wait up to 0.050 seconds (50ms) by default.

Returns
StatusCode of the set command

◆ ClearStickyFault_BootDuringEnable() [2/2]

ctre::phoenix::StatusCode ctre::phoenix6::hardware::core::CoreCANcoder::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::CoreCANcoder::ClearStickyFault_Hardware ( )
inline

Clear sticky fault: Hardware fault occurred.

This will wait up to 0.050 seconds (50ms) by default.

Returns
StatusCode of the set command

◆ ClearStickyFault_Hardware() [2/2]

ctre::phoenix::StatusCode ctre::phoenix6::hardware::core::CoreCANcoder::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::CoreCANcoder::ClearStickyFault_Undervoltage ( )
inline

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

This will wait up to 0.050 seconds (50ms) by default.

Returns
StatusCode of the set command

◆ ClearStickyFault_Undervoltage() [2/2]

ctre::phoenix::StatusCode ctre::phoenix6::hardware::core::CoreCANcoder::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

◆ ClearStickyFaults() [1/2]

ctre::phoenix::StatusCode ctre::phoenix6::hardware::core::CoreCANcoder::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.050 seconds (50ms) by default.

Returns
StatusCode of the set command

◆ ClearStickyFaults() [2/2]

ctre::phoenix::StatusCode ctre::phoenix6::hardware::core::CoreCANcoder::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

◆ GetAbsolutePosition()

StatusSignal< units::angle::turn_t > & ctre::phoenix6::hardware::core::CoreCANcoder::GetAbsolutePosition ( )

Absolute Position of the device.

The possible range is documented below; however, the exact expected range is determined by the AbsoluteSensorRange. This position is only affected by the MagnetSensor configs.

  • Minimum Value: -0.5
  • Maximum Value: 0.999755859375
  • Default Value: 0
  • Units: rotations

Default Rates:

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

This refreshes and returns a cached StatusSignal object.

Returns
AbsolutePosition Status Signal Object

◆ GetConfigurator() [1/2]

configs::CANcoderConfigurator & ctre::phoenix6::hardware::core::CoreCANcoder::GetConfigurator ( )
inline

Gets the configurator for this CANcoder.

Gets the configurator for this CANcoder

Returns
Configurator for this CANcoder

◆ GetConfigurator() [2/2]

configs::CANcoderConfigurator const & ctre::phoenix6::hardware::core::CoreCANcoder::GetConfigurator ( ) const
inline

Gets the configurator for this CANcoder.

Gets the configurator for this CANcoder

Returns
Configurator for this CANcoder

◆ GetFault_BadMagnet()

StatusSignal< bool > & ctre::phoenix6::hardware::core::CoreCANcoder::GetFault_BadMagnet ( )

The magnet distance is not correct or magnet is missing.

  • Default Value: False

Default Rates:

  • CAN: 4.0 Hz

This refreshes and returns a cached StatusSignal object.

Returns
Fault_BadMagnet Status Signal Object

◆ GetFault_BootDuringEnable()

StatusSignal< bool > & ctre::phoenix6::hardware::core::CoreCANcoder::GetFault_BootDuringEnable ( )

Device boot while detecting the enable signal.

  • Default Value: False

Default Rates:

  • CAN: 4.0 Hz

This refreshes and returns a cached StatusSignal object.

Returns
Fault_BootDuringEnable Status Signal Object

◆ GetFault_Hardware()

StatusSignal< bool > & ctre::phoenix6::hardware::core::CoreCANcoder::GetFault_Hardware ( )

Hardware fault occurred.

  • Default Value: False

Default Rates:

  • CAN: 4.0 Hz

This refreshes and returns a cached StatusSignal object.

Returns
Fault_Hardware Status Signal Object

◆ GetFault_Undervoltage()

StatusSignal< bool > & ctre::phoenix6::hardware::core::CoreCANcoder::GetFault_Undervoltage ( )

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.

Returns
Fault_Undervoltage Status Signal Object

◆ GetFault_UnlicensedFeatureInUse()

StatusSignal< bool > & ctre::phoenix6::hardware::core::CoreCANcoder::GetFault_UnlicensedFeatureInUse ( )

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.

Returns
Fault_UnlicensedFeatureInUse Status Signal Object

◆ GetFaultField()

StatusSignal< int > & ctre::phoenix6::hardware::core::CoreCANcoder::GetFaultField ( )

Integer representing all faults.

This returns the 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: 16777215
  • Default Value: 0
  • Units:

Default Rates:

  • CAN: 4.0 Hz

This refreshes and returns a cached StatusSignal object.

Returns
FaultField Status Signal Object

◆ GetIsProLicensed()

StatusSignal< bool > & ctre::phoenix6::hardware::core::CoreCANcoder::GetIsProLicensed ( )

Whether the device is Phoenix Pro licensed.

  • Default Value: False

Default Rates:

  • CAN: 4.0 Hz

This refreshes and returns a cached StatusSignal object.

Returns
IsProLicensed Status Signal Object

◆ GetMagnetHealth()

StatusSignal< signals::MagnetHealthValue > & ctre::phoenix6::hardware::core::CoreCANcoder::GetMagnetHealth ( )

Magnet health as measured by CANcoder.

Magnet health as measured by CANcoder. Red indicates too close or too far, Orange is adequate but with reduced accuracy, green is ideal. Invalid means the accuracy cannot be determined.

Default Rates:

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

This refreshes and returns a cached StatusSignal object.

Returns
MagnetHealth Status Signal Object

◆ GetPosition()

StatusSignal< units::angle::turn_t > & ctre::phoenix6::hardware::core::CoreCANcoder::GetPosition ( )

Position of the device.

This is initialized to the absolute position on boot.

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

Default Rates:

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

This refreshes and returns a cached StatusSignal object.

Returns
Position Status Signal Object

◆ GetPositionSinceBoot()

StatusSignal< units::angle::turn_t > & ctre::phoenix6::hardware::core::CoreCANcoder::GetPositionSinceBoot ( )

The relative position reported by the CANcoder since boot.

This is the total displacement reported by CANcoder since power up. This signal is relative and is not influenced by the fusing algorithm.

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

Default Rates:

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

This refreshes and returns a cached StatusSignal object.

Returns
PositionSinceBoot Status Signal Object

◆ GetSimState()

sim::CANcoderSimState & ctre::phoenix6::hardware::core::CoreCANcoder::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_BadMagnet()

StatusSignal< bool > & ctre::phoenix6::hardware::core::CoreCANcoder::GetStickyFault_BadMagnet ( )

The magnet distance is not correct or magnet is missing.

  • Default Value: False

Default Rates:

  • CAN: 4.0 Hz

This refreshes and returns a cached StatusSignal object.

Returns
StickyFault_BadMagnet Status Signal Object

◆ GetStickyFault_BootDuringEnable()

StatusSignal< bool > & ctre::phoenix6::hardware::core::CoreCANcoder::GetStickyFault_BootDuringEnable ( )

Device boot while detecting the enable signal.

  • Default Value: False

Default Rates:

  • CAN: 4.0 Hz

This refreshes and returns a cached StatusSignal object.

Returns
StickyFault_BootDuringEnable Status Signal Object

◆ GetStickyFault_Hardware()

StatusSignal< bool > & ctre::phoenix6::hardware::core::CoreCANcoder::GetStickyFault_Hardware ( )

Hardware fault occurred.

  • Default Value: False

Default Rates:

  • CAN: 4.0 Hz

This refreshes and returns a cached StatusSignal object.

Returns
StickyFault_Hardware Status Signal Object

◆ GetStickyFault_Undervoltage()

StatusSignal< bool > & ctre::phoenix6::hardware::core::CoreCANcoder::GetStickyFault_Undervoltage ( )

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.

Returns
StickyFault_Undervoltage Status Signal Object

◆ GetStickyFault_UnlicensedFeatureInUse()

StatusSignal< bool > & ctre::phoenix6::hardware::core::CoreCANcoder::GetStickyFault_UnlicensedFeatureInUse ( )

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.

Returns
StickyFault_UnlicensedFeatureInUse Status Signal Object

◆ GetStickyFaultField()

StatusSignal< int > & ctre::phoenix6::hardware::core::CoreCANcoder::GetStickyFaultField ( )

Integer representing all sticky faults.

This returns the 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: 16777215
  • Default Value: 0
  • Units:

Default Rates:

  • CAN: 4.0 Hz

This refreshes and returns a cached StatusSignal object.

Returns
StickyFaultField Status Signal Object

◆ GetSupplyVoltage()

StatusSignal< units::voltage::volt_t > & ctre::phoenix6::hardware::core::CoreCANcoder::GetSupplyVoltage ( )

Measured supply voltage to the CANcoder.

  • Minimum Value: 4
  • Maximum Value: 16.75
  • Default Value: 4
  • Units: V

Default Rates:

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

This refreshes and returns a cached StatusSignal object.

Returns
SupplyVoltage Status Signal Object

◆ GetUnfilteredVelocity()

StatusSignal< units::angular_velocity::turns_per_second_t > & ctre::phoenix6::hardware::core::CoreCANcoder::GetUnfilteredVelocity ( )

The unfiltered velocity reported by CANcoder.

This is the unfiltered velocity reported by CANcoder. This signal does not use the fusing algorithm.

  • Minimum Value: -8000.0
  • Maximum Value: 7999.755859375
  • Default Value: 0
  • Units: rotations per second

Default Rates:

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

This refreshes and returns a cached StatusSignal object.

Returns
UnfilteredVelocity Status Signal Object

◆ GetVelocity()

StatusSignal< units::angular_velocity::turns_per_second_t > & ctre::phoenix6::hardware::core::CoreCANcoder::GetVelocity ( )

Velocity of the device.

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

Default Rates:

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

This refreshes and returns a cached StatusSignal object.

Returns
Velocity Status Signal Object

◆ GetVersion()

StatusSignal< int > & ctre::phoenix6::hardware::core::CoreCANcoder::GetVersion ( )

Full Version.

The format is a four byte value.

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.

Returns
Version Status Signal Object

◆ GetVersionBugfix()

StatusSignal< int > & ctre::phoenix6::hardware::core::CoreCANcoder::GetVersionBugfix ( )

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.

Returns
VersionBugfix Status Signal Object

◆ GetVersionBuild()

StatusSignal< int > & ctre::phoenix6::hardware::core::CoreCANcoder::GetVersionBuild ( )

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.

Returns
VersionBuild Status Signal Object

◆ GetVersionMajor()

StatusSignal< int > & ctre::phoenix6::hardware::core::CoreCANcoder::GetVersionMajor ( )

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.

Returns
VersionMajor Status Signal Object

◆ GetVersionMinor()

StatusSignal< int > & ctre::phoenix6::hardware::core::CoreCANcoder::GetVersionMinor ( )

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.

Returns
VersionMinor Status Signal Object

◆ operator=()

CoreCANcoder & ctre::phoenix6::hardware::core::CoreCANcoder::operator= ( CoreCANcoder &&  )
default

◆ SetControl() [1/2]

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

Control motor 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 corresponding StatusCode

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

◆ SetControl() [2/2]

ctre::phoenix::StatusCode ctre::phoenix6::hardware::core::CoreCANcoder::SetControl ( controls::ControlRequest request)
inline

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

◆ SetPosition() [1/2]

ctre::phoenix::StatusCode ctre::phoenix6::hardware::core::CoreCANcoder::SetPosition ( units::angle::turn_t  newValue)
inline

Sets the current position of the device.

This will wait up to 0.050 seconds (50ms) by default.

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

◆ SetPosition() [2/2]

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

Sets the current position of the device.

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: