CTRE Phoenix 6 C++ 26.3.0
Loading...
Searching...
No Matches
ctre::phoenix6::hardware::traits::SupportsFOC Class Referenceabstract

Requires Phoenix Pro; Contains all FOC-exclusive control functions available for devices that support FOC. More...

#include <ctre/phoenix6/hardware/traits/SupportsFOC.hpp>

Inheritance diagram for ctre::phoenix6::hardware::traits::SupportsFOC:
ctre::phoenix6::hardware::traits::CommonDevice ctre::phoenix6::hardware::traits::CommonTalonWithFOC ctre::phoenix6::hardware::core::CoreTalonFX ctre::phoenix6::hardware::TalonFX

Public Member Functions

virtual ~SupportsFOC ()=default
 
virtual StatusSignal< bool > & GetFault_RotorFault1 (bool refresh=true)=0
 Trips if a major mechanical or ESD event caused a brief loss of position data triggering a recovery while not in motion.
 
virtual StatusSignal< bool > & GetStickyFault_RotorFault1 (bool refresh=true)=0
 Trips if a major mechanical or ESD event caused a brief loss of position data triggering a recovery while not in motion.
 
virtual StatusSignal< bool > & GetFault_RotorFault2 (bool refresh=true)=0
 Trips if a major mechanical or ESD event caused a brief loss of position data triggering a recovery while in motion.
 
virtual StatusSignal< bool > & GetStickyFault_RotorFault2 (bool refresh=true)=0
 Trips if a major mechanical or ESD event caused a brief loss of position data triggering a recovery while in motion.
 
virtual ctre::phoenix::StatusCode SetControl (controls::TorqueCurrentFOC const &request)=0
 Request a specified motor current (field oriented control).
 
virtual ctre::phoenix::StatusCode SetControl (controls::PositionTorqueCurrentFOC const &request)=0
 Request PID to target position with torque current feedforward.
 
virtual ctre::phoenix::StatusCode SetControl (controls::VelocityTorqueCurrentFOC const &request)=0
 Request PID to target velocity with torque current feedforward.
 
virtual ctre::phoenix::StatusCode SetControl (controls::MotionMagicTorqueCurrentFOC const &request)=0
 Requests Motion Magic® to target a final position using a motion profile.
 
virtual ctre::phoenix::StatusCode SetControl (controls::MotionMagicVelocityTorqueCurrentFOC const &request)=0
 Requests Motion Magic® to target a final velocity using a motion profile.
 
virtual ctre::phoenix::StatusCode SetControl (controls::MotionMagicExpoTorqueCurrentFOC const &request)=0
 Requests Motion Magic® to target a final position using an exponential motion profile.
 
virtual ctre::phoenix::StatusCode SetControl (controls::DynamicMotionMagicTorqueCurrentFOC const &request)=0
 Requests Motion Magic® to target a final position using a motion profile.
 
virtual ctre::phoenix::StatusCode SetControl (controls::DynamicMotionMagicExpoTorqueCurrentFOC const &request)=0
 Requests Motion Magic® Expo to target a final position using an exponential motion profile.
 
virtual ctre::phoenix::StatusCode SetControl (controls::compound::Diff_TorqueCurrentFOC_Position const &request)=0
 Differential control with torque current average target and position difference target.
 
virtual ctre::phoenix::StatusCode SetControl (controls::compound::Diff_PositionTorqueCurrentFOC_Position const &request)=0
 Differential control with position average target and position difference target using torque current control.
 
virtual ctre::phoenix::StatusCode SetControl (controls::compound::Diff_VelocityTorqueCurrentFOC_Position const &request)=0
 Differential control with velocity average target and position difference target using torque current control.
 
virtual ctre::phoenix::StatusCode SetControl (controls::compound::Diff_MotionMagicTorqueCurrentFOC_Position const &request)=0
 Differential control with Motion Magic® average target and position difference target using torque current control.
 
virtual ctre::phoenix::StatusCode SetControl (controls::compound::Diff_MotionMagicExpoTorqueCurrentFOC_Position const &request)=0
 Differential control with Motion Magic® Expo average target and position difference target using torque current control.
 
virtual ctre::phoenix::StatusCode SetControl (controls::compound::Diff_MotionMagicVelocityTorqueCurrentFOC_Position const &request)=0
 Differential control with Motion Magic® Velocity average target and position difference target using torque current control.
 
virtual ctre::phoenix::StatusCode SetControl (controls::compound::Diff_TorqueCurrentFOC_Velocity const &request)=0
 Differential control with torque current average target and velocity difference target.
 
virtual ctre::phoenix::StatusCode SetControl (controls::compound::Diff_PositionTorqueCurrentFOC_Velocity const &request)=0
 Differential control with position average target and velocity difference target using torque current control.
 
virtual ctre::phoenix::StatusCode SetControl (controls::compound::Diff_VelocityTorqueCurrentFOC_Velocity const &request)=0
 Differential control with velocity average target and velocity difference target using torque current control.
 
virtual ctre::phoenix::StatusCode SetControl (controls::compound::Diff_MotionMagicTorqueCurrentFOC_Velocity const &request)=0
 Differential control with Motion Magic® average target and velocity difference target using torque current control.
 
virtual ctre::phoenix::StatusCode SetControl (controls::compound::Diff_MotionMagicExpoTorqueCurrentFOC_Velocity const &request)=0
 Differential control with Motion Magic® Expo average target and velocity difference target using torque current control.
 
virtual ctre::phoenix::StatusCode SetControl (controls::compound::Diff_MotionMagicVelocityTorqueCurrentFOC_Velocity const &request)=0
 Differential control with Motion Magic® Velocity average target and velocity difference target using torque current control.
 
virtual ctre::phoenix::StatusCode SetControl (controls::compound::Diff_TorqueCurrentFOC_Open const &request)=0
 Differential control with torque current average target and torque current difference target.
 
virtual ctre::phoenix::StatusCode SetControl (controls::compound::Diff_PositionTorqueCurrentFOC_Open const &request)=0
 Differential control with position average target and torque current difference target.
 
virtual ctre::phoenix::StatusCode SetControl (controls::compound::Diff_VelocityTorqueCurrentFOC_Open const &request)=0
 Differential control with velocity average target and torque current difference target.
 
virtual ctre::phoenix::StatusCode SetControl (controls::compound::Diff_MotionMagicTorqueCurrentFOC_Open const &request)=0
 Differential control with Motion Magic® average target and torque current difference target.
 
virtual ctre::phoenix::StatusCode SetControl (controls::compound::Diff_MotionMagicExpoTorqueCurrentFOC_Open const &request)=0
 Differential control with Motion Magic® Expo average target and torque current difference target.
 
virtual ctre::phoenix::StatusCode SetControl (controls::compound::Diff_MotionMagicVelocityTorqueCurrentFOC_Open const &request)=0
 Differential control with Motion Magic® Velocity average target and torque current difference target.
 
virtual ctre::phoenix::StatusCode SetControl (controls::EmptyControl const &request)=0
 Apply a generic empty control used to do nothing.
 
