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>
43 ctre::phoenix::StatusCode SendRequest(
const char *network, uint32_t deviceHash, std::shared_ptr<ControlRequest> &req)
const override
45 if (req.get() !=
this)
48 if (reqCast !=
nullptr)
54 req = std::make_shared<DynamicMotionMagicDutyCycle>(*
this);
58 return c_ctre_phoenix6_RequestControlDynamicMotionMagicDutyCycle(network, deviceHash,
UpdateFreqHz.to<
double>(),
Position.to<
double>(),
Velocity.to<
double>(),
Acceleration.to<
double>(),
Jerk.to<
double>(),
EnableFOC,
FeedForward.to<
double>(),
Slot,
OverrideBrakeDurNeutral,
LimitForwardMotion,
LimitReverseMotion,
IgnoreHardwareLimits,
UseTimesync);
70 units::angular_velocity::turns_per_second_t
Velocity;
75 units::angular_acceleration::turns_per_second_squared_t
Acceleration;
83 units::angular_jerk::turns_per_second_cubed_t
Jerk;
263 Jerk = std::move(newJerk);
319 Slot = std::move(newSlot);
445 std::stringstream ss;
446 ss <<
"Control: DynamicMotionMagicDutyCycle" << std::endl;
447 ss <<
" Position: " <<
Position.to<
double>() <<
" rotations" << std::endl;
448 ss <<
" Velocity: " <<
Velocity.to<
double>() <<
" rotations per second" << std::endl;
449 ss <<
" Acceleration: " <<
Acceleration.to<
double>() <<
" rotations per second²" << std::endl;
450 ss <<
" Jerk: " <<
Jerk.to<
double>() <<
" rotations per second³" << std::endl;
451 ss <<
" EnableFOC: " <<
EnableFOC << std::endl;
452 ss <<
" FeedForward: " <<
FeedForward.to<
double>() <<
" fractional" << std::endl;
453 ss <<
" Slot: " <<
Slot << std::endl;
458 ss <<
" UseTimesync: " <<
UseTimesync << std::endl;
469 std::map<std::string, std::string> controlInfo;
470 std::stringstream ss;
471 controlInfo[
"Name"] =
GetName();
472 ss <<
Position.to<
double>(); controlInfo[
"Position"] = ss.str(); ss.str(std::string{});
473 ss <<
Velocity.to<
double>(); controlInfo[
"Velocity"] = ss.str(); ss.str(std::string{});
474 ss <<
Acceleration.to<
double>(); controlInfo[
"Acceleration"] = ss.str(); ss.str(std::string{});
475 ss <<
Jerk.to<
double>(); controlInfo[
"Jerk"] = ss.str(); ss.str(std::string{});
476 ss <<
EnableFOC; controlInfo[
"EnableFOC"] = ss.str(); ss.str(std::string{});
477 ss <<
FeedForward.to<
double>(); controlInfo[
"FeedForward"] = ss.str(); ss.str(std::string{});
478 ss <<
Slot; controlInfo[
"Slot"] = ss.str(); ss.str(std::string{});
480 ss <<
LimitForwardMotion; controlInfo[
"LimitForwardMotion"] = ss.str(); ss.str(std::string{});
481 ss <<
LimitReverseMotion; controlInfo[
"LimitReverseMotion"] = ss.str(); ss.str(std::string{});
482 ss <<
IgnoreHardwareLimits; controlInfo[
"IgnoreHardwareLimits"] = ss.str(); ss.str(std::string{});
483 ss <<
UseTimesync; controlInfo[
"UseTimesync"] = ss.str(); ss.str(std::string{});
CTREXPORT int c_ctre_phoenix6_RequestControlDynamicMotionMagicDutyCycle(const char *canbus, uint32_t ecuEncoding, double updateTime, double Position, double Velocity, double Acceleration, double Jerk, bool EnableFOC, double FeedForward, int Slot, bool OverrideBrakeDurNeutral, bool LimitForwardMotion, bool LimitReverseMotion, bool IgnoreHardwareLimits, bool UseTimesync)
Abstract Control Request class that other control requests extend for use.
Definition ControlRequest.hpp:29
std::string const & GetName() const
Definition ControlRequest.hpp:52
Requires Phoenix Pro and CANivore; Requests Motion Magic® to target a final position using a motion p...
Definition DynamicMotionMagicDutyCycle.hpp:42
std::string ToString() const override
Returns a string representation of the object.
Definition DynamicMotionMagicDutyCycle.hpp:443
DynamicMotionMagicDutyCycle & WithUseTimesync(bool newUseTimesync)
Modifies this Control Request's UseTimesync parameter and returns itself for method-chaining and easi...
Definition DynamicMotionMagicDutyCycle.hpp:414
units::angular_velocity::turns_per_second_t Velocity
Cruise velocity for profiling.
Definition DynamicMotionMagicDutyCycle.hpp:70
units::angular_acceleration::turns_per_second_squared_t Acceleration
Acceleration for profiling.
Definition DynamicMotionMagicDutyCycle.hpp:75
bool OverrideBrakeDurNeutral
Set to true to static-brake the rotor when output is zero (or within deadband).
Definition DynamicMotionMagicDutyCycle.hpp:113
units::frequency::hertz_t UpdateFreqHz
The period at which this control will update at.
Definition DynamicMotionMagicDutyCycle.hpp:162
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)
Requires Phoenix Pro and CANivore; Requests Motion Magic® to target a final position using a motion p...
Definition DynamicMotionMagicDutyCycle.hpp:194
bool EnableFOC
Set to true to use FOC commutation (requires Phoenix Pro), which increases peak power by ~15%.
Definition DynamicMotionMagicDutyCycle.hpp:96
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:226
units::angular_jerk::turns_per_second_cubed_t Jerk
Jerk for profiling.
Definition DynamicMotionMagicDutyCycle.hpp:83
DynamicMotionMagicDutyCycle & WithSlot(int newSlot)
Modifies this Control Request's Slot parameter and returns itself for method-chaining and easier to u...
Definition DynamicMotionMagicDutyCycle.hpp:317
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:242
bool LimitForwardMotion
Set to true to force forward limiting.
Definition DynamicMotionMagicDutyCycle.hpp:119
DynamicMotionMagicDutyCycle & WithLimitForwardMotion(bool newLimitForwardMotion)
Modifies this Control Request's LimitForwardMotion parameter and returns itself for method-chaining a...
Definition DynamicMotionMagicDutyCycle.hpp:352
DynamicMotionMagicDutyCycle & WithUpdateFreqHz(units::frequency::hertz_t newUpdateFreqHz)
Sets the period at which this control will update at.
Definition DynamicMotionMagicDutyCycle.hpp:433
bool IgnoreHardwareLimits
Set to true to ignore hardware limit switches and the LimitForwardMotion and LimitReverseMotion param...
Definition DynamicMotionMagicDutyCycle.hpp:138
bool LimitReverseMotion
Set to true to force reverse limiting.
Definition DynamicMotionMagicDutyCycle.hpp:125
DynamicMotionMagicDutyCycle & WithOverrideBrakeDurNeutral(bool newOverrideBrakeDurNeutral)
Modifies this Control Request's OverrideBrakeDurNeutral parameter and returns itself for method-chain...
Definition DynamicMotionMagicDutyCycle.hpp:335
DynamicMotionMagicDutyCycle & WithIgnoreHardwareLimits(bool newIgnoreHardwareLimits)
Modifies this Control Request's IgnoreHardwareLimits parameter and returns itself for method-chaining...
Definition DynamicMotionMagicDutyCycle.hpp:392
DynamicMotionMagicDutyCycle & WithEnableFOC(bool newEnableFOC)
Modifies this Control Request's EnableFOC parameter and returns itself for method-chaining and easier...
Definition DynamicMotionMagicDutyCycle.hpp:285
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:261
std::map< std::string, std::string > GetControlInfo() const override
Gets information about this control request.
Definition DynamicMotionMagicDutyCycle.hpp:467
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:300
DynamicMotionMagicDutyCycle & WithLimitReverseMotion(bool newLimitReverseMotion)
Modifies this Control Request's LimitReverseMotion parameter and returns itself for method-chaining a...
Definition DynamicMotionMagicDutyCycle.hpp:369
units::angle::turn_t Position
Position to drive toward in rotations.
Definition DynamicMotionMagicDutyCycle.hpp:65
int Slot
Select which gains are applied by selecting the slot.
Definition DynamicMotionMagicDutyCycle.hpp:106
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:210
bool UseTimesync
Set to true to delay applying this control request until a timesync boundary (requires Phoenix Pro an...
Definition DynamicMotionMagicDutyCycle.hpp:149
units::dimensionless::scalar_t FeedForward
Feedforward to apply in fractional units between -1 and +1.
Definition DynamicMotionMagicDutyCycle.hpp:100
Status codes reported by APIs, including OK, warnings, and errors.
Definition StatusCodes.h:27
Definition StatusCodes.h:18