13#include <units/angle.h>
14#include <units/angular_velocity.h>
15#include <units/angular_acceleration.h>
16#include <units/angular_jerk.h>
17#include <units/dimensionless.h>
18#include <units/frequency.h>
19#include <units/time.h>
41 ctre::phoenix::StatusCode SendRequest(
const char *network, uint32_t deviceHash,
bool cancelOtherRequests, std::shared_ptr<ControlRequest> &req)
override
43 if (req.get() !=
this)
46 if (reqCast !=
nullptr)
52 req = std::make_shared<DynamicMotionMagicDutyCycle>(*
this);
56 return c_ctre_phoenix6_RequestControlDynamicMotionMagicDutyCycle(network, deviceHash,
UpdateFreqHz.to<
double>(), cancelOtherRequests,
Position.to<
double>(),
Velocity.to<
double>(),
Acceleration.to<
double>(),
Jerk.to<
double>(),
EnableFOC,
FeedForward.to<
double>(),
Slot,
OverrideBrakeDurNeutral,
LimitForwardMotion,
LimitReverseMotion);
68 units::angular_velocity::turns_per_second_t
Velocity;
73 units::angular_acceleration::turns_per_second_squared_t
Acceleration;
78 units::angular_jerk::turns_per_second_cubed_t
Jerk;
195 DynamicMotionMagicDutyCycle(units::angle::turn_t
Position, units::angular_velocity::turns_per_second_t
Velocity, units::angular_acceleration::turns_per_second_squared_t
Acceleration, units::angular_jerk::turns_per_second_cubed_t
Jerk,
bool EnableFOC =
true, units::dimensionless::scalar_t
FeedForward = 0.0,
int Slot = 0,
bool OverrideBrakeDurNeutral =
false,
bool LimitForwardMotion =
false,
bool LimitReverseMotion =
false) :
ControlRequest{
"DynamicMotionMagicDutyCycle"},
267 Jerk = std::move(newJerk);
323 Slot = std::move(newSlot);
404 std::stringstream ss;
405 ss <<
"class: DynamicMotionMagicDutyCycle" << std::endl;
406 ss <<
"Position: " <<
Position.to<
double>() << std::endl;
407 ss <<
"Velocity: " <<
Velocity.to<
double>() << std::endl;
408 ss <<
"Acceleration: " <<
Acceleration.to<
double>() << std::endl;
409 ss <<
"Jerk: " <<
Jerk.to<
double>() << std::endl;
410 ss <<
"EnableFOC: " <<
EnableFOC << std::endl;
411 ss <<
"FeedForward: " <<
FeedForward.to<
double>() << std::endl;
412 ss <<
"Slot: " <<
Slot << std::endl;
426 std::map<std::string, std::string> controlInfo;
427 std::stringstream ss;
428 controlInfo[
"Name"] =
GetName();
429 ss <<
Position.to<
double>(); controlInfo[
"Position"] = ss.str(); ss.str(std::string{});
430 ss <<
Velocity.to<
double>(); controlInfo[
"Velocity"] = ss.str(); ss.str(std::string{});
431 ss <<
Acceleration.to<
double>(); controlInfo[
"Acceleration"] = ss.str(); ss.str(std::string{});
432 ss <<
Jerk.to<
double>(); controlInfo[
"Jerk"] = ss.str(); ss.str(std::string{});
433 ss <<
EnableFOC; controlInfo[
"EnableFOC"] = ss.str(); ss.str(std::string{});
434 ss <<
FeedForward.to<
double>(); controlInfo[
"FeedForward"] = ss.str(); ss.str(std::string{});
435 ss <<
Slot; controlInfo[
"Slot"] = ss.str(); ss.str(std::string{});
437 ss <<
LimitForwardMotion; controlInfo[
"LimitForwardMotion"] = ss.str(); ss.str(std::string{});
438 ss <<
LimitReverseMotion; controlInfo[
"LimitReverseMotion"] = ss.str(); ss.str(std::string{});
CTREXPORT int c_ctre_phoenix6_RequestControlDynamicMotionMagicDutyCycle(const char *canbus, uint32_t ecuEncoding, double updateTime, bool cancelOtherRequests, double Position, double Velocity, double Acceleration, double Jerk, bool EnableFOC, double FeedForward, int Slot, bool OverrideBrakeDurNeutral, bool LimitForwardMotion, bool LimitReverseMotion)
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 and CANivore; Requests Motion Magic® to target a final position using a motion p...
Definition: DynamicMotionMagicDutyCycle.hpp:40
std::string ToString() const override
Returns a string representation of the object.
Definition: DynamicMotionMagicDutyCycle.hpp:402
units::angular_velocity::turns_per_second_t Velocity
Cruise velocity for profiling.
Definition: DynamicMotionMagicDutyCycle.hpp:68
units::angular_acceleration::turns_per_second_squared_t Acceleration
Acceleration for profiling.
Definition: DynamicMotionMagicDutyCycle.hpp:73
bool OverrideBrakeDurNeutral
Set to true to static-brake the rotor when output is zero (or within deadband).
Definition: DynamicMotionMagicDutyCycle.hpp:108
units::frequency::hertz_t UpdateFreqHz
The period at which this control will update at.
Definition: DynamicMotionMagicDutyCycle.hpp:133
bool EnableFOC
Set to true to use FOC commutation (requires Phoenix Pro), which increases peak power by ~15%.
Definition: DynamicMotionMagicDutyCycle.hpp:91
DynamicMotionMagicDutyCycle & 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: DynamicMotionMagicDutyCycle.hpp:233
units::angular_jerk::turns_per_second_cubed_t Jerk
Jerk for profiling.
Definition: DynamicMotionMagicDutyCycle.hpp:78
DynamicMotionMagicDutyCycle & WithSlot(int newSlot)
Modifies this Control Request's Slot parameter and returns itself for method-chaining and easier to u...
Definition: DynamicMotionMagicDutyCycle.hpp:321
DynamicMotionMagicDutyCycle & 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: DynamicMotionMagicDutyCycle.hpp:249
bool LimitForwardMotion
Set to true to force forward limiting.
Definition: DynamicMotionMagicDutyCycle.hpp:114
DynamicMotionMagicDutyCycle & WithLimitForwardMotion(bool newLimitForwardMotion)
Modifies this Control Request's LimitForwardMotion parameter and returns itself for method-chaining a...
Definition: DynamicMotionMagicDutyCycle.hpp:356
DynamicMotionMagicDutyCycle & WithUpdateFreqHz(units::frequency::hertz_t newUpdateFreqHz)
Sets the period at which this control will update at.
Definition: DynamicMotionMagicDutyCycle.hpp:392
bool LimitReverseMotion
Set to true to force reverse limiting.
Definition: DynamicMotionMagicDutyCycle.hpp:120
DynamicMotionMagicDutyCycle & WithOverrideBrakeDurNeutral(bool newOverrideBrakeDurNeutral)
Modifies this Control Request's OverrideBrakeDurNeutral parameter and returns itself for method-chain...
Definition: DynamicMotionMagicDutyCycle.hpp:339
DynamicMotionMagicDutyCycle(units::angle::turn_t Position, units::angular_velocity::turns_per_second_t Velocity, units::angular_acceleration::turns_per_second_squared_t Acceleration, units::angular_jerk::turns_per_second_cubed_t Jerk, bool EnableFOC=true, units::dimensionless::scalar_t FeedForward=0.0, int Slot=0, bool OverrideBrakeDurNeutral=false, bool LimitForwardMotion=false, bool LimitReverseMotion=false)
Requires Phoenix Pro and CANivore; Requests Motion Magic® to target a final position using a motion p...
Definition: DynamicMotionMagicDutyCycle.hpp:195
DynamicMotionMagicDutyCycle & WithEnableFOC(bool newEnableFOC)
Modifies this Control Request's EnableFOC parameter and returns itself for method-chaining and easier...
Definition: DynamicMotionMagicDutyCycle.hpp:289
DynamicMotionMagicDutyCycle & WithJerk(units::angular_jerk::turns_per_second_cubed_t newJerk)
Modifies this Control Request's Jerk parameter and returns itself for method-chaining and easier to u...
Definition: DynamicMotionMagicDutyCycle.hpp:265
std::map< std::string, std::string > GetControlInfo() const override
Gets information about this control request.
Definition: DynamicMotionMagicDutyCycle.hpp:424
DynamicMotionMagicDutyCycle & WithFeedForward(units::dimensionless::scalar_t newFeedForward)
Modifies this Control Request's FeedForward parameter and returns itself for method-chaining and easi...
Definition: DynamicMotionMagicDutyCycle.hpp:304
DynamicMotionMagicDutyCycle & WithLimitReverseMotion(bool newLimitReverseMotion)
Modifies this Control Request's LimitReverseMotion parameter and returns itself for method-chaining a...
Definition: DynamicMotionMagicDutyCycle.hpp:373
units::angle::turn_t Position
Position to drive toward in rotations.
Definition: DynamicMotionMagicDutyCycle.hpp:63
int Slot
Select which gains are applied by selecting the slot.
Definition: DynamicMotionMagicDutyCycle.hpp:101
DynamicMotionMagicDutyCycle & WithPosition(units::angle::turn_t newPosition)
Modifies this Control Request's Position parameter and returns itself for method-chaining and easier ...
Definition: DynamicMotionMagicDutyCycle.hpp:217
units::dimensionless::scalar_t FeedForward
Feedforward to apply in fractional units between -1 and +1.
Definition: DynamicMotionMagicDutyCycle.hpp:95
Definition: string_util.hpp:15