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<RainbowAnimation>(*
this);
177 Slot = std::move(newSlot);
258 std::stringstream ss;
259 ss <<
"Control: RainbowAnimation" << std::endl;
261 ss <<
" LEDEndIndex: " <<
LEDEndIndex << std::endl;
262 ss <<
" Slot: " <<
Slot << std::endl;
263 ss <<
" Brightness: " <<
Brightness.to<
double>() << std::endl;
264 ss <<
" Direction: " <<
Direction << std::endl;
265 ss <<
" FrameRate: " <<
FrameRate.to<
double>() <<
" Hz" << std::endl;
276 std::map<std::string, std::string> controlInfo;
277 std::stringstream ss;
278 controlInfo[
"Name"] =
GetName();
279 ss <<
LEDStartIndex; controlInfo[
"LEDStartIndex"] = ss.str(); ss.str(std::string{});
280 ss <<
LEDEndIndex; controlInfo[
"LEDEndIndex"] = ss.str(); ss.str(std::string{});
281 ss <<
Slot; controlInfo[
"Slot"] = ss.str(); ss.str(std::string{});
282 ss <<
Brightness.to<
double>(); controlInfo[
"Brightness"] = ss.str(); ss.str(std::string{});
283 ss <<
Direction; controlInfo[
"Direction"] = ss.str(); ss.str(std::string{});
284 ss <<
FrameRate.to<
double>(); controlInfo[
"FrameRate"] = ss.str(); ss.str(std::string{});
CTREXPORT int c_ctre_phoenix6_RequestControlRainbowAnimation(const char *canbus, uint32_t ecuEncoding, double updateFrequency, int LEDStartIndex, int LEDEndIndex, int Slot, double Brightness, int Direction, 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 creates a rainbow throughout all the LEDs.
Definition RainbowAnimation.hpp:28
signals::AnimationDirectionValue Direction
The direction of the animation.
Definition RainbowAnimation.hpp:76
RainbowAnimation & WithLEDEndIndex(int newLEDEndIndex)
Modifies this Control Request's LEDEndIndex parameter and returns itself for method-chaining and easi...
Definition RainbowAnimation.hpp:159
RainbowAnimation & WithLEDStartIndex(int newLEDStartIndex)
Modifies this Control Request's LEDStartIndex parameter and returns itself for method-chaining and ea...
Definition RainbowAnimation.hpp:140
units::frequency::hertz_t UpdateFreqHz
The period at which this control will update at.
Definition RainbowAnimation.hpp:100
RainbowAnimation & WithSlot(int newSlot)
Modifies this Control Request's Slot parameter and returns itself for method-chaining and easier to u...
Definition RainbowAnimation.hpp:175
units::frequency::hertz_t FrameRate
The frame rate of the animation, from [2, 1000] Hz.
Definition RainbowAnimation.hpp:87
RainbowAnimation & WithFrameRate(units::frequency::hertz_t newFrameRate)
Modifies this Control Request's FrameRate parameter and returns itself for method-chaining and easier...
Definition RainbowAnimation.hpp:227
RainbowAnimation(int LEDStartIndex, int LEDEndIndex)
Animation that creates a rainbow throughout all the LEDs.
Definition RainbowAnimation.hpp:122
units::dimensionless::scalar_t Brightness
The brightness of the animation, as a scalar from 0.0 to 1.0.
Definition RainbowAnimation.hpp:72
int Slot
The slot of this animation, within [0, 7].
Definition RainbowAnimation.hpp:68
RainbowAnimation & WithDirection(signals::AnimationDirectionValue newDirection)
Modifies this Control Request's Direction parameter and returns itself for method-chaining and easier...
Definition RainbowAnimation.hpp:205
std::map< std::string, std::string > GetControlInfo() const override
Gets information about this control request.
Definition RainbowAnimation.hpp:274
RainbowAnimation & WithBrightness(units::dimensionless::scalar_t newBrightness)
Modifies this Control Request's Brightness parameter and returns itself for method-chaining and easie...
Definition RainbowAnimation.hpp:190
std::string ToString() const override
Returns a string representation of the object.
Definition RainbowAnimation.hpp:256
RainbowAnimation & WithUpdateFreqHz(units::frequency::hertz_t newUpdateFreqHz)
Sets the period at which this control will update at.
Definition RainbowAnimation.hpp:246
int LEDStartIndex
The index of the first LED this animation controls (inclusive).
Definition RainbowAnimation.hpp:55
int LEDEndIndex
The index of the last LED this animation controls (inclusive).
Definition RainbowAnimation.hpp:63
Direction of the animation.
Definition SpnEnums.hpp:6388
int value
Definition SpnEnums.hpp:6390
static constexpr int Forward
The animation starts at the specified LED start index and moves towards the LED end index.
Definition SpnEnums.hpp:6396
Status codes reported by APIs, including OK, warnings, and errors.
Definition StatusCodes.h:27
Definition Diff_PositionDutyCycle_Position.hpp:15