13#include <units/angle.h>
14#include <units/frequency.h>
15#include <units/time.h>
34 ctre::phoenix::StatusCode SendRequest(
const char *network, uint32_t deviceHash,
bool cancelOtherRequests, std::shared_ptr<ControlRequest> &req)
override
36 if (req.get() !=
this)
39 if (reqCast !=
nullptr)
45 req = std::make_shared<DifferentialMotionMagicVoltage>(*
this);
49 return c_ctre_phoenix6_RequestControlDifferentialMotionMagicVoltage(network, deviceHash,
UpdateFreqHz.to<
double>(), cancelOtherRequests,
TargetPosition.to<
double>(),
DifferentialPosition.to<
double>(),
EnableFOC,
TargetSlot,
DifferentialSlot,
OverrideBrakeDurNeutral,
LimitForwardMotion,
LimitReverseMotion);
350 std::stringstream ss;
351 ss <<
"class: DifferentialMotionMagicVoltage" << std::endl;
352 ss <<
"TargetPosition: " <<
TargetPosition.to<
double>() << std::endl;
354 ss <<
"EnableFOC: " <<
EnableFOC << std::endl;
355 ss <<
"TargetSlot: " <<
TargetSlot << std::endl;
370 std::map<std::string, std::string> controlInfo;
371 std::stringstream ss;
372 controlInfo[
"Name"] =
GetName();
373 ss <<
TargetPosition.to<
double>(); controlInfo[
"TargetPosition"] = ss.str(); ss.str(std::string{});
374 ss <<
DifferentialPosition.to<
double>(); controlInfo[
"DifferentialPosition"] = ss.str(); ss.str(std::string{});
375 ss <<
EnableFOC; controlInfo[
"EnableFOC"] = ss.str(); ss.str(std::string{});
376 ss <<
TargetSlot; controlInfo[
"TargetSlot"] = ss.str(); ss.str(std::string{});
377 ss <<
DifferentialSlot; controlInfo[
"DifferentialSlot"] = ss.str(); ss.str(std::string{});
379 ss <<
LimitForwardMotion; controlInfo[
"LimitForwardMotion"] = ss.str(); ss.str(std::string{});
380 ss <<
LimitReverseMotion; controlInfo[
"LimitReverseMotion"] = ss.str(); ss.str(std::string{});
CTREXPORT int c_ctre_phoenix6_RequestControlDifferentialMotionMagicVoltage(const char *canbus, uint32_t ecuEncoding, double updateTime, bool cancelOtherRequests, double TargetPosition, double DifferentialPosition, bool EnableFOC, int TargetSlot, int DifferentialSlot, 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
Requests Motion Magic® to target a final position using a motion profile, and PID to a differential p...
Definition: DifferentialMotionMagicVoltage.hpp:33
DifferentialMotionMagicVoltage & WithDifferentialPosition(units::angle::turn_t newDifferentialPosition)
Modifies this Control Request's DifferentialPosition parameter and returns itself for method-chaining...
Definition: DifferentialMotionMagicVoltage.hpp:209
units::frequency::hertz_t UpdateFreqHz
The period at which this control will update at.
Definition: DifferentialMotionMagicVoltage.hpp:117
units::angle::turn_t DifferentialPosition
Differential position to drive toward in rotations.
Definition: DifferentialMotionMagicVoltage.hpp:60
DifferentialMotionMagicVoltage(units::angle::turn_t TargetPosition, units::angle::turn_t DifferentialPosition, bool EnableFOC=true, int TargetSlot=0, int DifferentialSlot=1, bool OverrideBrakeDurNeutral=false, bool LimitForwardMotion=false, bool LimitReverseMotion=false)
Requests Motion Magic® to target a final position using a motion profile, and PID to a differential p...
Definition: DifferentialMotionMagicVoltage.hpp:174
int DifferentialSlot
Select which gains are applied to the differential controller by selecting the slot.
Definition: DifferentialMotionMagicVoltage.hpp:85
bool OverrideBrakeDurNeutral
Set to true to static-brake the rotor when output is zero (or within deadband).
Definition: DifferentialMotionMagicVoltage.hpp:92
units::angle::turn_t TargetPosition
Average position to drive toward in rotations.
Definition: DifferentialMotionMagicVoltage.hpp:56
std::string ToString() const override
Returns a string representation of the object.
Definition: DifferentialMotionMagicVoltage.hpp:348
DifferentialMotionMagicVoltage & WithTargetSlot(int newTargetSlot)
Modifies this Control Request's TargetSlot parameter and returns itself for method-chaining and easie...
Definition: DifferentialMotionMagicVoltage.hpp:250
int TargetSlot
Select which gains are applied to the primary controller by selecting the slot.
Definition: DifferentialMotionMagicVoltage.hpp:79
DifferentialMotionMagicVoltage & WithEnableFOC(bool newEnableFOC)
Modifies this Control Request's EnableFOC parameter and returns itself for method-chaining and easier...
Definition: DifferentialMotionMagicVoltage.hpp:233
DifferentialMotionMagicVoltage & WithDifferentialSlot(int newDifferentialSlot)
Modifies this Control Request's DifferentialSlot parameter and returns itself for method-chaining and...
Definition: DifferentialMotionMagicVoltage.hpp:267
bool LimitReverseMotion
Set to true to force reverse limiting.
Definition: DifferentialMotionMagicVoltage.hpp:104
bool EnableFOC
Set to true to use FOC commutation (requires Phoenix Pro), which increases peak power by ~15%.
Definition: DifferentialMotionMagicVoltage.hpp:73
bool LimitForwardMotion
Set to true to force forward limiting.
Definition: DifferentialMotionMagicVoltage.hpp:98
DifferentialMotionMagicVoltage & WithOverrideBrakeDurNeutral(bool newOverrideBrakeDurNeutral)
Modifies this Control Request's OverrideBrakeDurNeutral parameter and returns itself for method-chain...
Definition: DifferentialMotionMagicVoltage.hpp:285
DifferentialMotionMagicVoltage & WithTargetPosition(units::angle::turn_t newTargetPosition)
Modifies this Control Request's TargetPosition parameter and returns itself for method-chaining and e...
Definition: DifferentialMotionMagicVoltage.hpp:194
DifferentialMotionMagicVoltage & WithUpdateFreqHz(units::frequency::hertz_t newUpdateFreqHz)
Sets the period at which this control will update at.
Definition: DifferentialMotionMagicVoltage.hpp:338
DifferentialMotionMagicVoltage & WithLimitReverseMotion(bool newLimitReverseMotion)
Modifies this Control Request's LimitReverseMotion parameter and returns itself for method-chaining a...
Definition: DifferentialMotionMagicVoltage.hpp:319
DifferentialMotionMagicVoltage & WithLimitForwardMotion(bool newLimitForwardMotion)
Modifies this Control Request's LimitForwardMotion parameter and returns itself for method-chaining a...
Definition: DifferentialMotionMagicVoltage.hpp:302
std::map< std::string, std::string > GetControlInfo() const override
Gets information about this control request.
Definition: DifferentialMotionMagicVoltage.hpp:368
Definition: string_util.hpp:15