13#include <units/voltage.h>
14#include <units/frequency.h>
15#include <units/time.h>
30 bool ApplyConfigsOnRequest;
32 ctre::phoenix::StatusCode SendRequest(
const char *network, uint32_t deviceHash,
bool cancelOtherRequests, std::shared_ptr<ControlRequest> &req)
36 ss <<
Output.to<
double>(); ref[
"Output"] = ss.str(); ss.str(std::string());
37 ss <<
EnableFOC; ref[
"EnableFOC"] = ss.str(); ss.str(std::string());
40 if (req.get() !=
this)
42 auto const reqCast =
dynamic_cast<VoltageOut *
>(req.get());
43 if (reqCast !=
nullptr)
49 req = std::make_shared<VoltageOut>(*
this);
54 std::string strs{ss.str()};
56 ApplyConfigsOnRequest =
false;
218 std::stringstream ss;
219 ss <<
"class: VoltageOut" << std::endl;
220 ss <<
"Output: " <<
Output.to<
double>() << std::endl;
221 ss <<
"EnableFOC: " <<
EnableFOC << std::endl;
CTREXPORT int c_ctre_phoenixpro_requestConfigApply(const char *canbus, uint32_t ecuEncoding, double timeoutSeconds, const char *str, uint32_t strlen, bool forceApply)
CTREXPORT int c_ctre_phoenixpro_RequestControlVoltageOut(const char *canbus, uint32_t ecuEncoding, double updateTime, bool cancelOtherRequests, double Output, bool EnableFOC, bool OverrideBrakeDurNeutral)
Voltage-specific configs.
Definition: Configs.hpp:920
std::string Serialize() const
Definition: Configs.hpp:967
std::map< std::string, std::string > & GetNameValues()
Gets the map of control parameter names to the corresponding applied value.
Definition: ControlRequest.hpp:52
Abstract Control Request class that other control requests extend for use.
Definition: ControlRequest.hpp:65
ControlInfo requestReference
Definition: ControlRequest.hpp:70
Request a specified voltage.
Definition: VoltageOut.hpp:29
bool OverrideBrakeDurNeutral
Set to true to static-brake the rotor when output is zero (or within deadband).
Definition: VoltageOut.hpp:82
VoltageOut(units::voltage::volt_t Output)
Request a specified voltage.
Definition: VoltageOut.hpp:154
configs::VoltageConfigs Voltage
Voltage-specific configs.
Definition: VoltageOut.hpp:89
VoltageOut & WithUpdateFreqHz(units::frequency::hertz_t newUpdateFreqHz)
Sets the period at which this control will update at.
Definition: VoltageOut.hpp:206
void ForceApplyConfigs()
Forces configs to be applied the next time this is used in a setControl.
Definition: VoltageOut.hpp:231
VoltageOut(units::voltage::volt_t Output, bool EnableFOC, bool OverrideBrakeDurNeutral)
Request a specified voltage.
Definition: VoltageOut.hpp:138
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:163
units::time::second_t ConfigTimeout
The timeout when sending configs associated with this control.
Definition: VoltageOut.hpp:94
units::frequency::hertz_t UpdateFreqHz
The period at which this control will update at.
Definition: VoltageOut.hpp:107
std::string ToString() const
Returns a string representation of the object.
Definition: VoltageOut.hpp:216
bool EnableFOC
Set to true to use FOC commutation, which increases peak power by ~15%.
Definition: VoltageOut.hpp:75
VoltageOut & WithOverrideBrakeDurNeutral(bool newOverrideBrakeDurNeutral)
Modifies this Control Request's OverrideBrakeDurNeutral parameter and returns itself for method-chain...
Definition: VoltageOut.hpp:187
VoltageOut & WithEnableFOC(bool newEnableFOC)
Modifies this Control Request's EnableFOC parameter and returns itself for method-chaining and easier...
Definition: VoltageOut.hpp:175
units::voltage::volt_t Output
Voltage to attempt to drive at.
Definition: VoltageOut.hpp:64
Definition: string_util.hpp:14