13#include <units/voltage.h>
14#include <units/frequency.h>
15#include <units/time.h>
30 bool ApplyConfigsOnRequest{
false};
32 ctre::phoenix::StatusCode SendRequest(
const char *network, uint32_t deviceHash,
bool cancelOtherRequests, std::shared_ptr<ControlRequest> &req)
override
34 if (req.get() !=
this)
36 auto const reqCast =
dynamic_cast<VoltageOut *
>(req.get());
37 if (reqCast !=
nullptr)
43 req = std::make_shared<VoltageOut>(*
this);
49 std::string strs{ss.str()};
51 ApplyConfigsOnRequest =
false;
158 Output = std::move(newOutput);
211 std::stringstream ss;
212 ss <<
"class: VoltageOut" << std::endl;
213 ss <<
"Output: " <<
Output.to<
double>() << std::endl;
214 ss <<
"EnableFOC: " <<
EnableFOC << std::endl;
233 std::map<std::string, std::string> controlInfo;
234 std::stringstream ss;
235 controlInfo[
"Name"] =
GetName();
236 ss <<
Output.to<
double>(); controlInfo[
"Output"] = ss.str(); ss.str(std::string{});
237 ss <<
EnableFOC; controlInfo[
"EnableFOC"] = ss.str(); ss.str(std::string{});
CTREXPORT int c_ctre_phoenix6_requestConfigApply(const char *canbus, uint32_t ecuEncoding, double timeoutSeconds, const char *str, uint32_t strlen, bool forceApply)
CTREXPORT int c_ctre_phoenix6_RequestControlVoltageOut(const char *canbus, uint32_t ecuEncoding, double updateTime, bool cancelOtherRequests, double Output, bool EnableFOC, bool OverrideBrakeDurNeutral)
Voltage-specific configs.
Definition: Configs.hpp:538
std::string Serialize() const override
Definition: Configs.hpp:587
Abstract Control Request class that other control requests extend for use.
Definition: ControlRequest.hpp:28
std::string const & GetName() const
Definition: ControlRequest.hpp:51
Request a specified voltage.
Definition: VoltageOut.hpp:29
void ForceApplyConfigs()
Forces configs to be applied the next time this is used in a setControl.
Definition: VoltageOut.hpp:224
bool OverrideBrakeDurNeutral
Set to true to static-brake the rotor when output is zero (or within deadband).
Definition: VoltageOut.hpp:77
VoltageOut & WithUpdateFreqHz(units::frequency::hertz_t newUpdateFreqHz)
Sets the period at which this control will update at.
Definition: VoltageOut.hpp:199
VoltageOut & WithOutput(units::voltage::volt_t newOutput)
Modifies this Control Request's Output parameter and returns itself for method-chaining and easier to...
Definition: VoltageOut.hpp:156
configs::VoltageConfigs Voltage
Voltage-specific configs.
Definition: VoltageOut.hpp:84
units::frequency::hertz_t UpdateFreqHz
The period at which this control will update at.
Definition: VoltageOut.hpp:102
std::map< std::string, std::string > GetControlInfo() const override
Gets information about this control request.
Definition: VoltageOut.hpp:231
VoltageOut(units::voltage::volt_t Output)
Request a specified voltage.
Definition: VoltageOut.hpp:147
VoltageOut & WithOverrideBrakeDurNeutral(bool newOverrideBrakeDurNeutral)
Modifies this Control Request's OverrideBrakeDurNeutral parameter and returns itself for method-chain...
Definition: VoltageOut.hpp:180
units::voltage::volt_t Output
Voltage to attempt to drive at.
Definition: VoltageOut.hpp:59
bool EnableFOC
Set to true to use FOC commutation (requires Phoenix Pro), which increases peak power by ~15%.
Definition: VoltageOut.hpp:70
VoltageOut(units::voltage::volt_t Output, bool EnableFOC, bool OverrideBrakeDurNeutral)
Request a specified voltage.
Definition: VoltageOut.hpp:132
units::time::second_t ConfigTimeout
The timeout when sending configs associated with this control.
Definition: VoltageOut.hpp:89
VoltageOut & WithEnableFOC(bool newEnableFOC)
Modifies this Control Request's EnableFOC parameter and returns itself for method-chaining and easier...
Definition: VoltageOut.hpp:168
std::string ToString() const override
Returns a string representation of the object.
Definition: VoltageOut.hpp:209
Definition: ManualEvent.hpp:12