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)
33 auto const reqCast =
dynamic_cast<FireAnimation *
>(req.get());
34 if (reqCast !=
nullptr)
40 req = std::make_shared<FireAnimation>(*
this);
44 return c_ctre_phoenix6_RequestControlFireAnimation(network, deviceHash,
UpdateFreqHz.to<
double>(),
LEDStartIndex,
LEDEndIndex,
Slot,
Brightness.to<
double>(),
Direction.
value,
Sparking.to<
double>(),
Cooling.to<
double>(),
FrameRate.to<
double>());
86 units::dimensionless::scalar_t
Cooling = 0.3;
187 Slot = std::move(newSlot);
249 Cooling = std::move(newCooling);
300 std::stringstream ss;
301 ss <<
"Control: FireAnimation" << std::endl;
303 ss <<
" LEDEndIndex: " <<
LEDEndIndex << std::endl;
304 ss <<
" Slot: " <<
Slot << std::endl;
305 ss <<
" Brightness: " <<
Brightness.to<
double>() << std::endl;
306 ss <<
" Direction: " <<
Direction << std::endl;
307 ss <<
" Sparking: " <<
Sparking.to<
double>() << std::endl;
308 ss <<
" Cooling: " <<
Cooling.to<
double>() << std::endl;
309 ss <<
" FrameRate: " <<
FrameRate.to<
double>() <<
" Hz" << std::endl;
320 std::map<std::string, std::string> controlInfo;
321 std::stringstream ss;
322 controlInfo[
"Name"] =
GetName();
323 ss <<
LEDStartIndex; controlInfo[
"LEDStartIndex"] = ss.str(); ss.str(std::string{});
324 ss <<
LEDEndIndex; controlInfo[
"LEDEndIndex"] = ss.str(); ss.str(std::string{});
325 ss <<
Slot; controlInfo[
"Slot"] = ss.str(); ss.str(std::string{});
326 ss <<
Brightness.to<
double>(); controlInfo[
"Brightness"] = ss.str(); ss.str(std::string{});
327 ss <<
Direction; controlInfo[
"Direction"] = ss.str(); ss.str(std::string{});
328 ss <<
Sparking.to<
double>(); controlInfo[
"Sparking"] = ss.str(); ss.str(std::string{});
329 ss <<
Cooling.to<
double>(); controlInfo[
"Cooling"] = ss.str(); ss.str(std::string{});
330 ss <<
FrameRate.to<
double>(); controlInfo[
"FrameRate"] = ss.str(); ss.str(std::string{});
CTREXPORT int c_ctre_phoenix6_RequestControlFireAnimation(const char *canbus, uint32_t ecuEncoding, double updateFrequency, int LEDStartIndex, int LEDEndIndex, int Slot, double Brightness, int Direction, double Sparking, double Cooling, 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 looks similar to a flame flickering.
Definition FireAnimation.hpp:28
FireAnimation & WithBrightness(units::dimensionless::scalar_t newBrightness)
Modifies this Control Request's Brightness parameter and returns itself for method-chaining and easie...
Definition FireAnimation.hpp:200
FireAnimation & WithSparking(units::dimensionless::scalar_t newSparking)
Modifies this Control Request's Sparking parameter and returns itself for method-chaining and easier ...
Definition FireAnimation.hpp:231
units::dimensionless::scalar_t Sparking
The proportion of time in which sparks reignite the fire, as a scalar from 0.0 to 1....
Definition FireAnimation.hpp:81
FireAnimation & WithDirection(signals::AnimationDirectionValue newDirection)
Modifies this Control Request's Direction parameter and returns itself for method-chaining and easier...
Definition FireAnimation.hpp:215
FireAnimation & WithUpdateFreqHz(units::frequency::hertz_t newUpdateFreqHz)
Sets the period at which this control will update at.
Definition FireAnimation.hpp:288
std::string ToString() const override
Returns a string representation of the object.
Definition FireAnimation.hpp:298
units::dimensionless::scalar_t Brightness
The brightness of the animation, as a scalar from 0.0 to 1.0.
Definition FireAnimation.hpp:72
units::frequency::hertz_t UpdateFreqHz
The period at which this control will update at.
Definition FireAnimation.hpp:110
FireAnimation & WithSlot(int newSlot)
Modifies this Control Request's Slot parameter and returns itself for method-chaining and easier to u...
Definition FireAnimation.hpp:185
FireAnimation & WithFrameRate(units::frequency::hertz_t newFrameRate)
Modifies this Control Request's FrameRate parameter and returns itself for method-chaining and easier...
Definition FireAnimation.hpp:269
int LEDEndIndex
The index of the last LED this animation controls (inclusive).
Definition FireAnimation.hpp:63
int Slot
The slot of this animation, within [0, 7].
Definition FireAnimation.hpp:68
units::frequency::hertz_t FrameRate
The frame rate of the animation, from [2, 1000] Hz.
Definition FireAnimation.hpp:97
FireAnimation(int LEDStartIndex, int LEDEndIndex)
Animation that looks similar to a flame flickering.
Definition FireAnimation.hpp:132
units::dimensionless::scalar_t Cooling
The rate at which the fire cools along the travel, as a scalar from 0.0 to 1.0.
Definition FireAnimation.hpp:86
std::map< std::string, std::string > GetControlInfo() const override
Gets information about this control request.
Definition FireAnimation.hpp:318
int LEDStartIndex
The index of the first LED this animation controls (inclusive).
Definition FireAnimation.hpp:55
signals::AnimationDirectionValue Direction
The direction of the animation.
Definition FireAnimation.hpp:76
FireAnimation & WithLEDEndIndex(int newLEDEndIndex)
Modifies this Control Request's LEDEndIndex parameter and returns itself for method-chaining and easi...
Definition FireAnimation.hpp:169
FireAnimation & WithLEDStartIndex(int newLEDStartIndex)
Modifies this Control Request's LEDStartIndex parameter and returns itself for method-chaining and ea...
Definition FireAnimation.hpp:150
FireAnimation & WithCooling(units::dimensionless::scalar_t newCooling)
Modifies this Control Request's Cooling parameter and returns itself for method-chaining and easier t...
Definition FireAnimation.hpp:247
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