virtual ctre::phoenix::StatusCode SetControl (controls::ControlRequest const &request)=0
 Control device with generic control request object.
 
virtual ctre::phoenix::StatusCode ClearStickyFault_RotorFault1 (units::time::second_t timeoutSeconds)=0
 Clear sticky fault: Trips if a major mechanical or ESD event caused a brief loss of position data triggering a recovery while not in motion.
 
virtual ctre::phoenix::StatusCode ClearStickyFault_RotorFault1 ()=0
 Clear sticky fault: Trips if a major mechanical or ESD event caused a brief loss of position data triggering a recovery while not in motion.
 
virtual ctre::phoenix::StatusCode ClearStickyFault_RotorFault2 (units::time::second_t timeoutSeconds)=0
 Clear sticky fault: Trips if a major mechanical or ESD event caused a brief loss of position data triggering a recovery while in motion.
 
virtual ctre::phoenix::StatusCode ClearStickyFault_RotorFault2 ()=0
 Clear sticky fault: Trips if a major mechanical or ESD event caused a brief loss of position data triggering a recovery while in motion.
 
- Public Member Functions inherited from ctre::phoenix6::hardware::traits::CommonDevice
virtual ~CommonDevice ()=default
 
virtual int GetDeviceID () const =0
 
virtual CANBus GetNetwork () const =0
 
virtual uint64_t GetDeviceHash () const =0
 Gets a number unique for this device's hardware type and ID.
 
virtual std::shared_ptr< controls::ControlRequest const > GetAppliedControl () const =0
 Get the latest applied control.
 
virtual std::shared_ptr< controls::ControlRequestGetAppliedControl ()=0
 Get the latest applied control.
 
virtual bool HasResetOccurred ()=0
 
virtual std::function< bool()> GetResetOccurredChecker () const =0
 
virtual bool IsConnected (units::second_t maxLatencySeconds=500_ms)=0
 Returns whether the device is still connected to the robot.
 
virtual ctre::phoenix::StatusCode OptimizeBusUtilization (units::frequency::hertz_t optimizedFreqHz=4_Hz, units::time::second_t timeoutSeconds=100_ms)=0
 Optimizes the device's bus utilization by reducing the update frequencies of its status signals.
 
virtual ctre::phoenix::StatusCode ResetSignalFrequencies (units::time::second_t timeoutSeconds=100_ms)=0
 Resets the update frequencies of all the device's status signals to the defaults.
 

Detailed Description

Requires Phoenix Pro; Contains all FOC-exclusive control functions available for devices that support FOC.

Constructor & Destructor Documentation

◆ ~SupportsFOC()

virtual ctre::phoenix6::hardware::traits::SupportsFOC::~SupportsFOC ( )
virtualdefault

Member Function Documentation

◆ ClearStickyFault_RotorFault1() [1/2]

virtual ctre::phoenix::StatusCode ctre::phoenix6::hardware::traits::SupportsFOC::ClearStickyFault_RotorFault1 ( )
pure virtual

Clear sticky fault: Trips if a major mechanical or ESD event caused a brief loss of position data triggering a recovery while not in motion.

If the event occurs often, inspect for excess axial force or sources of ESD at the rotor.

This will wait up to 0.100 seconds (100ms) by default.

Returns
StatusCode of the set command

Implemented in ctre::phoenix6::hardware::core::CoreTalonFX.

◆ ClearStickyFault_RotorFault1() [2/2]

virtual ctre::phoenix::StatusCode ctre::phoenix6::hardware::traits::SupportsFOC::ClearStickyFault_RotorFault1 ( units::time::second_t timeoutSeconds)
pure virtual

Clear sticky fault: Trips if a major mechanical or ESD event caused a brief loss of position data triggering a recovery while not in motion.

If the event occurs often, inspect for excess axial force or sources of ESD at the rotor.

Parameters
timeoutSecondsMaximum time to wait up to in seconds.
Returns
StatusCode of the set command

Implemented in ctre::phoenix6::hardware::core::CoreTalonFX.

◆ ClearStickyFault_RotorFault2() [1/2]

virtual ctre::phoenix::StatusCode ctre::phoenix6::hardware::traits::SupportsFOC::ClearStickyFault_RotorFault2 ( )
pure virtual

Clear sticky fault: Trips if a major mechanical or ESD event caused a brief loss of position data triggering a recovery while in motion.

If the event occurs often, inspect for excess axial force or sources of ESD at the rotor.

This will wait up to 0.100 seconds (100ms) by default.

Returns
StatusCode of the set command

Implemented in ctre::phoenix6::hardware::core::CoreTalonFX.

◆ ClearStickyFault_RotorFault2() [2/2]

virtual ctre::phoenix::StatusCode ctre::phoenix6::hardware::traits::SupportsFOC::ClearStickyFault_RotorFault2 ( units::time::second_t timeoutSeconds)
pure virtual

Clear sticky fault: Trips if a major mechanical or ESD event caused a brief loss of position data triggering a recovery while in motion.

If the event occurs often, inspect for excess axial force or sources of ESD at the rotor.

Parameters
timeoutSecondsMaximum time to wait up to in seconds.
Returns
StatusCode of the set command

Implemented in ctre::phoenix6::hardware::core::CoreTalonFX.

◆ GetFault_RotorFault1()

virtual StatusSignal< bool > & ctre::phoenix6::hardware::traits::SupportsFOC::GetFault_RotorFault1 ( bool refresh = true)
pure virtual

Trips if a major mechanical or ESD event caused a brief loss of position data triggering a recovery while not in motion.

If the event occurs often, inspect for excess axial force or sources of ESD at the rotor.

  • Default Value: False

This refreshes and returns a cached StatusSignal object.

Parameters
refreshWhether to refresh the StatusSignal before returning it; defaults to true
Returns
Fault_RotorFault1 Status Signal Object

Implemented in ctre::phoenix6::hardware::core::CoreTalonFX.

◆ GetFault_RotorFault2()

virtual StatusSignal< bool > & ctre::phoenix6::hardware::traits::SupportsFOC::GetFault_RotorFault2 ( bool refresh = true)
pure virtual

Trips if a major mechanical or ESD event caused a brief loss of position data triggering a recovery while in motion.

If the event occurs often, inspect for excess axial force or sources of ESD at the rotor.

  • Default Value: False

This refreshes and returns a cached StatusSignal object.

Parameters
refreshWhether to refresh the StatusSignal before returning it; defaults to true
Returns
Fault_RotorFault2 Status Signal Object

Implemented in ctre::phoenix6::hardware::core::CoreTalonFX.

◆ GetStickyFault_RotorFault1()

virtual StatusSignal< bool > & ctre::phoenix6::hardware::traits::SupportsFOC::GetStickyFault_RotorFault1 ( bool refresh = true)
pure virtual

Trips if a major mechanical or ESD event caused a brief loss of position data triggering a recovery while not in motion.

If the event occurs often, inspect for excess axial force or sources of ESD at the rotor.

  • Default Value: False

