15#include <units/frequency.h>
16#include <units/time.h>
31 bool ApplyConfigsOnRequest{
false};
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<Diff_DutyCycleOut_VelocityDutyCycle>(*
this);
50 std::string strs{ss.str()};
52 ApplyConfigsOnRequest =
false;
53 return c_ctre_phoenix6_RequestControlDiff_DutyCycleOut_VelocityDutyCycle(network, deviceHash,
UpdateFreqHz.to<
double>(), cancelOtherRequests,
AverageRequest.
Output.to<
double>(),
AverageRequest.
EnableFOC,
AverageRequest.
OverrideBrakeDurNeutral,
DifferentialRequest.
Velocity.to<
double>(),
DifferentialRequest.
Acceleration.to<
double>(),
DifferentialRequest.
EnableFOC,
DifferentialRequest.
FeedForward.to<
double>(),
DifferentialRequest.
Slot,
DifferentialRequest.
OverrideBrakeDurNeutral);
149 std::stringstream ss;
150 ss <<
"class: Diff_DutyCycleOut_VelocityDutyCycle" << std::endl;
151 ss <<
"AverageRequest:" << std::endl;
155 ss <<
"DifferentialRequest:" << std::endl;
179 std::map<std::string, std::string> controlInfo;
180 std::stringstream ss;
181 controlInfo[
"Name"] =
GetName();
CTREXPORT int c_ctre_phoenix6_RequestControlDiff_DutyCycleOut_VelocityDutyCycle(const char *canbus, uint32_t ecuEncoding, double updateTime, bool cancelOtherRequests, double AverageRequest_Output, bool AverageRequest_EnableFOC, bool AverageRequest_OverrideBrakeDurNeutral, double DifferentialRequest_Velocity, double DifferentialRequest_Acceleration, bool DifferentialRequest_EnableFOC, double DifferentialRequest_FeedForward, int DifferentialRequest_Slot, bool DifferentialRequest_OverrideBrakeDurNeutral)
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
Request a specified motor duty cycle.
Definition: DutyCycleOut.hpp:28
bool OverrideBrakeDurNeutral
Set to true to static-brake the rotor when output is zero (or within deadband).
Definition: DutyCycleOut.hpp:76
units::dimensionless::scalar_t Output
Proportion of supply voltage to apply in fractional units between -1 and +1.
Definition: DutyCycleOut.hpp:58
std::string ToString() const override
Returns a string representation of the object.
Definition: DutyCycleOut.hpp:203
bool EnableFOC
Set to true to use FOC commutation (requires Phoenix Pro), which increases peak power by ~15%.
Definition: DutyCycleOut.hpp:69
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 duty cycle average target and velocity difference tar...
Definition: Diff_DutyCycleOut_VelocityDutyCycle.hpp:30
std::map< std::string, std::string > GetControlInfo() const override
Gets information about this control request.
Definition: Diff_DutyCycleOut_VelocityDutyCycle.hpp:177
VelocityDutyCycle DifferentialRequest
Differential VelocityDutyCycle request of the mechanism.
Definition: Diff_DutyCycleOut_VelocityDutyCycle.hpp:64
units::time::second_t ConfigTimeout
The timeout when sending configs associated with this control.
Definition: Diff_DutyCycleOut_VelocityDutyCycle.hpp:71
DutyCycleOut AverageRequest
Average DutyCycleOut request of the mechanism.
Definition: Diff_DutyCycleOut_VelocityDutyCycle.hpp:60
std::string ToString() const override
Returns a string representation of the object.
Definition: Diff_DutyCycleOut_VelocityDutyCycle.hpp:147
Diff_DutyCycleOut_VelocityDutyCycle & WithDifferentialRequest(VelocityDutyCycle newDifferentialRequest)
Modifies this Control Request's DifferentialRequest parameter and returns itself for method-chaining ...
Definition: Diff_DutyCycleOut_VelocityDutyCycle.hpp:118
Diff_DutyCycleOut_VelocityDutyCycle & WithUpdateFreqHz(units::frequency::hertz_t newUpdateFreqHz)
Sets the period at which this control will update at.
Definition: Diff_DutyCycleOut_VelocityDutyCycle.hpp:137
Diff_DutyCycleOut_VelocityDutyCycle & WithAverageRequest(DutyCycleOut newAverageRequest)
Modifies this Control Request's AverageRequest parameter and returns itself for method-chaining and e...
Definition: Diff_DutyCycleOut_VelocityDutyCycle.hpp:106
Diff_DutyCycleOut_VelocityDutyCycle(DutyCycleOut AverageRequest, VelocityDutyCycle DifferentialRequest)
Requires Phoenix Pro; Differential control with duty cycle average target and velocity difference tar...
Definition: Diff_DutyCycleOut_VelocityDutyCycle.hpp:95
void ForceApplyConfigs()
Forces configs to be applied the next time this is used in a setControl.
Definition: Diff_DutyCycleOut_VelocityDutyCycle.hpp:170
units::frequency::hertz_t UpdateFreqHz
The period at which this control will update at.
Definition: Diff_DutyCycleOut_VelocityDutyCycle.hpp:84
Definition: ManualEvent.hpp:12