13#include <units/angular_velocity.h>
14#include <units/current.h>
15#include <units/frequency.h>
16#include <units/time.h>
31 bool ApplyConfigsOnRequest;
33 ctre::phoenix::StatusCode SendRequest(
const char *network, uint32_t deviceHash,
bool cancelOtherRequests, std::shared_ptr<ControlRequest> &req)
37 ss <<
Velocity.to<
double>(); ref[
"Velocity"] = ss.str(); ss.str(std::string());
38 ss <<
FeedForward.to<
double>(); ref[
"FeedForward"] = ss.str(); ss.str(std::string());
39 ss <<
Slot; ref[
"Slot"] = ss.str(); ss.str(std::string());
42 if (req.get() !=
this)
45 if (reqCast !=
nullptr)
51 req = std::make_shared<VelocityTorqueCurrentFOC>(*
this);
56 std::string strs{ss.str()};
58 ApplyConfigsOnRequest =
false;
66 units::angular_velocity::turns_per_second_t
Velocity;
223 std::stringstream ss;
224 ss <<
"class: VelocityTorqueCurrentFOC" << std::endl;
225 ss <<
"Velocity: " <<
Velocity.to<
double>() << std::endl;
226 ss <<
"FeedForward: " <<
FeedForward.to<
double>() << std::endl;
227 ss <<
"Slot: " <<
Slot << 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_RequestControlVelocityTorqueCurrentFOC(const char *canbus, uint32_t ecuEncoding, double updateTime, bool cancelOtherRequests, double Velocity, double FeedForward, int Slot, bool OverrideCoastDurNeutral)
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 PID to target velocity with torque current feedforward.
Definition: VelocityTorqueCurrentFOC.hpp:30
units::frequency::hertz_t UpdateFreqHz
The period at which this control will update at.
Definition: VelocityTorqueCurrentFOC.hpp:104
units::time::second_t ConfigTimeout
The timeout when sending configs associated with this control.
Definition: VelocityTorqueCurrentFOC.hpp:91
std::string ToString() const
Returns a string representation of the object.
Definition: VelocityTorqueCurrentFOC.hpp:221
VelocityTorqueCurrentFOC & WithFeedForward(units::current::ampere_t newFeedForward)
Modifies this Control Request's FeedForward parameter and returns itself for method-chaining and easi...
Definition: VelocityTorqueCurrentFOC.hpp:168
VelocityTorqueCurrentFOC & WithVelocity(units::angular_velocity::turns_per_second_t newVelocity)
Modifies this Control Request's Velocity parameter and returns itself for method-chaining and easier ...
Definition: VelocityTorqueCurrentFOC.hpp:156
units::angular_velocity::turns_per_second_t Velocity
Velocity to drive toward in rotations per second.
Definition: VelocityTorqueCurrentFOC.hpp:66
VelocityTorqueCurrentFOC(units::angular_velocity::turns_per_second_t Velocity)
Request PID to target velocity with torque current feedforward.
Definition: VelocityTorqueCurrentFOC.hpp:147
int Slot
Select which gains are applied by selecting the slot.
Definition: VelocityTorqueCurrentFOC.hpp:77
VelocityTorqueCurrentFOC(units::angular_velocity::turns_per_second_t Velocity, units::current::ampere_t FeedForward, int Slot, bool OverrideCoastDurNeutral)
Request PID to target velocity with torque current feedforward.
Definition: VelocityTorqueCurrentFOC.hpp:130
VelocityTorqueCurrentFOC & WithUpdateFreqHz(units::frequency::hertz_t newUpdateFreqHz)
Sets the period at which this control will update at.
Definition: VelocityTorqueCurrentFOC.hpp:211
void ForceApplyConfigs()
Forces configs to be applied the next time this is used in a setControl.
Definition: VelocityTorqueCurrentFOC.hpp:237
VelocityTorqueCurrentFOC & WithOverrideCoastDurNeutral(bool newOverrideCoastDurNeutral)
Modifies this Control Request's OverrideCoastDurNeutral parameter and returns itself for method-chain...
Definition: VelocityTorqueCurrentFOC.hpp:192
units::current::ampere_t FeedForward
Feedforward to apply in torque current in Amperes.
Definition: VelocityTorqueCurrentFOC.hpp:71
bool OverrideCoastDurNeutral
Set to true to coast the rotor when output is zero (or within deadband).
Definition: VelocityTorqueCurrentFOC.hpp:84
VelocityTorqueCurrentFOC & WithSlot(int newSlot)
Modifies this Control Request's Slot parameter and returns itself for method-chaining and easier to u...
Definition: VelocityTorqueCurrentFOC.hpp:180
Definition: string_util.hpp:14