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_MotionMagicDutyCycle_VelocityDutyCycle>(*
this);
50 std::string strs{ss.str()};
52 ApplyConfigsOnRequest =
false;
53 return c_ctre_phoenix6_RequestControlDiff_MotionMagicDutyCycle_VelocityDutyCycle(network, deviceHash,
UpdateFreqHz.to<
double>(), cancelOtherRequests,
AverageRequest.
Position.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);
150 std::stringstream ss;
151 ss <<
"class: Diff_MotionMagicDutyCycle_VelocityDutyCycle" << std::endl;
152 ss <<
"AverageRequest:" << std::endl;
158 ss <<
"DifferentialRequest:" << std::endl;
182 std::map<std::string, std::string> controlInfo;
183 std::stringstream ss;
184 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_MotionMagicDutyCycle_VelocityDutyCycle(const char *canbus, uint32_t ecuEncoding, double updateTime, bool cancelOtherRequests, double AverageRequest_Position, 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
Requests Motion Magic® to target a final position using a motion profile.
Definition: MotionMagicDutyCycle.hpp:34
int Slot
Select which gains are applied by selecting the slot.
Definition: MotionMagicDutyCycle.hpp:85
std::string ToString() const override
Returns a string representation of the object.
Definition: MotionMagicDutyCycle.hpp:260
bool OverrideBrakeDurNeutral
Set to true to static-brake the rotor when output is zero (or within deadband).
Definition: MotionMagicDutyCycle.hpp:92
units::dimensionless::scalar_t FeedForward
Feedforward to apply in fractional units between -1 and +1.
Definition: MotionMagicDutyCycle.hpp:79
units::angle::turn_t Position
Position to drive toward in rotations.
Definition: MotionMagicDutyCycle.hpp:64
bool EnableFOC
Set to true to use FOC commutation (requires Phoenix Pro), which increases peak power by ~15%.
Definition: MotionMagicDutyCycle.hpp:75
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 Motion Magic® average target and velocity difference ...
Definition: Diff_MotionMagicDutyCycle_VelocityDutyCycle.hpp:30
Diff_MotionMagicDutyCycle_VelocityDutyCycle & WithUpdateFreqHz(units::frequency::hertz_t newUpdateFreqHz)
Sets the period at which this control will update at.
Definition: Diff_MotionMagicDutyCycle_VelocityDutyCycle.hpp:138
std::string ToString() const override
Returns a string representation of the object.
Definition: Diff_MotionMagicDutyCycle_VelocityDutyCycle.hpp:148
MotionMagicDutyCycle AverageRequest
Average MotionMagicDutyCycle request of the mechanism.
Definition: Diff_MotionMagicDutyCycle_VelocityDutyCycle.hpp:60
Diff_MotionMagicDutyCycle_VelocityDutyCycle & WithDifferentialRequest(VelocityDutyCycle newDifferentialRequest)
Modifies this Control Request's DifferentialRequest parameter and returns itself for method-chaining ...
Definition: Diff_MotionMagicDutyCycle_VelocityDutyCycle.hpp:119
Diff_MotionMagicDutyCycle_VelocityDutyCycle(MotionMagicDutyCycle AverageRequest, VelocityDutyCycle DifferentialRequest)
Requires Phoenix Pro; Differential control with Motion Magic® average target and velocity difference ...
Definition: Diff_MotionMagicDutyCycle_VelocityDutyCycle.hpp:96
units::time::second_t ConfigTimeout
The timeout when sending configs associated with this control.
Definition: Diff_MotionMagicDutyCycle_VelocityDutyCycle.hpp:71
Diff_MotionMagicDutyCycle_VelocityDutyCycle & WithAverageRequest(MotionMagicDutyCycle newAverageRequest)
Modifies this Control Request's AverageRequest parameter and returns itself for method-chaining and e...
Definition: Diff_MotionMagicDutyCycle_VelocityDutyCycle.hpp:107
VelocityDutyCycle DifferentialRequest
Differential VelocityDutyCycle request of the mechanism.
Definition: Diff_MotionMagicDutyCycle_VelocityDutyCycle.hpp:64
units::frequency::hertz_t UpdateFreqHz
The period at which this control will update at.
Definition: Diff_MotionMagicDutyCycle_VelocityDutyCycle.hpp:84
std::map< std::string, std::string > GetControlInfo() const override
Gets information about this control request.
Definition: Diff_MotionMagicDutyCycle_VelocityDutyCycle.hpp:180
void ForceApplyConfigs()
Forces configs to be applied the next time this is used in a setControl.
Definition: Diff_MotionMagicDutyCycle_VelocityDutyCycle.hpp:173
Definition: ManualEvent.hpp:12