13#include <units/angular_velocity.h>
14#include <units/angular_acceleration.h>
15#include <units/current.h>
16#include <units/frequency.h>
17#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<VelocityTorqueCurrentFOC>(*
this);
52 std::string strs{ss.str()};
54 ApplyConfigsOnRequest =
false;
62 units::angular_velocity::turns_per_second_t
Velocity;
66 units::angular_acceleration::turns_per_second_squared_t
Acceleration;
198 Slot = std::move(newSlot);
239 std::stringstream ss;
240 ss <<
"class: VelocityTorqueCurrentFOC" << std::endl;
241 ss <<
"Velocity: " <<
Velocity.to<
double>() << std::endl;
242 ss <<
"Acceleration: " <<
Acceleration.to<
double>() << std::endl;
243 ss <<
"FeedForward: " <<
FeedForward.to<
double>() << std::endl;
244 ss <<
"Slot: " <<
Slot << std::endl;
263 std::map<std::string, std::string> controlInfo;
264 std::stringstream ss;
265 controlInfo[
"Name"] =
GetName();
266 ss <<
Velocity.to<
double>(); controlInfo[
"Velocity"] = ss.str(); ss.str(std::string{});
267 ss <<
Acceleration.to<
double>(); controlInfo[
"Acceleration"] = ss.str(); ss.str(std::string{});
268 ss <<
FeedForward.to<
double>(); controlInfo[
"FeedForward"] = ss.str(); ss.str(std::string{});
269 ss <<
Slot; controlInfo[
"Slot"] = 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_RequestControlVelocityTorqueCurrentFOC(const char *canbus, uint32_t ecuEncoding, double updateTime, bool cancelOtherRequests, double Velocity, double Acceleration, double FeedForward, int Slot, bool OverrideCoastDurNeutral)
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 PID to target velocity with torque current feedforward.
Definition: VelocityTorqueCurrentFOC.hpp:32
units::angular_acceleration::turns_per_second_squared_t Acceleration
Acceleration to drive toward in rotations per second squared.
Definition: VelocityTorqueCurrentFOC.hpp:66
std::map< std::string, std::string > GetControlInfo() const override
Gets information about this control request.
Definition: VelocityTorqueCurrentFOC.hpp:261
VelocityTorqueCurrentFOC & WithOverrideCoastDurNeutral(bool newOverrideCoastDurNeutral)
Modifies this Control Request's OverrideCoastDurNeutral parameter and returns itself for method-chain...
Definition: VelocityTorqueCurrentFOC.hpp:208
bool OverrideCoastDurNeutral
Set to true to coast the rotor when output is zero (or within deadband).
Definition: VelocityTorqueCurrentFOC.hpp:84
units::angular_velocity::turns_per_second_t Velocity
Velocity to drive toward in rotations per second.
Definition: VelocityTorqueCurrentFOC.hpp:62
units::time::second_t ConfigTimeout
The timeout when sending configs associated with this control.
Definition: VelocityTorqueCurrentFOC.hpp:91
units::current::ampere_t FeedForward
Feedforward to apply in torque current in Amperes.
Definition: VelocityTorqueCurrentFOC.hpp:71
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:160
units::frequency::hertz_t UpdateFreqHz
The period at which this control will update at.
Definition: VelocityTorqueCurrentFOC.hpp:104
VelocityTorqueCurrentFOC(units::angular_velocity::turns_per_second_t Velocity, units::angular_acceleration::turns_per_second_squared_t Acceleration, units::current::ampere_t FeedForward, int Slot, bool OverrideCoastDurNeutral)
Requires Phoenix Pro; Request PID to target velocity with torque current feedforward.
Definition: VelocityTorqueCurrentFOC.hpp:132
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:184
VelocityTorqueCurrentFOC & WithSlot(int newSlot)
Modifies this Control Request's Slot parameter and returns itself for method-chaining and easier to u...
Definition: VelocityTorqueCurrentFOC.hpp:196
VelocityTorqueCurrentFOC(units::angular_velocity::turns_per_second_t Velocity)
Requires Phoenix Pro; Request PID to target velocity with torque current feedforward.
Definition: VelocityTorqueCurrentFOC.hpp:151
VelocityTorqueCurrentFOC & WithAcceleration(units::angular_acceleration::turns_per_second_squared_t newAcceleration)
Modifies this Control Request's Acceleration parameter and returns itself for method-chaining and eas...
Definition: VelocityTorqueCurrentFOC.hpp:172
int Slot
Select which gains are applied by selecting the slot.
Definition: VelocityTorqueCurrentFOC.hpp:77
void ForceApplyConfigs()
Forces configs to be applied the next time this is used in a setControl.
Definition: VelocityTorqueCurrentFOC.hpp:254
std::string ToString() const override
Returns a string representation of the object.
Definition: VelocityTorqueCurrentFOC.hpp:237
VelocityTorqueCurrentFOC & WithUpdateFreqHz(units::frequency::hertz_t newUpdateFreqHz)
Sets the period at which this control will update at.
Definition: VelocityTorqueCurrentFOC.hpp:227
Definition: ManualEvent.hpp:12