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/current.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<DynamicMotionMagicTorqueCurrentFOC>(*
this);
55 return c_ctre_phoenix6_RequestControlDynamicMotionMagicTorqueCurrentFOC(network, deviceHash,
UpdateFreqHz.to<
double>(), cancelOtherRequests,
Position.to<
double>(),
Velocity.to<
double>(),
Acceleration.to<
double>(),
Jerk.to<
double>(),
FeedForward.to<
double>(),
Slot,
OverrideCoastDurNeutral,
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;
241 Jerk = std::move(newJerk);
274 Slot = std::move(newSlot);
355 std::stringstream ss;
356 ss <<
"class: DynamicMotionMagicTorqueCurrentFOC" << std::endl;
357 ss <<
"Position: " <<
Position.to<
double>() << std::endl;
358 ss <<
"Velocity: " <<
Velocity.to<
double>() << std::endl;
359 ss <<
"Acceleration: " <<
Acceleration.to<
double>() << std::endl;
360 ss <<
"Jerk: " <<
Jerk.to<
double>() << std::endl;
361 ss <<
"FeedForward: " <<
FeedForward.to<
double>() << std::endl;
362 ss <<
"Slot: " <<
Slot << std::endl;
376 std::map<std::string, std::string> controlInfo;
377 std::stringstream ss;
378 controlInfo[
"Name"] =
GetName();
379 ss <<
Position.to<
double>(); controlInfo[
"Position"] = ss.str(); ss.str(std::string{});
380 ss <<
Velocity.to<
double>(); controlInfo[
"Velocity"] = ss.str(); ss.str(std::string{});
381 ss <<
Acceleration.to<
double>(); controlInfo[
"Acceleration"] = ss.str(); ss.str(std::string{});
382 ss <<
Jerk.to<
double>(); controlInfo[
"Jerk"] = ss.str(); ss.str(std::string{});
383 ss <<
FeedForward.to<
double>(); controlInfo[
"FeedForward"] = ss.str(); ss.str(std::string{});
384 ss <<
Slot; controlInfo[
"Slot"] = ss.str(); ss.str(std::string{});
386 ss <<
LimitForwardMotion; controlInfo[
"LimitForwardMotion"] = ss.str(); ss.str(std::string{});
387 ss <<
LimitReverseMotion; controlInfo[
"LimitReverseMotion"] = ss.str(); ss.str(std::string{});
CTREXPORT int c_ctre_phoenix6_RequestControlDynamicMotionMagicTorqueCurrentFOC(const char *canbus, uint32_t ecuEncoding, double updateTime, bool cancelOtherRequests, double Position, double Velocity, double Acceleration, double Jerk, double FeedForward, int Slot, bool OverrideCoastDurNeutral, 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: DynamicMotionMagicTorqueCurrentFOC.hpp:39
DynamicMotionMagicTorqueCurrentFOC & WithPosition(units::angle::turn_t newPosition)
Modifies this Control Request's Position parameter and returns itself for method-chaining and easier ...
Definition: DynamicMotionMagicTorqueCurrentFOC.hpp:191
units::angle::turn_t Position
Position to drive toward in rotations.
Definition: DynamicMotionMagicTorqueCurrentFOC.hpp:62
DynamicMotionMagicTorqueCurrentFOC(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, units::current::ampere_t FeedForward=0.0_A, int Slot=0, bool OverrideCoastDurNeutral=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: DynamicMotionMagicTorqueCurrentFOC.hpp:170
DynamicMotionMagicTorqueCurrentFOC & WithSlot(int newSlot)
Modifies this Control Request's Slot parameter and returns itself for method-chaining and easier to u...
Definition: DynamicMotionMagicTorqueCurrentFOC.hpp:272
bool OverrideCoastDurNeutral
Set to true to coast the rotor when output is zero (or within deadband).
Definition: DynamicMotionMagicTorqueCurrentFOC.hpp:95
int Slot
Select which gains are applied by selecting the slot.
Definition: DynamicMotionMagicTorqueCurrentFOC.hpp:88
DynamicMotionMagicTorqueCurrentFOC & WithOverrideCoastDurNeutral(bool newOverrideCoastDurNeutral)
Modifies this Control Request's OverrideCoastDurNeutral parameter and returns itself for method-chain...
Definition: DynamicMotionMagicTorqueCurrentFOC.hpp:290
DynamicMotionMagicTorqueCurrentFOC & 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: DynamicMotionMagicTorqueCurrentFOC.hpp:207
std::string ToString() const override
Returns a string representation of the object.
Definition: DynamicMotionMagicTorqueCurrentFOC.hpp:353
bool LimitReverseMotion
Set to true to force reverse limiting.
Definition: DynamicMotionMagicTorqueCurrentFOC.hpp:107
units::angular_jerk::turns_per_second_cubed_t Jerk
Jerk for profiling.
Definition: DynamicMotionMagicTorqueCurrentFOC.hpp:77
units::angular_velocity::turns_per_second_t Velocity
Cruise velocity for profiling.
Definition: DynamicMotionMagicTorqueCurrentFOC.hpp:67
DynamicMotionMagicTorqueCurrentFOC & 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: DynamicMotionMagicTorqueCurrentFOC.hpp:223
DynamicMotionMagicTorqueCurrentFOC & WithLimitForwardMotion(bool newLimitForwardMotion)
Modifies this Control Request's LimitForwardMotion parameter and returns itself for method-chaining a...
Definition: DynamicMotionMagicTorqueCurrentFOC.hpp:307
bool LimitForwardMotion
Set to true to force forward limiting.
Definition: DynamicMotionMagicTorqueCurrentFOC.hpp:101
DynamicMotionMagicTorqueCurrentFOC & WithFeedForward(units::current::ampere_t newFeedForward)
Modifies this Control Request's FeedForward parameter and returns itself for method-chaining and easi...
Definition: DynamicMotionMagicTorqueCurrentFOC.hpp:255
DynamicMotionMagicTorqueCurrentFOC & WithUpdateFreqHz(units::frequency::hertz_t newUpdateFreqHz)
Sets the period at which this control will update at.
Definition: DynamicMotionMagicTorqueCurrentFOC.hpp:343
units::frequency::hertz_t UpdateFreqHz
The period at which this control will update at.
Definition: DynamicMotionMagicTorqueCurrentFOC.hpp:120
DynamicMotionMagicTorqueCurrentFOC & WithLimitReverseMotion(bool newLimitReverseMotion)
Modifies this Control Request's LimitReverseMotion parameter and returns itself for method-chaining a...
Definition: DynamicMotionMagicTorqueCurrentFOC.hpp:324
DynamicMotionMagicTorqueCurrentFOC & 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: DynamicMotionMagicTorqueCurrentFOC.hpp:239
units::current::ampere_t FeedForward
Feedforward to apply in torque current in Amperes.
Definition: DynamicMotionMagicTorqueCurrentFOC.hpp:82
std::map< std::string, std::string > GetControlInfo() const override
Gets information about this control request.
Definition: DynamicMotionMagicTorqueCurrentFOC.hpp:374
units::angular_acceleration::turns_per_second_squared_t Acceleration
Acceleration for profiling.
Definition: DynamicMotionMagicTorqueCurrentFOC.hpp:72
Definition: string_util.hpp:15