13#include <units/current.h>
14#include <units/dimensionless.h>
15#include <units/frequency.h>
16#include <units/time.h>
33 ctre::phoenix::StatusCode SendRequest(
const char *network, uint32_t deviceHash,
bool cancelOtherRequests, std::shared_ptr<ControlRequest> &req)
override
35 if (req.get() !=
this)
38 if (reqCast !=
nullptr)
44 req = std::make_shared<TorqueCurrentFOC>(*
this);
171 Output = std::move(newOutput);
292 std::stringstream ss;
293 ss <<
"class: TorqueCurrentFOC" << std::endl;
294 ss <<
"Output: " <<
Output.to<
double>() << std::endl;
295 ss <<
"MaxAbsDutyCycle: " <<
MaxAbsDutyCycle.to<
double>() << std::endl;
296 ss <<
"Deadband: " <<
Deadband.to<
double>() << std::endl;
310 std::map<std::string, std::string> controlInfo;
311 std::stringstream ss;
312 controlInfo[
"Name"] =
GetName();
313 ss <<
Output.to<
double>(); controlInfo[
"Output"] = ss.str(); ss.str(std::string{});
314 ss <<
MaxAbsDutyCycle.to<
double>(); controlInfo[
"MaxAbsDutyCycle"] = ss.str(); ss.str(std::string{});
315 ss <<
Deadband.to<
double>(); controlInfo[
"Deadband"] = ss.str(); ss.str(std::string{});
317 ss <<
LimitForwardMotion; controlInfo[
"LimitForwardMotion"] = ss.str(); ss.str(std::string{});
318 ss <<
LimitReverseMotion; controlInfo[
"LimitReverseMotion"] = 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, bool LimitForwardMotion, bool LimitReverseMotion)
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:209
TorqueCurrentFOC & WithLimitForwardMotion(bool newLimitForwardMotion)
Modifies this Control Request's LimitForwardMotion parameter and returns itself for method-chaining a...
Definition: TorqueCurrentFOC.hpp:244
TorqueCurrentFOC & WithUpdateFreqHz(units::frequency::hertz_t newUpdateFreqHz)
Sets the period at which this control will update at.
Definition: TorqueCurrentFOC.hpp:280
std::map< std::string, std::string > GetControlInfo() const override
Gets information about this control request.
Definition: TorqueCurrentFOC.hpp:308
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:169
TorqueCurrentFOC & WithLimitReverseMotion(bool newLimitReverseMotion)
Modifies this Control Request's LimitReverseMotion parameter and returns itself for method-chaining a...
Definition: TorqueCurrentFOC.hpp:261
units::current::ampere_t Output
Amount of motor current in Amperes.
Definition: TorqueCurrentFOC.hpp:55
bool OverrideCoastDurNeutral
Set to true to coast the rotor when output is zero (or within deadband).
Definition: TorqueCurrentFOC.hpp:80
TorqueCurrentFOC & WithOverrideCoastDurNeutral(bool newOverrideCoastDurNeutral)
Modifies this Control Request's OverrideCoastDurNeutral parameter and returns itself for method-chain...
Definition: TorqueCurrentFOC.hpp:227
TorqueCurrentFOC & WithMaxAbsDutyCycle(units::dimensionless::scalar_t newMaxAbsDutyCycle)
Modifies this Control Request's MaxAbsDutyCycle parameter and returns itself for method-chaining and ...
Definition: TorqueCurrentFOC.hpp:189
bool LimitReverseMotion
Set to true to force reverse limiting.
Definition: TorqueCurrentFOC.hpp:92
units::current::ampere_t Deadband
Deadband in Amperes.
Definition: TorqueCurrentFOC.hpp:73
bool LimitForwardMotion
Set to true to force forward limiting.
Definition: TorqueCurrentFOC.hpp:86
TorqueCurrentFOC(units::current::ampere_t Output, units::dimensionless::scalar_t MaxAbsDutyCycle=1.0, units::current::ampere_t Deadband=0.0_A, bool OverrideCoastDurNeutral=false, bool LimitForwardMotion=false, bool LimitReverseMotion=false)
Requires Phoenix Pro; Request a specified motor current (field oriented control).
Definition: TorqueCurrentFOC.hpp:151
std::string ToString() const override
Returns a string representation of the object.
Definition: TorqueCurrentFOC.hpp:290
units::frequency::hertz_t UpdateFreqHz
The period at which this control will update at.
Definition: TorqueCurrentFOC.hpp:105
units::dimensionless::scalar_t MaxAbsDutyCycle
The maximum absolute motor output that can be applied, which effectively limits the velocity.
Definition: TorqueCurrentFOC.hpp:64
Definition: string_util.hpp:15