This refreshes and returns a cached StatusSignal object.

Parameters
refreshWhether to refresh the StatusSignal before returning it; defaults to true
Returns
StickyFault_RotorFault1 Status Signal Object

Implemented in ctre::phoenix6::hardware::core::CoreTalonFX.

◆ GetStickyFault_RotorFault2()

virtual StatusSignal< bool > & ctre::phoenix6::hardware::traits::SupportsFOC::GetStickyFault_RotorFault2 ( bool refresh = true)
pure virtual

Trips if a major mechanical or ESD event caused a brief loss of position data triggering a recovery while in motion.

If the event occurs often, inspect for excess axial force or sources of ESD at the rotor.

  • Default Value: False

This refreshes and returns a cached StatusSignal object.

Parameters
refreshWhether to refresh the StatusSignal before returning it; defaults to true
Returns
StickyFault_RotorFault2 Status Signal Object

Implemented in ctre::phoenix6::hardware::core::CoreTalonFX.

◆ SetControl() [1/28]

virtual ctre::phoenix::StatusCode ctre::phoenix6::hardware::traits::SupportsFOC::SetControl ( controls::compound::Diff_MotionMagicExpoTorqueCurrentFOC_Open const & request)
pure virtual

Differential control with Motion Magic® Expo average target and torque current difference target.

  • Diff_MotionMagicExpoTorqueCurrentFOC_Open Parameters:
    • AverageRequest: Average MotionMagicExpoTorqueCurrentFOC request of the mechanism.
    • DifferentialRequest: Differential TorqueCurrentFOC request of the mechanism.
Parameters
requestControl object to request of the device
Returns
Status code of the request

Implemented in ctre::phoenix6::hardware::core::CoreTalonFX, and ctre::phoenix6::hardware::traits::CommonTalonWithFOC.

◆ SetControl() [2/28]

virtual ctre::phoenix::StatusCode ctre::phoenix6::hardware::traits::SupportsFOC::SetControl ( controls::compound::Diff_MotionMagicExpoTorqueCurrentFOC_Position const & request)
pure virtual

Differential control with Motion Magic® Expo average target and position difference target using torque current control.

  • Diff_MotionMagicExpoTorqueCurrentFOC_Position Parameters:
    • AverageRequest: Average MotionMagicExpoTorqueCurrentFOC request of the mechanism.
    • DifferentialRequest: Differential PositionTorqueCurrentFOC request of the mechanism.
Parameters
requestControl object to request of the device
Returns
Status code of the request

Implemented in ctre::phoenix6::hardware::core::CoreTalonFX, and ctre::phoenix6::hardware::traits::CommonTalonWithFOC.

◆ SetControl() [3/28]

virtual ctre::phoenix::StatusCode ctre::phoenix6::hardware::traits::SupportsFOC::SetControl ( controls::compound::Diff_MotionMagicExpoTorqueCurrentFOC_Velocity const & request)
pure virtual

Differential control with Motion Magic® Expo average target and velocity difference target using torque current control.

  • Diff_MotionMagicExpoTorqueCurrentFOC_Velocity Parameters:
    • AverageRequest: Average MotionMagicExpoTorqueCurrentFOC request of the mechanism.
    • DifferentialRequest: Differential VelocityTorqueCurrentFOC request of the mechanism.
Parameters
requestControl object to request of the device
Returns
Status code of the request

Implemented in ctre::phoenix6::hardware::core::CoreTalonFX, and ctre::phoenix6::hardware::traits::CommonTalonWithFOC.

◆ SetControl() [4/28]

virtual ctre::phoenix::StatusCode ctre::phoenix6::hardware::traits::SupportsFOC::SetControl ( controls::compound::Diff_MotionMagicTorqueCurrentFOC_Open const & request)
pure virtual

Differential control with Motion Magic® average target and torque current difference target.

  • Diff_MotionMagicTorqueCurrentFOC_Open Parameters:
    • AverageRequest: Average MotionMagicTorqueCurrentFOC request of the mechanism.
    • DifferentialRequest: Differential TorqueCurrentFOC request of the mechanism.
Parameters
requestControl object to request of the device
Returns
Status code of the request

Implemented in ctre::phoenix6::hardware::core::CoreTalonFX, and ctre::phoenix6::hardware::traits::CommonTalonWithFOC.

◆ SetControl() [5/28]

virtual ctre::phoenix::StatusCode ctre::phoenix6::hardware::traits::SupportsFOC::SetControl ( controls::compound::Diff_MotionMagicTorqueCurrentFOC_Position const & request)
pure virtual

Differential control with Motion Magic® average target and position difference target using torque current control.

  • Diff_MotionMagicTorqueCurrentFOC_Position Parameters:
    • AverageRequest: Average MotionMagicTorqueCurrentFOC request of the mechanism.
    • DifferentialRequest: Differential PositionTorqueCurrentFOC request of the mechanism.
Parameters
requestControl object to request of the device
Returns
Status code of the request

Implemented in ctre::phoenix6::hardware::core::CoreTalonFX, and ctre::phoenix6::hardware::traits::CommonTalonWithFOC.

◆ SetControl() [6/28]

virtual ctre::phoenix::StatusCode ctre::phoenix6::hardware::traits::SupportsFOC::SetControl ( controls::compound::Diff_MotionMagicTorqueCurrentFOC_Velocity const & request)
pure virtual

Differential control with Motion Magic® average target and velocity difference target using torque current control.

  • Diff_MotionMagicTorqueCurrentFOC_Velocity Parameters:
    • AverageRequest: Average MotionMagicTorqueCurrentFOC request of the mechanism.
    • DifferentialRequest: Differential VelocityTorqueCurrentFOC request of the mechanism.
Parameters
requestControl object to request of the device
Returns
Status code of the request

Implemented in ctre::phoenix6::hardware::core::CoreTalonFX, and ctre::phoenix6::hardware::traits::CommonTalonWithFOC.

◆ SetControl() [7/28]

virtual ctre::phoenix::StatusCode ctre::phoenix6::hardware::traits::SupportsFOC::SetControl ( controls::compound::Diff_MotionMagicVelocityTorqueCurrentFOC_Open const & request)
pure virtual

Differential control with Motion Magic® Velocity average target and torque current difference target.

  • Diff_MotionMagicVelocityTorqueCurrentFOC_Open Parameters:
    • AverageRequest: Average MotionMagicVelocityTorqueCurrentFOC request of the mechanism.
    • DifferentialRequest: Differential TorqueCurrentFOC request of the mechanism.
Parameters
requestControl object to request of the device
Returns
Status code of the request

Implemented in ctre::phoenix6::hardware::core::CoreTalonFX, and ctre::phoenix6::hardware::traits::CommonTalonWithFOC.

◆ SetControl() [8/28]

virtual ctre::phoenix::StatusCode ctre::phoenix6::hardware::traits::SupportsFOC::SetControl ( controls::compound::Diff_MotionMagicVelocityTorqueCurrentFOC_Position const & request)
pure virtual

