13#include <units/current.h>
14#include <units/dimensionless.h>
15#include <units/frequency.h>
16#include <units/time.h>
33 bool ApplyConfigsOnRequest{
false};
35 ctre::phoenix::StatusCode SendRequest(
const char *network, uint32_t deviceHash,
bool cancelOtherRequests, std::shared_ptr<ControlRequest> &req)
override
37 if (req.get() !=
this)
40 if (reqCast !=
nullptr)
46 req = std::make_shared<TorqueCurrentFOC>(*
this);
52 std::string strs{ss.str()};
54 ApplyConfigsOnRequest =
false;
174 Output = std::move(newOutput);
239 std::stringstream ss;
240 ss <<
"class: TorqueCurrentFOC" << std::endl;
241 ss <<
"Output: " <<
Output.to<
double>() << std::endl;
242 ss <<
"MaxAbsDutyCycle: " <<
MaxAbsDutyCycle.to<
double>() << std::endl;
243 ss <<
"Deadband: " <<
Deadband.to<
double>() << std::endl;
262 std::map<std::string, std::string> controlInfo;
263 std::stringstream ss;
264 controlInfo[
"Name"] =
GetName();
265 ss <<
Output.to<
double>(); controlInfo[
"Output"] = ss.str(); ss.str(std::string{});
266 ss <<
MaxAbsDutyCycle.to<
double>(); controlInfo[
"MaxAbsDutyCycle"] = ss.str(); ss.str(std::string{});
267 ss <<
Deadband.to<
double>(); controlInfo[
"Deadband"] = ss.str(); ss.str(std::string{});
CTREXPORT int c_ctre_phoenix6_RequestControlTorqueCurrentFOC(const char *canbus, uint32_t ecuEncoding, double updateTime, bool cancelOtherRequests, double Output, double MaxAbsDutyCycle, double Deadband, bool OverrideCoastDurNeutral)
CTREXPORT int c_ctre_phoenix6_requestConfigApply(const char *canbus, uint32_t ecuEncoding, double timeoutSeconds, const char *str, uint32_t strlen, bool forceApply)
Abstract Control Request class that other control requests extend for use.
Definition: ControlRequest.hpp:28
std::string const & GetName() const
Definition: ControlRequest.hpp:51
Requires Phoenix Pro; Request a specified motor current (field oriented control).
Definition: TorqueCurrentFOC.hpp:32
TorqueCurrentFOC & WithDeadband(units::current::ampere_t newDeadband)
Modifies this Control Request's Deadband parameter and returns itself for method-chaining and easier ...
Definition: TorqueCurrentFOC.hpp:196
units::time::second_t ConfigTimeout
The timeout when sending configs associated with this control.
Definition: TorqueCurrentFOC.hpp:94
TorqueCurrentFOC & WithUpdateFreqHz(units::frequency::hertz_t newUpdateFreqHz)
Sets the period at which this control will update at.
Definition: TorqueCurrentFOC.hpp:227
std::map< std::string, std::string > GetControlInfo() const override
Gets information about this control request.
Definition: TorqueCurrentFOC.hpp:260
TorqueCurrentFOC & WithOutput(units::current::ampere_t newOutput)
Modifies this Control Request's Output parameter and returns itself for method-chaining and easier to...
Definition: TorqueCurrentFOC.hpp:172
void ForceApplyConfigs()
Forces configs to be applied the next time this is used in a setControl.
Definition: TorqueCurrentFOC.hpp:253
units::current::ampere_t Output
Amount of motor current in Amperes.
Definition: TorqueCurrentFOC.hpp:62
bool OverrideCoastDurNeutral
Set to true to coast the rotor when output is zero (or within deadband).
Definition: TorqueCurrentFOC.hpp:87
TorqueCurrentFOC & WithOverrideCoastDurNeutral(bool newOverrideCoastDurNeutral)
Modifies this Control Request's OverrideCoastDurNeutral parameter and returns itself for method-chain...
Definition: TorqueCurrentFOC.hpp:208
TorqueCurrentFOC & WithMaxAbsDutyCycle(units::dimensionless::scalar_t newMaxAbsDutyCycle)
Modifies this Control Request's MaxAbsDutyCycle parameter and returns itself for method-chaining and ...
Definition: TorqueCurrentFOC.hpp:184
units::current::ampere_t Deadband
Deadband in Amperes.
Definition: TorqueCurrentFOC.hpp:80
TorqueCurrentFOC(units::current::ampere_t Output, units::dimensionless::scalar_t MaxAbsDutyCycle, units::current::ampere_t Deadband, bool OverrideCoastDurNeutral)
Requires Phoenix Pro; Request a specified motor current (field oriented control).
Definition: TorqueCurrentFOC.hpp:144
TorqueCurrentFOC(units::current::ampere_t Output)
Requires Phoenix Pro; Request a specified motor current (field oriented control).
Definition: TorqueCurrentFOC.hpp:163
std::string ToString() const override
Returns a string representation of the object.
Definition: TorqueCurrentFOC.hpp:237
units::frequency::hertz_t UpdateFreqHz
The period at which this control will update at.
Definition: TorqueCurrentFOC.hpp:107
units::dimensionless::scalar_t MaxAbsDutyCycle
The maximum absolute motor output that can be applied, which effectively limits the velocity.
Definition: TorqueCurrentFOC.hpp:71
Definition: ManualEvent.hpp:12