|
Valor 6800 1.0
|
Sensor for controlling the CANdle and associated LEDs. More...
#include <CANdleSensor.h>
Public Types | |
| enum | Priority { LOW , MEDIUM , HIGH } |
Public Member Functions | |
| CANdleSensor (frc::TimedRobot &robot, int ledCount, int segments, int canID, std::string canbus="baseCAN") | |
| Construct a new CANdleSensor object. | |
| void | setBrightness (double brightness, bool saveImmediately=true) |
| void | setStripType (ctre::phoenix6::signals::StripTypeValue stripType, bool saveImmediately=true) |
| void | setLED (int led, frc::Color8Bit color) |
| Set the color of a specific LED. | |
| void | setColor (int segment, frc::Color8Bit color, Priority priority=LOW) |
| Set the color of a specific segment. | |
| void | setColor (frc::Color8Bit color, Priority priority=LOW) |
| Set the color for all segments. | |
| template<typename T > | |
| void | setAnimation (int segment, frc::Color8Bit color, Priority priority=LOW) |
| Set an animation for a specific segment. | |
| template<typename T > | |
| void | setAnimation (frc::Color8Bit color, Priority priority=LOW) |
| Set an animation for all segments. | |
| void | clearAnimation (int segment) |
| Clears any active animation for a specific segment. | |
| void | reset () override |
| Resets the CANdle device. | |
Public Member Functions inherited from valor::BaseSensor< int > | |
| void | setGetter (std::function< int()> _lambda) |
| Set the lambda function to fetch sensor data. | |
| void | applyPostProcessing (std::function< int(int)> func) |
| Set a post-processing function for sensor data. | |
| int | get () |
| Get the current sensor state. | |
Public Member Functions inherited from valor::Loggable | |
| void | LogChild (std::string_view name, Loggable *child) |
| Register a child Loggable under a named subtree. | |
| void | LogChild (std::string_view name, wpi::Sendable *child) |
| Register a child Sendable under a named subtree. | |
| void | setLoggingPeriod (units::millisecond_t period) |
| Set the minimum period between LoggablePeriodic() invocations. | |
| template<> | |
| decltype(Loggable::subscribers) ::iterator | addSubscriber (std::string_view field, const std::vector< bool > &defaultValue) |
| template<> | |
| void | WriteLogImpl (nt::Publisher *pub, const std::vector< bool > &data) |
| template<> | |
| std::vector< bool > | ReadLogImpl (nt::Subscriber *sub) |
Static Public Member Functions | |
| static frc::Color8Bit | cancoderMagnetHealthGetter (ctre::phoenix6::hardware::CANcoder *cancoder) |
| Get the health status of a CANcoder magnet. | |
Static Public Member Functions inherited from valor::Loggable | |
| static units::millisecond_t | GetLoggingTime () |
Static Public Attributes | |
| static constexpr frc::Color8Bit | VALOR_GOLD {0xEE, 0xA8, 0x00} |
| static constexpr frc::Color8Bit | VALOR_PURPLE {0xFF, 0x00, 0xFF} |
| static constexpr frc::Color8Bit | RED {0xFF, 0x00, 0x00} |
| static constexpr frc::Color8Bit | ORANGE {0xFF, 0x30, 0x00} |
| static constexpr frc::Color8Bit | GREEN {0x00, 0xFF, 0x00} |
| static constexpr frc::Color8Bit | BLUE {0x00, 0x00, 0xFF} |
| static constexpr frc::Color8Bit | LIGHT_BLUE {0xFF, 0x00, 0xF9} |
| static constexpr frc::Color8Bit | WHITE {0xFF, 0xFF, 0xFF} |
| static constexpr frc::Color8Bit | OFF {0x00, 0x00, 0x00} |
Additional Inherited Members | |
Protected Member Functions inherited from valor::BaseSensor< int > | |
| BaseSensor (frc::TimedRobot &robot) | |
| Construct a new BaseSensor object. | |
| virtual void | refresh () |
| Refresh the sensor state. | |
Protected Member Functions inherited from valor::Loggable | |
| Loggable (std::string_view name) | |
| Construct a Loggable that registers a top-level table name. | |
| Loggable () | |
| Default construct an uninitialized Loggable. | |
| virtual | ~Loggable ()=default |
| Virtual destructor. | |
| virtual void | OnLoggingStart () |
| Hook invoked when logging is started for this object. | |
| virtual void | LoggablePeriodic () |
| Periodic callback for logging updates. | |
| template<typename T > | |
| T | WriteLog (std::string_view field, const T &data) |
| Publish a value to NetworkTables under the given field. | |
| template<typename T > | |
| T | ReadLog (std::string_view field, const T &defaultValue={}) |
| Read a value from NetworkTables for the given field. | |
Protected Attributes inherited from valor::BaseSensor< int > | |
| std::function< int()> | sensorLambda |
| Lambda function to fetch sensor data. | |
| std::function< int(int)> | postProcessor |
| Lambda function to post-process sensor data. | |
| int | prevState |
| Previous and current sensor states. | |
| int | currState |
| frc::Timer | profiler |
Sensor for controlling the CANdle and associated LEDs.
This class manages a CANdle device and any connected LEDs. It supports setting static colors, animations, and segment-specific configurations.
| valor::CANdleSensor::CANdleSensor | ( | frc::TimedRobot & | robot, |
| int | ledCount, | ||
| int | segments, | ||
| int | canID, | ||
| std::string | canbus = "baseCAN" ) |
Construct a new CANdleSensor object.
| robot | Reference to the main robot instance. |
| ledCount | Number of external LEDs connected to the CANdle. |
| segments | Number of LED segments. |
| canID | CAN ID assigned to the CANdle. |
| canbus | CAN bus the CANdle is attached to (default: "baseCAN"). |
|
static |
Get the health status of a CANcoder magnet.
| cancoder | Pointer to the CANcoder device. |
Clears any active animation for a specific segment.
Also responsible for clearing the appropriate memory associated with the animation.
| segment | The segment that will be cleared. |
|
overridevirtual |
Resets the CANdle device.
Reimplemented from valor::BaseSensor< int >.
|
inline |
Set an animation for all segments.
| T | Animation type. |
| color | Color for the animation. |
| priority | Priority for the animation. |
|
inline |
Set an animation for a specific segment.
| T | Animation type. |
| segment | Segment index to modify. |
| color | Color for the animation. |
| priority | Priority for the animation. |
| void valor::CANdleSensor::setColor | ( | frc::Color8Bit | color, |
| Priority | priority = LOW ) |
Set the color for all segments.
| color | RGB hex code to set. |
| priority | Priority level for the color setting. |
Set the color of a specific segment.
| segment | Segment index to modify. |
| color | Color to set. |
| priority | Priority for the color setting. |
Set the color of a specific LED.
| led | Index of the LED to set. |
| color | Color to set. |