Differential control with Motion Magic® Velocity average target and position difference target using torque current control.

  • Diff_MotionMagicVelocityTorqueCurrentFOC_Position Parameters:
    • AverageRequest: Average MotionMagicVelocityTorqueCurrentFOC request of the mechanism.
    • DifferentialRequest: Differential PositionTorqueCurrentFOC request of the mechanism.
Parameters
requestControl object to request of the device
Returns
Status code of the request

Implemented in ctre::phoenix6::hardware::core::CoreTalonFX, and ctre::phoenix6::hardware::traits::CommonTalonWithFOC.

◆ SetControl() [9/28]

virtual ctre::phoenix::StatusCode ctre::phoenix6::hardware::traits::SupportsFOC::SetControl ( controls::compound::Diff_MotionMagicVelocityTorqueCurrentFOC_Velocity const & request)
pure virtual

Differential control with Motion Magic® Velocity average target and velocity difference target using torque current control.

  • Diff_MotionMagicVelocityTorqueCurrentFOC_Velocity Parameters:
    • AverageRequest: Average MotionMagicVelocityTorqueCurrentFOC request of the mechanism.
    • DifferentialRequest: Differential VelocityTorqueCurrentFOC request of the mechanism.
Parameters
requestControl object to request of the device
Returns
Status code of the request

Implemented in ctre::phoenix6::hardware::core::CoreTalonFX, and ctre::phoenix6::hardware::traits::CommonTalonWithFOC.

◆ SetControl() [10/28]

virtual ctre::phoenix::StatusCode ctre::phoenix6::hardware::traits::SupportsFOC::SetControl ( controls::compound::Diff_PositionTorqueCurrentFOC_Open const & request)
pure virtual

Differential control with position average target and torque current difference target.

  • Diff_PositionTorqueCurrentFOC_Open Parameters:
    • AverageRequest: Average PositionTorqueCurrentFOC request of the mechanism.
    • DifferentialRequest: Differential TorqueCurrentFOC request of the mechanism.
Parameters
requestControl object to request of the device
Returns
Status code of the request

Implemented in ctre::phoenix6::hardware::core::CoreTalonFX, and ctre::phoenix6::hardware::traits::CommonTalonWithFOC.

◆ SetControl() [11/28]

virtual ctre::phoenix::StatusCode ctre::phoenix6::hardware::traits::SupportsFOC::SetControl ( controls::compound::Diff_PositionTorqueCurrentFOC_Position const & request)
pure virtual

Differential control with position average target and position difference target using torque current control.

  • Diff_PositionTorqueCurrentFOC_Position Parameters:
    • AverageRequest: Average PositionTorqueCurrentFOC request of the mechanism.
    • DifferentialRequest: Differential PositionTorqueCurrentFOC request of the mechanism.
Parameters
requestControl object to request of the device
Returns
Status code of the request

Implemented in ctre::phoenix6::hardware::core::CoreTalonFX, and ctre::phoenix6::hardware::traits::CommonTalonWithFOC.

◆ SetControl() [12/28]

virtual ctre::phoenix::StatusCode ctre::phoenix6::hardware::traits::SupportsFOC::SetControl ( controls::compound::Diff_PositionTorqueCurrentFOC_Velocity const & request)
pure virtual

Differential control with position average target and velocity difference target using torque current control.

  • Diff_PositionTorqueCurrentFOC_Velocity Parameters:
    • AverageRequest: Average PositionTorqueCurrentFOC request of the mechanism.
    • DifferentialRequest: Differential VelocityTorqueCurrentFOC request of the mechanism.
Parameters
requestControl object to request of the device
Returns
Status code of the request

Implemented in ctre::phoenix6::hardware::core::CoreTalonFX, and ctre::phoenix6::hardware::traits::CommonTalonWithFOC.

◆ SetControl() [13/28]

virtual ctre::phoenix::StatusCode ctre::phoenix6::hardware::traits::SupportsFOC::SetControl ( controls::compound::Diff_TorqueCurrentFOC_Open const & request)
pure virtual

Differential control with torque current average target and torque current difference target.

  • Diff_TorqueCurrentFOC_Open Parameters:
    • AverageRequest: Average TorqueCurrentFOC request of the mechanism.
    • DifferentialRequest: Differential TorqueCurrentFOC request of the mechanism.
Parameters
requestControl object to request of the device
Returns
Status code of the request

Implemented in ctre::phoenix6::hardware::core::CoreTalonFX, and ctre::phoenix6::hardware::traits::CommonTalonWithFOC.

◆ SetControl() [14/28]

virtual ctre::phoenix::StatusCode ctre::phoenix6::hardware::traits::SupportsFOC::SetControl ( controls::compound::Diff_TorqueCurrentFOC_Position const & request)
pure virtual

Differential control with torque current average target and position difference target.

  • Diff_TorqueCurrentFOC_Position Parameters:
    • AverageRequest: Average TorqueCurrentFOC request of the mechanism.
    • DifferentialRequest: Differential PositionTorqueCurrentFOC request of the mechanism.
Parameters
requestControl object to request of the device
Returns
Status code of the request

Implemented in ctre::phoenix6::hardware::core::CoreTalonFX, and ctre::phoenix6::hardware::traits::CommonTalonWithFOC.

◆ SetControl() [15/28]

virtual ctre::phoenix::StatusCode ctre::phoenix6::hardware::traits::SupportsFOC::SetControl ( controls::compound::Diff_TorqueCurrentFOC_Velocity const & request)
pure virtual

Differential control with torque current average target and velocity difference target.

  • Diff_TorqueCurrentFOC_Velocity Parameters:
    • AverageRequest: Average TorqueCurrentFOC request of the mechanism.
    • DifferentialRequest: Differential VelocityTorqueCurrentFOC request of the mechanism.
Parameters
requestControl object to request of the device
Returns
Status code of the request

Implemented in ctre::phoenix6::hardware::core::CoreTalonFX, and ctre::phoenix6::hardware::traits::CommonTalonWithFOC.

◆ SetControl() [16/28]

virtual ctre::phoenix::StatusCode ctre::phoenix6::hardware::traits::SupportsFOC::SetControl ( controls::compound::Diff_VelocityTorqueCurrentFOC_Open const & request)
pure virtual

Differential control with velocity average target and torque current difference target.

  • Diff_VelocityTorqueCurrentFOC_Open Parameters:
    • AverageRequest: Average VelocityTorqueCurrentFOC request of the mechanism.
    • DifferentialRequest: Differential TorqueCurrentFOC request of the mechanism.
Parameters
requestControl object to request of the device
Returns
Status code of the request

Implemented in ctre::phoenix6::hardware::core::CoreTalonFX, and ctre::phoenix6::hardware::traits::CommonTalonWithFOC.

◆ SetControl() [17/28]

virtual ctre::phoenix::StatusCode ctre::phoenix6::hardware::traits::SupportsFOC::SetControl ( controls::compound::Diff_VelocityTorqueCurrentFOC_Position const & request)
pure virtual

