CTRE Phoenix 6 C++ 26.3.0
Loading...
Searching...
No Matches
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 ctre::phoenix6::hardware::traits::CommonDevice

Public Member Functions

 CANdle (int deviceId, CANBus canbus={})
 Constructs a new CANdle object.
 
 CANdle (int deviceId, std::string canbus)
 Constructs a new CANdle object.
 
 ~CANdle ()
 
ctre::phoenix::StatusCode ClearAllAnimations ()
 Clears all animations on the CANdle.
 
void InitSendable (wpi::SendableBuilder &builder) override
 
- Public Member Functions inherited from ctre::phoenix6::hardware::core::CoreCANdle
 CoreCANdle (int deviceId, CANBus canbus={})
 Constructs a new CANdle object.
 
 CoreCANdle (int deviceId, std::string 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 (controls::ModulateVBatOut const &request)
 Modulates the CANdle VBat output to the specified duty cycle.
 
ctre::phoenix::StatusCode SetControl (controls::SolidColor const &request)
 Sets LEDs to a solid color.
 
ctre::phoenix::StatusCode SetControl (controls::EmptyAnimation const &request)
 An empty animation, clearing any animation in the specified slot.
 
ctre::phoenix::StatusCode SetControl (controls::ColorFlowAnimation const &request)
 Animation that gradually lights the entire LED strip one LED at a time.
 
ctre::phoenix::StatusCode SetControl (controls::FireAnimation const &request)
 Animation that looks similar to a flame flickering.
 
ctre::phoenix::StatusCode SetControl (controls::LarsonAnimation const &request)
 Animation that bounces a pocket of light across the LED strip.
 
ctre::phoenix::StatusCode SetControl (controls::RainbowAnimation const &request)
 Animation that creates a rainbow throughout all the LEDs.
 
ctre::phoenix::StatusCode SetControl (controls::RgbFadeAnimation const &request)
 Animation that fades all the LEDs of a strip simultaneously between Red, Green, and Blue.
 
ctre::phoenix::StatusCode SetControl (controls::SingleFadeAnimation const &request)
 Animation that fades into and out of a specified color.
 
ctre::phoenix::StatusCode SetControl (controls::StrobeAnimation const &request)
 Animation that strobes the LEDs a specified color.
 
ctre::phoenix::StatusCode SetControl (controls::TwinkleAnimation const &request)
 Animation that randomly turns LEDs on and off to a certain color.
 
ctre::phoenix::StatusCode SetControl (controls::TwinkleOffAnimation const &request)
 Animation that randomly turns on LEDs until it reaches the maximum count, and then turns them all off.
 
ctre::phoenix::StatusCode SetControl (controls::EmptyControl const &request)
 Apply a generic empty control used to do nothing.
 
ctre::phoenix::StatusCode SetControl (controls::ControlRequest const &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, CANBus canbus)
 
virtual ~ParentDevice ()=0
 
 ParentDevice (ParentDevice const &)=delete
 
ParentDeviceoperator= (ParentDevice const &)=delete
 
int GetDeviceID () const final
 
CANBus GetNetwork () const final
 
uint64_t GetDeviceHash () const final
 Gets a number unique for this device's hardware type and ID.
 
std::shared_ptr< controls::ControlRequest const > GetAppliedControl () const final
 Get the latest applied control.
 
std::shared_ptr< controls::ControlRequestGetAppliedControl () final
 Get the latest applied control.
 
bool HasResetOccurred () final
 
std::function< bool()> GetResetOccurredChecker () const final
 
bool IsConnected (units::second_t maxLatencySeconds=500_ms) final
 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=4_Hz, units::time::second_t timeoutSeconds=100_ms) final
 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) final
 Resets the update frequencies of all the device's status signals to the defaults.
 
- Public Member Functions inherited from ctre::phoenix6::hardware::traits::CommonDevice
virtual ~CommonDevice ()=default
 

Static Public Member Functions

static CANdle None ()
 Constructs a stubbed-out CANdle, where all status signals, controls, configs, etc.
 
- Static Public Member Functions inherited from ctre::phoenix6::hardware::core::CoreCANdle
static CoreCANdle None ()
 Constructs a stubbed-out CoreCANdle, where all status signals, controls, configs, etc.
 
- Static Public Member Functions inherited from ctre::phoenix6::hardware::ParentDevice
template<std::derived_from< traits::CommonDevice >... 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 (std::span< traits::CommonDevice *const > devices)
 Optimizes the bus utilization of the provided devices by reducing the update frequencies of their status signals.
 
template<std::derived_from< traits::CommonDevice >... 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, std::span< traits::CommonDevice *const > devices)
 Optimizes the bus utilization of the provided devices by reducing the update frequencies of their status signals.
 
template<std::derived_from< traits::CommonDevice >... 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 (std::span< traits::CommonDevice *const > devices)
 Resets the update frequencies of all the devices' status signals to the defaults.
 

Static Public Attributes

static constexpr int kAnimSlotCount = 8
 The number of animation slots.
 

Additional Inherited Members

- Public Types inherited from ctre::phoenix6::hardware::core::CoreCANdle
using Configuration = configs::CANdleConfiguration
 The configuration class for this device.
 
- Protected Member Functions inherited from ctre::phoenix6::hardware::ParentDevice
virtual ctre::phoenix::StatusCode SetControlPrivate (controls::ControlRequest const &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::string signalName, std::function< std::map< uint16_t, std::string >()> mapFiller, bool reportOnConstruction, bool refresh)
 
- Protected Attributes inherited from ctre::phoenix6::hardware::ParentDevice
DeviceIdentifier deviceIdentifier
 
- Static Protected Attributes inherited from ctre::phoenix6::hardware::ParentDevice
static constexpr controls::EmptyControl _emptyControl {}
 

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,
CANBus canbus = {} )

Constructs a new CANdle object.

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

◆ CANdle() [2/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
Deprecated
Constructing devices with a CAN bus string is deprecated for removal in the 2027 season. Construct devices using a CANBus instance instead.

◆ ~CANdle()

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

Member Function Documentation

◆ ClearAllAnimations()

ctre::phoenix::StatusCode ctre::phoenix6::hardware::CANdle::ClearAllAnimations ( )

Clears all animations on the CANdle.

This is equivalent to applying a controls::EmptyAnimation to all the animation slots on the CANdle.

Returns
Status code of the first failed control call, or OK if all succeeded

◆ InitSendable()

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

◆ None()

static CANdle ctre::phoenix6::hardware::CANdle::None ( )
inlinestatic

Constructs a stubbed-out CANdle, where all status signals, controls, configs, etc.

perform no action and immediately return OK. This can be used to silence error messages for devices that have been completely removed from the robot.

Returns
Stubbed-out CANdle

Member Data Documentation

◆ kAnimSlotCount

int ctre::phoenix6::hardware::CANdle::kAnimSlotCount = 8
staticconstexpr

The number of animation slots.


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