14#include <units/frequency.h>
15#include <units/time.h>
16#include <units/dimensionless.h>
29 ctre::phoenix::StatusCode SendRequest(
const char *network, uint32_t deviceHash, std::shared_ptr<ControlRequest> &req)
const override
31 if (req.get() !=
this)
34 if (reqCast !=
nullptr)
40 req = std::make_shared<TwinkleAnimation>(*
this);
44 return c_ctre_phoenix6_RequestControlTwinkleAnimation(network, deviceHash,
UpdateFreqHz.to<
double>(),
LEDStartIndex,
LEDEndIndex,
Slot,
Color.
Red,
Color.
Green,
Color.
Blue,
Color.
White,
MaxLEDsOnProportion.to<
double>(),
FrameRate.to<
double>());
158 Slot = std::move(newSlot);
173 Color = std::move(newColor);
239 std::stringstream ss;
240 ss <<
"Control: TwinkleAnimation" << std::endl;
242 ss <<
" LEDEndIndex: " <<
LEDEndIndex << std::endl;
243 ss <<
" Slot: " <<
Slot << std::endl;
244 ss <<
" Color: " <<
Color << std::endl;
246 ss <<
" FrameRate: " <<
FrameRate.to<
double>() <<
" Hz" << std::endl;
257 std::map<std::string, std::string> controlInfo;
258 std::stringstream ss;
259 controlInfo[
"Name"] =
GetName();
260 ss <<
LEDStartIndex; controlInfo[
"LEDStartIndex"] = ss.str(); ss.str(std::string{});
261 ss <<
LEDEndIndex; controlInfo[
"LEDEndIndex"] = ss.str(); ss.str(std::string{});
262 ss <<
Slot; controlInfo[
"Slot"] = ss.str(); ss.str(std::string{});
263 ss <<
Color; controlInfo[
"Color"] = ss.str(); ss.str(std::string{});
264 ss <<
MaxLEDsOnProportion.to<
double>(); controlInfo[
"MaxLEDsOnProportion"] = ss.str(); ss.str(std::string{});
265 ss <<
FrameRate.to<
double>(); controlInfo[
"FrameRate"] = ss.str(); ss.str(std::string{});
CTREXPORT int c_ctre_phoenix6_RequestControlTwinkleAnimation(const char *canbus, uint32_t ecuEncoding, double updateFrequency, int LEDStartIndex, int LEDEndIndex, int Slot, int Color_Red, int Color_Green, int Color_Blue, int Color_White, double MaxLEDsOnProportion, double FrameRate)
Abstract Control Request class that other control requests extend for use.
Definition ControlRequest.hpp:30
std::string const & GetName() const
Definition ControlRequest.hpp:53
Animation that randomly turns LEDs on and off to a certain color.
Definition TwinkleAnimation.hpp:28
TwinkleAnimation & WithSlot(int newSlot)
Modifies this Control Request's Slot parameter and returns itself for method-chaining and easier to u...
Definition TwinkleAnimation.hpp:156
units::dimensionless::scalar_t MaxLEDsOnProportion
The max proportion of LEDs that can be on, in the range [0.1, 1.0].
Definition TwinkleAnimation.hpp:71
int Slot
The slot of this animation, within [0, 7].
Definition TwinkleAnimation.hpp:63
TwinkleAnimation & WithLEDEndIndex(int newLEDEndIndex)
Modifies this Control Request's LEDEndIndex parameter and returns itself for method-chaining and easi...
Definition TwinkleAnimation.hpp:140
int LEDEndIndex
The index of the last LED this animation controls (inclusive).
Definition TwinkleAnimation.hpp:58
TwinkleAnimation & WithLEDStartIndex(int newLEDStartIndex)
Modifies this Control Request's LEDStartIndex parameter and returns itself for method-chaining and ea...
Definition TwinkleAnimation.hpp:124
units::frequency::hertz_t UpdateFreqHz
The period at which this control will update at.
Definition TwinkleAnimation.hpp:95
TwinkleAnimation(int LEDStartIndex, int LEDEndIndex)
Animation that randomly turns LEDs on and off to a certain color.
Definition TwinkleAnimation.hpp:109
TwinkleAnimation & WithUpdateFreqHz(units::frequency::hertz_t newUpdateFreqHz)
Sets the period at which this control will update at.
Definition TwinkleAnimation.hpp:227
signals::RGBWColor Color
The color to use in the animation.
Definition TwinkleAnimation.hpp:67
TwinkleAnimation & WithMaxLEDsOnProportion(units::dimensionless::scalar_t newMaxLEDsOnProportion)
Modifies this Control Request's MaxLEDsOnProportion parameter and returns itself for method-chaining ...
Definition TwinkleAnimation.hpp:186
TwinkleAnimation & WithFrameRate(units::frequency::hertz_t newFrameRate)
Modifies this Control Request's FrameRate parameter and returns itself for method-chaining and easier...
Definition TwinkleAnimation.hpp:208
std::string ToString() const override
Returns a string representation of the object.
Definition TwinkleAnimation.hpp:237
int LEDStartIndex
The index of the first LED this animation controls (inclusive).
Definition TwinkleAnimation.hpp:53
units::frequency::hertz_t FrameRate
The frame rate of the animation, from [2, 1000] Hz.
Definition TwinkleAnimation.hpp:82
std::map< std::string, std::string > GetControlInfo() const override
Gets information about this control request.
Definition TwinkleAnimation.hpp:255
TwinkleAnimation & WithColor(signals::RGBWColor newColor)
Modifies this Control Request's Color parameter and returns itself for method-chaining and easier to ...
Definition TwinkleAnimation.hpp:171
Represents an RGBW color that can be applied to an LED.
Definition RGBWColor.hpp:27
uint8_t Green
The green component of the color, within [0, 255].
Definition RGBWColor.hpp:36
uint8_t Blue
The blue component of the color, within [0, 255].
Definition RGBWColor.hpp:40
uint8_t White
The white component of the color, within [0, 255].
Definition RGBWColor.hpp:45
uint8_t Red
The red component of the color, within [0, 255].
Definition RGBWColor.hpp:32
Status codes reported by APIs, including OK, warnings, and errors.
Definition StatusCodes.h:27
Definition Diff_PositionDutyCycle_Position.hpp:15