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/voltage.h>
18#include <units/frequency.h>
19#include <units/time.h>
40 ctre::phoenix::StatusCode SendRequest(
const char *network, uint32_t deviceHash,
bool cancelOtherRequests, std::shared_ptr<ControlRequest> &req)
override
42 if (req.get() !=
this)
45 if (reqCast !=
nullptr)
51 req = std::make_shared<DynamicMotionMagicVoltage>(*
this);
55 return c_ctre_phoenix6_RequestControlDynamicMotionMagicVoltage(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);
67 units::angular_velocity::turns_per_second_t
Velocity;
72 units::angular_acceleration::turns_per_second_squared_t
Acceleration;
77 units::angular_jerk::turns_per_second_cubed_t
Jerk;
193 DynamicMotionMagicVoltage(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::voltage::volt_t
FeedForward = 0.0_V,
int Slot = 0,
bool OverrideBrakeDurNeutral =
false,
bool LimitForwardMotion =
false,
bool LimitReverseMotion =
false) :
ControlRequest{
"DynamicMotionMagicVoltage"},
265 Jerk = std::move(newJerk);
321 Slot = std::move(newSlot);
402 std::stringstream ss;
403 ss <<
"class: DynamicMotionMagicVoltage" << std::endl;
404 ss <<
"Position: " <<
Position.to<
double>() << std::endl;
405 ss <<
"Velocity: " <<
Velocity.to<
double>() << std::endl;
406 ss <<
"Acceleration: " <<
Acceleration.to<
double>() << std::endl;
407 ss <<
"Jerk: " <<
Jerk.to<
double>() << std::endl;
408 ss <<
"EnableFOC: " <<
EnableFOC << std::endl;
409 ss <<
"FeedForward: " <<
FeedForward.to<
double>() << std::endl;
410 ss <<
"Slot: " <<
Slot << std::endl;
424 std::map<std::string, std::string> controlInfo;
425 std::stringstream ss;
426 controlInfo[
"Name"] =
GetName();
427 ss <<
Position.to<
double>(); controlInfo[
"Position"] = ss.str(); ss.str(std::string{});
428 ss <<
Velocity.to<
double>(); controlInfo[
"Velocity"] = ss.str(); ss.str(std::string{});
429 ss <<
Acceleration.to<
double>(); controlInfo[
"Acceleration"] = ss.str(); ss.str(std::string{});
430 ss <<
Jerk.to<
double>(); controlInfo[
"Jerk"] = ss.str(); ss.str(std::string{});
431 ss <<
EnableFOC; controlInfo[
"EnableFOC"] = ss.str(); ss.str(std::string{});
432 ss <<
FeedForward.to<
double>(); controlInfo[
"FeedForward"] = ss.str(); ss.str(std::string{});
433 ss <<
Slot; controlInfo[
"Slot"] = ss.str(); ss.str(std::string{});
435 ss <<
LimitForwardMotion; controlInfo[
"LimitForwardMotion"] = ss.str(); ss.str(std::string{});
436 ss <<
LimitReverseMotion; controlInfo[
"LimitReverseMotion"] = ss.str(); ss.str(std::string{});
CTREXPORT int c_ctre_phoenix6_RequestControlDynamicMotionMagicVoltage(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: DynamicMotionMagicVoltage.hpp:39
units::angular_acceleration::turns_per_second_squared_t Acceleration
Acceleration for profiling.
Definition: DynamicMotionMagicVoltage.hpp:72
DynamicMotionMagicVoltage & WithEnableFOC(bool newEnableFOC)
Modifies this Control Request's EnableFOC parameter and returns itself for method-chaining and easier...
Definition: DynamicMotionMagicVoltage.hpp:287
units::voltage::volt_t FeedForward
Feedforward to apply in volts.
Definition: DynamicMotionMagicVoltage.hpp:94
DynamicMotionMagicVoltage & WithLimitForwardMotion(bool newLimitForwardMotion)
Modifies this Control Request's LimitForwardMotion parameter and returns itself for method-chaining a...
Definition: DynamicMotionMagicVoltage.hpp:354
DynamicMotionMagicVoltage & WithPosition(units::angle::turn_t newPosition)
Modifies this Control Request's Position parameter and returns itself for method-chaining and easier ...
Definition: DynamicMotionMagicVoltage.hpp:215
bool LimitReverseMotion
Set to true to force reverse limiting.
Definition: DynamicMotionMagicVoltage.hpp:119
DynamicMotionMagicVoltage & WithLimitReverseMotion(bool newLimitReverseMotion)
Modifies this Control Request's LimitReverseMotion parameter and returns itself for method-chaining a...
Definition: DynamicMotionMagicVoltage.hpp:371
units::angular_jerk::turns_per_second_cubed_t Jerk
Jerk for profiling.
Definition: DynamicMotionMagicVoltage.hpp:77
DynamicMotionMagicVoltage & WithOverrideBrakeDurNeutral(bool newOverrideBrakeDurNeutral)
Modifies this Control Request's OverrideBrakeDurNeutral parameter and returns itself for method-chain...
Definition: DynamicMotionMagicVoltage.hpp:337
std::string ToString() const override
Returns a string representation of the object.
Definition: DynamicMotionMagicVoltage.hpp:400
units::frequency::hertz_t UpdateFreqHz
The period at which this control will update at.
Definition: DynamicMotionMagicVoltage.hpp:132
bool OverrideBrakeDurNeutral
Set to true to static-brake the rotor when output is zero (or within deadband).
Definition: DynamicMotionMagicVoltage.hpp:107
bool EnableFOC
Set to true to use FOC commutation (requires Phoenix Pro), which increases peak power by ~15%.
Definition: DynamicMotionMagicVoltage.hpp:90
bool LimitForwardMotion
Set to true to force forward limiting.
Definition: DynamicMotionMagicVoltage.hpp:113
DynamicMotionMagicVoltage & WithFeedForward(units::voltage::volt_t newFeedForward)
Modifies this Control Request's FeedForward parameter and returns itself for method-chaining and easi...
Definition: DynamicMotionMagicVoltage.hpp:302
DynamicMotionMagicVoltage & 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: DynamicMotionMagicVoltage.hpp:247
DynamicMotionMagicVoltage & 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: DynamicMotionMagicVoltage.hpp:263
DynamicMotionMagicVoltage(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::voltage::volt_t FeedForward=0.0_V, 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: DynamicMotionMagicVoltage.hpp:193
units::angle::turn_t Position
Position to drive toward in rotations.
Definition: DynamicMotionMagicVoltage.hpp:62
DynamicMotionMagicVoltage & WithUpdateFreqHz(units::frequency::hertz_t newUpdateFreqHz)
Sets the period at which this control will update at.
Definition: DynamicMotionMagicVoltage.hpp:390
int Slot
Select which gains are applied by selecting the slot.
Definition: DynamicMotionMagicVoltage.hpp:100
DynamicMotionMagicVoltage & 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: DynamicMotionMagicVoltage.hpp:231
std::map< std::string, std::string > GetControlInfo() const override
Gets information about this control request.
Definition: DynamicMotionMagicVoltage.hpp:422
DynamicMotionMagicVoltage & WithSlot(int newSlot)
Modifies this Control Request's Slot parameter and returns itself for method-chaining and easier to u...
Definition: DynamicMotionMagicVoltage.hpp:319
units::angular_velocity::turns_per_second_t Velocity
Cruise velocity for profiling.
Definition: DynamicMotionMagicVoltage.hpp:67
Definition: string_util.hpp:15