Loading [MathJax]/extensions/tex2jax.js
CTRE Phoenix 6 C++ 25.4.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ctre::phoenix6::hardware::CANdle Class Reference

Class for CTR Electronics' CANdle® branded device, a device that controls LEDs over the CAN bus. More...

#include <ctre/phoenix6/CANdle.hpp>

Inheritance diagram for ctre::phoenix6::hardware::CANdle:
ctre::phoenix6::hardware::core::CoreCANdle ctre::phoenix6::hardware::ParentDevice

Public Member Functions

 CANdle (int deviceId, std::string canbus="")
 Constructs a new CANdle object.
 
 CANdle (int deviceId, CANBus canbus)
 Constructs a new CANdle object.
 
 ~CANdle ()
 
void InitSendable (wpi::SendableBuilder &builder) override
 
- Public Member Functions inherited from ctre::phoenix6::hardware::core::CoreCANdle
 CoreCANdle (int deviceId, std::string canbus="")
 Constructs a new CANdle object.
 
 CoreCANdle (int deviceId, CANBus canbus)
 Constructs a new CANdle object.
 
configs::CANdleConfiguratorGetConfigurator ()
 Gets the configurator for this CANdle.
 
configs::CANdleConfigurator const & GetConfigurator () const
 Gets the configurator for this CANdle.
 
sim::CANdleSimStateGetSimState ()
 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< units::voltage::volt_t > & GetSupplyVoltage (bool refresh=true)
 Measured supply voltage to the CANdle.
 
StatusSignal< units::voltage::volt_t > & GetFiveVRailVoltage (bool refresh=true)
 The measured voltage of the 5V rail line.
 
StatusSignal< units::current::ampere_t > & GetOutputCurrent (bool refresh=true)
 The measured output current.
 
StatusSignal< units::temperature::celsius_t > & GetDeviceTemp (bool refresh=true)
 The temperature that the CANdle measures itself to be at.
 
StatusSignal< units::dimensionless::scalar_t > & GetVBatModulation (bool refresh=true)
 The applied VBat modulation duty cycle.
 
StatusSignal< int > & GetMaxSimultaneousAnimationCount (bool refresh=true)
 The maximum number of simultaneous animations supported by the current version of CANdle firmware.
 
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_Overvoltage (bool refresh=true)
 Device supply voltage is too high (above 30 V).
 
StatusSignal< bool > & GetStickyFault_Overvoltage (bool refresh=true)
 Device supply voltage is too high (above 30 V).
 
StatusSignal< bool > & GetFault_5VTooHigh (bool refresh=true)
 Device 5V line is too high (above 6 V).
 
StatusSignal< bool > & GetStickyFault_5VTooHigh (bool refresh=true)
 Device 5V line is too high (above 6 V).
 
StatusSignal< bool > & GetFault_5VTooLow (bool refresh=true)
 Device 5V line is too low (below 4 V).
 
StatusSignal< bool > & GetStickyFault_5VTooLow (bool refresh=true)
 Device 5V line is too low (below 4 V).
 
StatusSignal< bool > & GetFault_Thermal (bool refresh=true)
 Device temperature exceeded limit.
 
StatusSignal< bool > & GetStickyFault_Thermal (bool refresh=true)
 Device temperature exceeded limit.
 
StatusSignal< bool > & GetFault_SoftwareFuse (bool refresh=true)
 CANdle output current exceeded the 6 A limit.
 
StatusSignal< bool > & GetStickyFault_SoftwareFuse (bool refresh=true)
 CANdle output current exceeded the 6 A limit.
 
StatusSignal< bool > & GetFault_ShortCircuit (bool refresh=true)
 CANdle has detected the output pin is shorted.
 
StatusSignal< bool > & GetStickyFault_ShortCircuit (bool refresh=true)
 CANdle has detected the output pin is shorted.
 
ctre::phoenix::StatusCode SetControl (const controls::ModulateVBatOut &request)
 Modulates the CANdle VBat output to the specified duty cycle.
 
ctre::phoenix::StatusCode SetControl (const controls::SolidColor &request)
 Sets LEDs to a solid color.
 
ctre::phoenix::StatusCode SetControl (const controls::EmptyAnimation &request)
 An empty animation, clearing any animation in the specified slot.
 