Differential control with velocity average target and position difference target using torque current control.

  • Diff_VelocityTorqueCurrentFOC_Position Parameters:
    • AverageRequest: Average VelocityTorqueCurrentFOC request of the mechanism.
    • DifferentialRequest: Differential PositionTorqueCurrentFOC request of the mechanism.
Parameters
requestControl object to request of the device
Returns
Status code of the request

Implemented in ctre::phoenix6::hardware::core::CoreTalonFX, and ctre::phoenix6::hardware::traits::CommonTalonWithFOC.

◆ SetControl() [18/28]

virtual ctre::phoenix::StatusCode ctre::phoenix6::hardware::traits::SupportsFOC::SetControl ( controls::compound::Diff_VelocityTorqueCurrentFOC_Velocity const & request)
pure virtual

Differential control with velocity average target and velocity difference target using torque current control.

  • Diff_VelocityTorqueCurrentFOC_Velocity Parameters:
    • AverageRequest: Average VelocityTorqueCurrentFOC request of the mechanism.
    • DifferentialRequest: Differential VelocityTorqueCurrentFOC request of the mechanism.
Parameters
requestControl object to request of the device
Returns
Status code of the request

Implemented in ctre::phoenix6::hardware::core::CoreTalonFX, and ctre::phoenix6::hardware::traits::CommonTalonWithFOC.

◆ SetControl() [19/28]

virtual ctre::phoenix::StatusCode ctre::phoenix6::hardware::traits::SupportsFOC::SetControl ( controls::ControlRequest const & request)
pure virtual

Control device with generic control request object.

User must make sure the specified object is castable to a valid control request, otherwise this function will fail at run-time and return the NotSupported StatusCode

Parameters
requestControl object to request of the device
Returns
Status code of the request

Implemented in ctre::phoenix6::hardware::core::CoreTalonFX, and ctre::phoenix6::hardware::traits::CommonTalonWithFOC.

◆ SetControl() [20/28]

virtual ctre::phoenix::StatusCode ctre::phoenix6::hardware::traits::SupportsFOC::SetControl ( controls::DynamicMotionMagicExpoTorqueCurrentFOC const & request)
pure virtual

Requests Motion Magic® Expo to target a final position using an exponential motion profile.

This dynamic request allows runtime changes to the profile kV, kA, and (optional) Cruise Velocity. Users can optionally provide a torque current feedforward.

Motion Magic® Expo produces a motion profile in real-time while attempting to honor the specified Cruise Velocity (optional) and the mechanism kV and kA. Note that unlike the slot gains, the Expo_kV and Expo_kA parameters are always in output units of Volts.

Setting the Cruise Velocity to 0 will allow the profile to run to the max possible velocity based on Expo_kV. This control mode does not use the Acceleration or Jerk configs.

Target position can be changed on-the-fly and Motion Magic® will do its best to adjust the profile. This control mode is based on torque current, so relevant closed-loop gains will use Amperes for the numerator.

  • DynamicMotionMagicExpoTorqueCurrentFOC Parameters:
    • Position: Position to drive toward in rotations.
    • kV: Mechanism kV for profiling. Unlike the kV slot gain, this is always in units of V/rps.

      This represents the amount of voltage necessary to hold a velocity. In terms of the Motion Magic® Expo profile, a higher kV results in a slower maximum velocity.

    • kA: Mechanism kA for profiling. Unlike the kA slot gain, this is always in units of V/rps².

      This represents the amount of voltage necessary to achieve an acceleration. In terms of the Motion Magic® Expo profile, a higher kA results in a slower acceleration.

    • Velocity: Cruise velocity for profiling. The signage does not matter as the device will use the absolute value for profile generation. Setting this to 0 will allow the profile to run to the max possible velocity based on Expo_kV.
    • FeedForward: Feedforward to apply in torque current in Amperes. This is added to the output of the onboard feedforward terms.

      User can use motor's kT to scale Newton-meter to Amperes.

    • Slot: Select which gains are applied by selecting the slot. Use the configuration api to set the gain values for the selected slot before enabling this feature. Slot must be within [0,2].
    • OverrideCoastDurNeutral: Set to true to coast the rotor when output is zero (or within deadband). Set to false to use the NeutralMode configuration setting (default). This flag exists to provide the fundamental behavior of this control when output is zero, which is to provide 0A (zero torque).
    • LimitForwardMotion: Set to true to force forward limiting. This allows users to use other limit switch sensors connected to robot controller. This also allows use of active sensors that require external power.
    • LimitReverseMotion: Set to true to force reverse limiting. This allows users to use other limit switch sensors connected to robot controller. This also allows use of active sensors that require external power.
    • IgnoreHardwareLimits: Set to true to ignore hardware limit switches and the LimitForwardMotion and LimitReverseMotion parameters, instead allowing motion.

      This can be useful on mechanisms such as an intake/feeder, where a limit switch stops motion while intaking but should be ignored when feeding to a shooter.

      The hardware limit faults and Forward/ReverseLimit signals will still report the values of the limit switches regardless of this parameter.

    • IgnoreSoftwareLimits: Set to true to ignore software limits, instead allowing motion.

      This can be useful when calibrating the zero point of a mechanism such as an elevator.

      The software limit faults will still report the values of the software limits regardless of this parameter.

    • UseTimesync: Set to true to delay applying this control request until a timesync boundary (requires Phoenix Pro and CANivore). This eliminates the impact of nondeterministic network delays in exchange for a larger but deterministic control latency.

      This requires setting the ControlTimesyncFreqHz config in MotorOutputConfigs. Additionally, when this is enabled, the UpdateFreqHz of this request should be set to 0 Hz.

Parameters
requestControl object to request of the device
Returns
Status code of the request

Implemented in ctre::phoenix6::hardware::core::CoreTalonFX, and ctre::phoenix6::hardware::traits::CommonTalonWithFOC.

◆ SetControl() [21/28]

virtual ctre::phoenix::StatusCode ctre::phoenix6::hardware::traits::SupportsFOC::SetControl ( controls::DynamicMotionMagicTorqueCurrentFOC const & request)
pure virtual

Requests Motion Magic® to target a final position using a motion profile.

This dynamic request allows runtime changes to Cruise Velocity, Acceleration, and (optional) Jerk. Users can optionally provide a torque current feedforward.

Motion Magic® produces a motion profile in real-time while attempting to honor the specified Cruise Velocity, Acceleration, and (optional) Jerk. This control mode does not use the Expo_kV or Expo_kA configs.

