14#include <units/frequency.h>
15#include <units/time.h>
30 bool ApplyConfigsOnRequest{
false};
32 ctre::phoenix::StatusCode SendRequest(
const char *network, uint32_t deviceHash,
bool cancelOtherRequests, std::shared_ptr<ControlRequest> &req)
override
34 if (req.get() !=
this)
37 if (reqCast !=
nullptr)
43 req = std::make_shared<Diff_VelocityDutyCycle_VelocityDutyCycle>(*
this);
49 std::string strs{ss.str()};
51 ApplyConfigsOnRequest =
false;
52 return c_ctre_phoenix6_RequestControlDiff_VelocityDutyCycle_VelocityDutyCycle(network, deviceHash,
UpdateFreqHz.to<
double>(), cancelOtherRequests,
AverageRequest.
Velocity.to<
double>(),
AverageRequest.
Acceleration.to<
double>(),
AverageRequest.
EnableFOC,
AverageRequest.
FeedForward.to<
double>(),
AverageRequest.
Slot,
AverageRequest.
OverrideBrakeDurNeutral,
DifferentialRequest.
Velocity.to<
double>(),
DifferentialRequest.
Acceleration.to<
double>(),
DifferentialRequest.
EnableFOC,
DifferentialRequest.
FeedForward.to<
double>(),
DifferentialRequest.
Slot,
DifferentialRequest.
OverrideBrakeDurNeutral);
148 std::stringstream ss;
149 ss <<
"class: Diff_VelocityDutyCycle_VelocityDutyCycle" << std::endl;
150 ss <<
"AverageRequest:" << std::endl;
157 ss <<
"DifferentialRequest:" << std::endl;
181 std::map<std::string, std::string> controlInfo;
182 std::stringstream ss;
183 controlInfo[
"Name"] =
GetName();
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_RequestControlDiff_VelocityDutyCycle_VelocityDutyCycle(const char *canbus, uint32_t ecuEncoding, double updateTime, bool cancelOtherRequests, double AverageRequest_Velocity, double AverageRequest_Acceleration, bool AverageRequest_EnableFOC, double AverageRequest_FeedForward, int AverageRequest_Slot, bool AverageRequest_OverrideBrakeDurNeutral, double DifferentialRequest_Velocity, double DifferentialRequest_Acceleration, bool DifferentialRequest_EnableFOC, double DifferentialRequest_FeedForward, int DifferentialRequest_Slot, bool DifferentialRequest_OverrideBrakeDurNeutral)
Abstract Control Request class that other control requests extend for use.
Definition: ControlRequest.hpp:28
std::string const & GetName() const
Definition: ControlRequest.hpp:51
Request PID to target velocity with duty cycle feedforward.
Definition: VelocityDutyCycle.hpp:31
int Slot
Select which gains are applied by selecting the slot.
Definition: VelocityDutyCycle.hpp:86
units::angular_acceleration::turns_per_second_squared_t Acceleration
Acceleration to drive toward in rotations per second squared.
Definition: VelocityDutyCycle.hpp:65
bool OverrideBrakeDurNeutral
Set to true to static-brake the rotor when output is zero (or within deadband).
Definition: VelocityDutyCycle.hpp:93
units::angular_velocity::turns_per_second_t Velocity
Velocity to drive toward in rotations per second.
Definition: VelocityDutyCycle.hpp:61
units::dimensionless::scalar_t FeedForward
Feedforward to apply in fractional units between -1 and +1.
Definition: VelocityDutyCycle.hpp:80
bool EnableFOC
Set to true to use FOC commutation (requires Phoenix Pro), which increases peak power by ~15%.
Definition: VelocityDutyCycle.hpp:76
std::string ToString() const override
Returns a string representation of the object.
Definition: VelocityDutyCycle.hpp:266
Requires Phoenix Pro; Differential control with velocity average target and velocity difference targe...
Definition: Diff_VelocityDutyCycle_VelocityDutyCycle.hpp:29
units::time::second_t ConfigTimeout
The timeout when sending configs associated with this control.
Definition: Diff_VelocityDutyCycle_VelocityDutyCycle.hpp:70
Diff_VelocityDutyCycle_VelocityDutyCycle & WithDifferentialRequest(VelocityDutyCycle newDifferentialRequest)
Modifies this Control Request's DifferentialRequest parameter and returns itself for method-chaining ...
Definition: Diff_VelocityDutyCycle_VelocityDutyCycle.hpp:117
Diff_VelocityDutyCycle_VelocityDutyCycle(VelocityDutyCycle AverageRequest, VelocityDutyCycle DifferentialRequest)
Requires Phoenix Pro; Differential control with velocity average target and velocity difference targe...
Definition: Diff_VelocityDutyCycle_VelocityDutyCycle.hpp:94
units::frequency::hertz_t UpdateFreqHz
The period at which this control will update at.
Definition: Diff_VelocityDutyCycle_VelocityDutyCycle.hpp:83
VelocityDutyCycle AverageRequest
Average VelocityDutyCycle request of the mechanism.
Definition: Diff_VelocityDutyCycle_VelocityDutyCycle.hpp:59
void ForceApplyConfigs()
Forces configs to be applied the next time this is used in a setControl.
Definition: Diff_VelocityDutyCycle_VelocityDutyCycle.hpp:172
Diff_VelocityDutyCycle_VelocityDutyCycle & WithAverageRequest(VelocityDutyCycle newAverageRequest)
Modifies this Control Request's AverageRequest parameter and returns itself for method-chaining and e...
Definition: Diff_VelocityDutyCycle_VelocityDutyCycle.hpp:105
std::map< std::string, std::string > GetControlInfo() const override
Gets information about this control request.
Definition: Diff_VelocityDutyCycle_VelocityDutyCycle.hpp:179
std::string ToString() const override
Returns a string representation of the object.
Definition: Diff_VelocityDutyCycle_VelocityDutyCycle.hpp:146
VelocityDutyCycle DifferentialRequest
Differential VelocityDutyCycle request of the mechanism.
Definition: Diff_VelocityDutyCycle_VelocityDutyCycle.hpp:63
Diff_VelocityDutyCycle_VelocityDutyCycle & WithUpdateFreqHz(units::frequency::hertz_t newUpdateFreqHz)
Sets the period at which this control will update at.
Definition: Diff_VelocityDutyCycle_VelocityDutyCycle.hpp:136
Definition: ManualEvent.hpp:12