ctre::phoenix::StatusCode SetControl (const controls::ColorFlowAnimation &request)
 Animation that gradually lights the entire LED strip one LED at a time.
 
ctre::phoenix::StatusCode SetControl (const controls::FireAnimation &request)
 Animation that looks similar to a flame flickering.
 
ctre::phoenix::StatusCode SetControl (const controls::LarsonAnimation &request)
 Animation that bounces a pocket of light across the LED strip.
 
ctre::phoenix::StatusCode SetControl (const controls::RainbowAnimation &request)
 Animation that creates a rainbow throughout all the LEDs.
 
ctre::phoenix::StatusCode SetControl (const controls::RgbFadeAnimation &request)
 Animation that fades all the LEDs of a strip simultaneously between Red, Green, and Blue.
 
ctre::phoenix::StatusCode SetControl (const controls::SingleFadeAnimation &request)
 Animation that fades into and out of a specified color.
 
ctre::phoenix::StatusCode SetControl (const controls::StrobeAnimation &request)
 Animation that strobes the LEDs a specified color.
 
ctre::phoenix::StatusCode SetControl (const controls::TwinkleAnimation &request)
 Animation that randomly turns LEDs on and off to a certain color.
 
ctre::phoenix::StatusCode SetControl (const controls::TwinkleOffAnimation &request)
 Animation that randomly turns on LEDs until it reaches the maximum count, and then turns them all off.
 
ctre::phoenix::StatusCode SetControl (const controls::ControlRequest &request)
 Control device with generic control request object.
 
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_Overvoltage (units::time::second_t timeoutSeconds)
 Clear sticky fault: Device supply voltage is too high (above 30 V).
 
ctre::phoenix::StatusCode ClearStickyFault_Overvoltage ()
 Clear sticky fault: Device supply voltage is too high (above 30 V).
 
ctre::phoenix::StatusCode ClearStickyFault_5VTooHigh (units::time::second_t timeoutSeconds)
 Clear sticky fault: Device 5V line is too high (above 6 V).
 
ctre::phoenix::StatusCode ClearStickyFault_5VTooHigh ()
 Clear sticky fault: Device 5V line is too high (above 6 V).
 
ctre::phoenix::StatusCode ClearStickyFault_5VTooLow (units::time::second_t timeoutSeconds)
 Clear sticky fault: Device 5V line is too low (below 4 V).
 
ctre::phoenix::StatusCode ClearStickyFault_5VTooLow ()
 Clear sticky fault: Device 5V line is too low (below 4 V).
 
ctre::phoenix::StatusCode ClearStickyFault_Thermal (units::time::second_t timeoutSeconds)
 Clear sticky fault: Device temperature exceeded limit.
 
ctre::phoenix::StatusCode ClearStickyFault_Thermal ()
 Clear sticky fault: Device temperature exceeded limit.
 
ctre::phoenix::StatusCode ClearStickyFault_SoftwareFuse (units::time::second_t timeoutSeconds)
 Clear sticky fault: CANdle output current exceeded the 6 A limit.
 
ctre::phoenix::StatusCode ClearStickyFault_SoftwareFuse ()
 Clear sticky fault: CANdle output current exceeded the 6 A limit.
 
ctre::phoenix::StatusCode ClearStickyFault_ShortCircuit (units::time::second_t timeoutSeconds)
 Clear sticky fault: CANdle has detected the output pin is shorted.
 
ctre::phoenix::StatusCode ClearStickyFault_ShortCircuit ()
 Clear sticky fault: CANdle has detected the output pin is shorted.
 
- 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

- Public Types inherited from ctre::phoenix6::hardware::core::CoreCANdle
using Configuration = configs::CANdleConfiguration
 
- 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 CTR Electronics' CANdle® branded device, a device that controls LEDs over the CAN bus.

Constructor & Destructor Documentation

◆ CANdle() [1/2]

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

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

◆ CANdle() [2/2]

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

Constructs a new CANdle object.

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

◆ ~CANdle()

ctre::phoenix6::hardware::CANdle::~CANdle ( )

Member Function Documentation

◆ InitSendable()

void ctre::phoenix6::hardware::CANdle::InitSendable ( wpi::SendableBuilder & builder)
override

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