Target position can be changed on-the-fly and Motion Magic® will do its best to adjust the profile. This control mode is based on torque current, so relevant closed-loop gains will use Amperes for the numerator.

  • DynamicMotionMagicTorqueCurrentFOC Parameters:
    • Position: Position to drive toward in rotations.
    • Velocity: Cruise velocity for profiling. The signage does not matter as the device will use the absolute value for profile generation.
    • Acceleration: Acceleration for profiling. The signage does not matter as the device will use the absolute value for profile generation.
    • Jerk: Jerk for profiling. The signage does not matter as the device will use the absolute value for profile generation.

      Jerk is optional; if this is set to zero, then Motion Magic® will not apply a Jerk limit.

    • FeedForward: Feedforward to apply in torque current in Amperes. This is added to the output of the onboard feedforward terms.

      User can use motor's kT to scale Newton-meter to Amperes.

    • Slot: Select which gains are applied by selecting the slot. Use the configuration api to set the gain values for the selected slot before enabling this feature. Slot must be within [0,2].
    • OverrideCoastDurNeutral: Set to true to coast the rotor when output is zero (or within deadband). Set to false to use the NeutralMode configuration setting (default). This flag exists to provide the fundamental behavior of this control when output is zero, which is to provide 0A (zero torque).
    • LimitForwardMotion: Set to true to force forward limiting. This allows users to use other limit switch sensors connected to robot controller. This also allows use of active sensors that require external power.
    • LimitReverseMotion: Set to true to force reverse limiting. This allows users to use other limit switch sensors connected to robot controller. This also allows use of active sensors that require external power.
    • IgnoreHardwareLimits: Set to true to ignore hardware limit switches and the LimitForwardMotion and LimitReverseMotion parameters, instead allowing motion.

      This can be useful on mechanisms such as an intake/feeder, where a limit switch stops motion while intaking but should be ignored when feeding to a shooter.

      The hardware limit faults and Forward/ReverseLimit signals will still report the values of the limit switches regardless of this parameter.

    • IgnoreSoftwareLimits: Set to true to ignore software limits, instead allowing motion.

      This can be useful when calibrating the zero point of a mechanism such as an elevator.

      The software limit faults will still report the values of the software limits regardless of this parameter.

    • UseTimesync: Set to true to delay applying this control request until a timesync boundary (requires Phoenix Pro and CANivore). This eliminates the impact of nondeterministic network delays in exchange for a larger but deterministic control latency.

      This requires setting the ControlTimesyncFreqHz config in MotorOutputConfigs. Additionally, when this is enabled, the UpdateFreqHz of this request should be set to 0 Hz.

Parameters
requestControl object to request of the device
Returns
Status code of the request

Implemented in ctre::phoenix6::hardware::core::CoreTalonFX, and ctre::phoenix6::hardware::traits::CommonTalonWithFOC.

◆ SetControl() [22/28]

virtual ctre::phoenix::StatusCode ctre::phoenix6::hardware::traits::SupportsFOC::SetControl ( controls::EmptyControl const & request)
pure virtual

Apply a generic empty control used to do nothing.

Parameters
requestControl object to request of the device
Returns
Status code of the request

Implemented in ctre::phoenix6::hardware::core::CoreTalonFX, and ctre::phoenix6::hardware::traits::CommonTalonWithFOC.

◆ SetControl() [23/28]

virtual ctre::phoenix::StatusCode ctre::phoenix6::hardware::traits::SupportsFOC::SetControl ( controls::MotionMagicExpoTorqueCurrentFOC const & request)
pure virtual

Requests Motion Magic® to target a final position using an exponential motion profile.

Users can optionally provide a torque current feedforward.

Motion Magic® Expo produces a motion profile in real-time while attempting to honor the Cruise Velocity (optional) and the mechanism kV and kA, specified via the Motion Magic® configuration values. Note that unlike the slot gains, the Expo_kV and Expo_kA configs are always in output units of Volts.

Setting Cruise Velocity to 0 will allow the profile to run to the max possible velocity based on Expo_kV. This control mode does not use the Acceleration or Jerk configs.

Target position can be changed on-the-fly and Motion Magic® will do its best to adjust the profile. This control mode is based on torque current, so relevant closed-loop gains will use Amperes for the numerator.

  • MotionMagicExpoTorqueCurrentFOC Parameters:
    • Position: Position to drive toward in rotations.
    • FeedForward: Feedforward to apply in torque current in Amperes. This is added to the output of the onboard feedforward terms.

      User can use motor's kT to scale Newton-meter to Amperes.

    • Slot: Select which gains are applied by selecting the slot. Use the configuration api to set the gain values for the selected slot before enabling this feature. Slot must be within [0,2].
    • OverrideCoastDurNeutral: Set to true to coast the rotor when output is zero (or within deadband). Set to false to use the NeutralMode configuration setting (default). This flag exists to provide the fundamental behavior of this control when output is zero, which is to provide 0A (zero torque).
    • LimitForwardMotion: Set to true to force forward limiting. This allows users to use other limit switch sensors connected to robot controller. This also allows use of active sensors that require external power.
    • LimitReverseMotion: Set to true to force reverse limiting. This allows users to use other limit switch sensors connected to robot controller. This also allows use of active sensors that require external power.
    • IgnoreHardwareLimits: Set to true to ignore hardware limit switches and the LimitForwardMotion and LimitReverseMotion parameters, instead allowing motion.

      This can be useful on mechanisms such as an intake/feeder, where a limit switch stops motion while intaking but should be ignored when feeding to a shooter.

      The hardware limit faults and Forward/ReverseLimit signals will still report the values of the limit switches regardless of this parameter.

    • IgnoreSoftwareLimits: Set to true to ignore software limits, instead allowing motion.

      This can be useful when calibrating the zero point of a mechanism such as an elevator.

      The software limit faults will still report the values of the software limits regardless of this parameter.

    • UseTimesync: Set to true to delay applying this control request until a timesync boundary (requires Phoenix Pro and CANivore). This eliminates the impact of nondeterministic network delays in exchange for a larger but deterministic control latency.

      This requires setting the ControlTimesyncFreqHz config in MotorOutputConfigs. Additionally, when this is enabled, the UpdateFreqHz of this request should be set to 0 Hz.

Parameters
requestControl object to request of the device
Returns
Status code of the request

Implemented in ctre::phoenix6::hardware::core::CoreTalonFX, and ctre::phoenix6::hardware::traits::CommonTalonWithFOC.

◆ SetControl() [24/28]

virtual ctre::phoenix::StatusCode ctre::phoenix6::hardware::traits::SupportsFOC::SetControl ( controls::MotionMagicTorqueCurrentFOC const & request)
pure virtual

Requests Motion Magic® to target a final position using a motion profile.

Users can optionally provide a torque current feedforward.

Motion Magic® produces a motion profile in real-time while attempting to honor the Cruise Velocity, Acceleration, and (optional) Jerk specified via the Motion Magic® configuration values. This control mode does not use the Expo_kV or Expo_kA configs.

Target position can be changed on-the-fly and Motion Magic® will do its best to adjust the profile. This control mode is based on torque current, so relevant closed-loop gains will use Amperes for the numerator.

  • MotionMagicTorqueCurrentFOC Parameters:
    • Position: Position to drive toward in rotations.
    • FeedForward: Feedforward to apply in torque current in Amperes. This is added to the output of the onboard feedforward terms.

      User can use motor's kT to scale Newton-meter to Amperes.

    • Slot: Select which gains are applied by selecting the slot. Use the configuration api to set the gain values for the selected slot before enabling this feature. Slot must be within [0,2].
    • OverrideCoastDurNeutral: Set to true to coast the rotor when output is zero (or within deadband). Set to false to use the NeutralMode configuration setting (default). This flag exists to provide the fundamental behavior of this control when output is zero, which is to provide 0A (zero torque).
    • LimitForwardMotion: Set to true to force forward limiting. This allows users to use other limit switch sensors connected to robot controller. This also allows use of active sensors that require external power.
    • LimitReverseMotion: Set to true to force reverse limiting. This allows users to use other limit switch sensors connected to robot controller. This also allows use of active sensors that require external power.
    • IgnoreHardwareLimits: Set to true to ignore hardware limit switches and the LimitForwardMotion and LimitReverseMotion parameters, instead allowing motion.

      This can be useful on mechanisms such as an intake/feeder, where a limit switch stops motion while intaking but should be ignored when feeding to a shooter.

      The hardware limit faults and Forward/ReverseLimit signals will still report the values of the limit switches regardless of this parameter.

    • IgnoreSoftwareLimits: Set to true to ignore software limits, instead allowing motion.

      This can be useful when calibrating the zero point of a mechanism such as an elevator.

      The software limit faults will still report the values of the software limits regardless of this parameter.

    • UseTimesync: Set to true to delay applying this control request until a timesync boundary (requires Phoenix Pro and CANivore). This eliminates the impact of nondeterministic network delays in exchange for a larger but deterministic control latency.

      This requires setting the ControlTimesyncFreqHz config in MotorOutputConfigs. Additionally, when this is enabled, the UpdateFreqHz of this request should be set to 0 Hz.

Parameters
requestControl object to request of the device
Returns
Status code of the request

Implemented in ctre::phoenix6::hardware::core::CoreTalonFX, and ctre::phoenix6::hardware::traits::CommonTalonWithFOC.

◆ SetControl() [25/28]

virtual ctre::phoenix::StatusCode ctre::phoenix6::hardware::traits::SupportsFOC::SetControl ( controls::MotionMagicVelocityTorqueCurrentFOC const & request)
pure virtual

Requests Motion Magic® to target a final velocity using a motion profile.

This allows smooth transitions between velocity set points. Users can optionally provide a torque feedforward.

Motion Magic® Velocity produces a motion profile in real-time while attempting to honor the specified Acceleration and (optional) Jerk. This control mode does not use the CruiseVelocity, Expo_kV, or Expo_kA configs.

If the specified acceleration is zero, the Acceleration under Motion Magic® configuration parameter is used instead. This allows for runtime adjustment of acceleration for advanced users. Jerk is also specified in the Motion Magic® persistent configuration values. If Jerk is set to zero, Motion Magic® will produce a trapezoidal acceleration profile.

Target velocity can also be changed on-the-fly and Motion Magic® will do its best to adjust the profile. This control mode is based on torque current, so relevant closed-loop gains will use Amperes for the numerator.

  • MotionMagicVelocityTorqueCurrentFOC Parameters:
    • Velocity: Target velocity to drive toward in rotations per second. This can be changed on-the fly.
    • Acceleration: This is the absolute Acceleration to use generating the profile. If this parameter is zero, the Acceleration persistent configuration parameter is used instead. Acceleration is in rotations per second squared. If nonzero, the signage does not matter as the absolute value is used.
    • FeedForward: Feedforward to apply in torque current in Amperes. This is added to the output of the onboard feedforward terms.

      User can use motor's kT to scale Newton-meter to Amperes.

    • Slot: Select which gains are applied by selecting the slot. Use the configuration api to set the gain values for the selected slot before enabling this feature. Slot must be within [0,2].
    • OverrideCoastDurNeutral: Set to true to coast the rotor when output is zero (or within deadband). Set to false to use the NeutralMode configuration setting (default). This flag exists to provide the fundamental behavior of this control when output is zero, which is to provide 0A (zero torque).
    • LimitForwardMotion: Set to true to force forward limiting. This allows users to use other limit switch sensors connected to robot controller. This also allows use of active sensors that require external power.
    • LimitReverseMotion: Set to true to force reverse limiting. This allows users to use other limit switch sensors connected to robot controller. This also allows use of active sensors that require external power.
    • IgnoreHardwareLimits: Set to true to ignore hardware limit switches and the LimitForwardMotion and LimitReverseMotion parameters, instead allowing motion.

      This can be useful on mechanisms such as an intake/feeder, where a limit switch stops motion while intaking but should be ignored when feeding to a shooter.

      The hardware limit faults and Forward/ReverseLimit signals will still report the values of the limit switches regardless of this parameter.

    • IgnoreSoftwareLimits: Set to true to ignore software limits, instead allowing motion.

      This can be useful when calibrating the zero point of a mechanism such as an elevator.

      The software limit faults will still report the values of the software limits regardless of this parameter.

    • UseTimesync: Set to true to delay applying this control request until a timesync boundary (requires Phoenix Pro and CANivore). This eliminates the impact of nondeterministic network delays in exchange for a larger but deterministic control latency.

      This requires setting the ControlTimesyncFreqHz config in MotorOutputConfigs. Additionally, when this is enabled, the UpdateFreqHz of this request should be set to 0 Hz.

Parameters
requestControl object to request of the device
Returns
Status code of the request

Implemented in ctre::phoenix6::hardware::core::CoreTalonFX, and ctre::phoenix6::hardware::traits::CommonTalonWithFOC.

◆ SetControl() [26/28]

virtual ctre::phoenix::StatusCode ctre::phoenix6::hardware::traits::SupportsFOC::SetControl ( controls::PositionTorqueCurrentFOC const & request)
pure virtual

Request PID to target position with torque current feedforward.

This control mode will set the motor's position setpoint to the position specified by the user. In addition, it will apply an additional torque current as an arbitrary feedforward value.

  • PositionTorqueCurrentFOC Parameters:
    • Position: Position to drive toward in rotations.
    • Velocity: Velocity to drive toward in rotations per second. This is typically used for motion profiles generated by the robot program.
    • FeedForward: Feedforward to apply in torque current in Amperes. This is added to the output of the onboard feedforward terms.

      User can use motor's kT to scale Newton-meter to Amperes.

    • Slot: Select which gains are applied by selecting the slot. Use the configuration api to set the gain values for the selected slot before enabling this feature. Slot must be within [0,2].
    • OverrideCoastDurNeutral: Set to true to coast the rotor when output is zero (or within deadband). Set to false to use the NeutralMode configuration setting (default). This flag exists to provide the fundamental behavior of this control when output is zero, which is to provide 0A (zero torque).
    • LimitForwardMotion: Set to true to force forward limiting. This allows users to use other limit switch sensors connected to robot controller. This also allows use of active sensors that require external power.
    • LimitReverseMotion: Set to true to force reverse limiting. This allows users to use other limit switch sensors connected to robot controller. This also allows use of active sensors that require external power.
    • IgnoreHardwareLimits: Set to true to ignore hardware limit switches and the LimitForwardMotion and LimitReverseMotion parameters, instead allowing motion.

      This can be useful on mechanisms such as an intake/feeder, where a limit switch stops motion while intaking but should be ignored when feeding to a shooter.

      The hardware limit faults and Forward/ReverseLimit signals will still report the values of the limit switches regardless of this parameter.

    • IgnoreSoftwareLimits: Set to true to ignore software limits, instead allowing motion.

      This can be useful when calibrating the zero point of a mechanism such as an elevator.

      The software limit faults will still report the values of the software limits regardless of this parameter.

    • UseTimesync: Set to true to delay applying this control request until a timesync boundary (requires Phoenix Pro and CANivore). This eliminates the impact of nondeterministic network delays in exchange for a larger but deterministic control latency.

      This requires setting the ControlTimesyncFreqHz config in MotorOutputConfigs. Additionally, when this is enabled, the UpdateFreqHz of this request should be set to 0 Hz.

Parameters
requestControl object to request of the device
Returns
Status code of the request

Implemented in ctre::phoenix6::hardware::core::CoreTalonFX, and ctre::phoenix6::hardware::traits::CommonTalonWithFOC.

◆ SetControl() [27/28]

virtual ctre::phoenix::StatusCode ctre::phoenix6::hardware::traits::SupportsFOC::SetControl ( controls::TorqueCurrentFOC const & request)
pure virtual

Request a specified motor current (field oriented control).

This control request will drive the motor to the requested motor (stator) current value. This leverages field oriented control (FOC), which means greater peak power than what is documented. This scales to torque based on Motor's kT constant.

  • TorqueCurrentFOC Parameters:
    • Output: Amount of motor current in Amperes
    • MaxAbsDutyCycle: The maximum absolute motor output that can be applied, which effectively limits the velocity. For example, 0.50 means no more than 50% output in either direction. This is useful for preventing the motor from spinning to its terminal velocity when there is no external torque applied unto the rotor. Note this is absolute maximum, so the value should be between zero and one.
    • Deadband: Deadband in Amperes. If torque request is within deadband, the bridge output is neutral. If deadband is set to zero then there is effectively no deadband. Note if deadband is zero, a free spinning motor will spin for quite a while as the firmware attempts to hold the motor's bemf. If user expects motor to cease spinning quickly with a demand of zero, we recommend a deadband of one Ampere. This value will be converted to an integral value of amps.
    • OverrideCoastDurNeutral: Set to true to coast the rotor when output is zero (or within deadband). Set to false to use the NeutralMode configuration setting (default). This flag exists to provide the fundamental behavior of this control when output is zero, which is to provide 0A (zero torque).
    • LimitForwardMotion: Set to true to force forward limiting. This allows users to use other limit switch sensors connected to robot controller. This also allows use of active sensors that require external power.
    • LimitReverseMotion: Set to true to force reverse limiting. This allows users to use other limit switch sensors connected to robot controller. This also allows use of active sensors that require external power.
    • IgnoreHardwareLimits: Set to true to ignore hardware limit switches and the LimitForwardMotion and LimitReverseMotion parameters, instead allowing motion.

      This can be useful on mechanisms such as an intake/feeder, where a limit switch stops motion while intaking but should be ignored when feeding to a shooter.

      The hardware limit faults and Forward/ReverseLimit signals will still report the values of the limit switches regardless of this parameter.

    • IgnoreSoftwareLimits: Set to true to ignore software limits, instead allowing motion.

      This can be useful when calibrating the zero point of a mechanism such as an elevator.

      The software limit faults will still report the values of the software limits regardless of this parameter.

    • UseTimesync: Set to true to delay applying this control request until a timesync boundary (requires Phoenix Pro and CANivore). This eliminates the impact of nondeterministic network delays in exchange for a larger but deterministic control latency.

      This requires setting the ControlTimesyncFreqHz config in MotorOutputConfigs. Additionally, when this is enabled, the UpdateFreqHz of this request should be set to 0 Hz.

Parameters
requestControl object to request of the device
Returns
Status code of the request

Implemented in ctre::phoenix6::hardware::core::CoreTalonFX, and ctre::phoenix6::hardware::traits::CommonTalonWithFOC.

◆ SetControl() [28/28]

virtual ctre::phoenix::StatusCode ctre::phoenix6::hardware::traits::SupportsFOC::SetControl ( controls::VelocityTorqueCurrentFOC const & request)
pure virtual

Request PID to target velocity with torque current feedforward.

This control mode will set the motor's velocity setpoint to the velocity specified by the user. In addition, it will apply an additional torque current as an arbitrary feedforward value.

  • VelocityTorqueCurrentFOC Parameters:
    • Velocity: Velocity to drive toward in rotations per second.
    • Acceleration: Acceleration to drive toward in rotations per second squared. This is typically used for motion profiles generated by the robot program.
    • FeedForward: Feedforward to apply in torque current in Amperes. This is added to the output of the onboard feedforward terms.

      User can use motor's kT to scale Newton-meter to Amperes.

    • Slot: Select which gains are applied by selecting the slot. Use the configuration api to set the gain values for the selected slot before enabling this feature. Slot must be within [0,2].
    • OverrideCoastDurNeutral: Set to true to coast the rotor when output is zero (or within deadband). Set to false to use the NeutralMode configuration setting (default). This flag exists to provide the fundamental behavior of this control when output is zero, which is to provide 0A (zero torque).
    • LimitForwardMotion: Set to true to force forward limiting. This allows users to use other limit switch sensors connected to robot controller. This also allows use of active sensors that require external power.
    • LimitReverseMotion: Set to true to force reverse limiting. This allows users to use other limit switch sensors connected to robot controller. This also allows use of active sensors that require external power.
    • IgnoreHardwareLimits: Set to true to ignore hardware limit switches and the LimitForwardMotion and LimitReverseMotion parameters, instead allowing motion.

      This can be useful on mechanisms such as an intake/feeder, where a limit switch stops motion while intaking but should be ignored when feeding to a shooter.

      The hardware limit faults and Forward/ReverseLimit signals will still report the values of the limit switches regardless of this parameter.

    • IgnoreSoftwareLimits: Set to true to ignore software limits, instead allowing motion.

      This can be useful when calibrating the zero point of a mechanism such as an elevator.

      The software limit faults will still report the values of the software limits regardless of this parameter.

    • UseTimesync: Set to true to delay applying this control request until a timesync boundary (requires Phoenix Pro and CANivore). This eliminates the impact of nondeterministic network delays in exchange for a larger but deterministic control latency.

      This requires setting the ControlTimesyncFreqHz config in MotorOutputConfigs. Additionally, when this is enabled, the UpdateFreqHz of this request should be set to 0 Hz.

Parameters
requestControl object to request of the device
Returns
Status code of the request

Implemented in ctre::phoenix6::hardware::core::CoreTalonFX, and ctre::phoenix6::hardware::traits::CommonTalonWithFOC.


The documentation for this class was generated from the following file: