Table of Contents

Interface SupportsFOC

Namespace
CTRE.Phoenix6.Hardware.Traits
Assembly
Phoenix6.Hardware.dll

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

public interface SupportsFOC : CommonDevice
Inherited Members

Methods

ClearStickyFault_RotorFault1(double)

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.

StatusCode ClearStickyFault_RotorFault1(double timeoutSeconds = 0.1)

Parameters

timeoutSeconds double

Maximum time to wait up to in seconds.

Returns

StatusCode

StatusCode of the set command

ClearStickyFault_RotorFault2(double)

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.

StatusCode ClearStickyFault_RotorFault2(double timeoutSeconds = 0.1)

Parameters

timeoutSeconds double

Maximum time to wait up to in seconds.

Returns

StatusCode

StatusCode of the set command

GetFault_RotorFault1(bool)

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 ValueFalse

This refreshes and returns a cached StatusSignal object.

StatusSignal<bool> GetFault_RotorFault1(bool refresh = true)

Parameters

refresh bool

Whether to refresh the StatusSignal before returning it; defaults to true

Returns

StatusSignal<bool>

Fault_RotorFault1 Status Signal Object

GetFault_RotorFault2(bool)

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 ValueFalse

This refreshes and returns a cached StatusSignal object.

StatusSignal<bool> GetFault_RotorFault2(bool refresh = true)

Parameters

refresh bool

Whether to refresh the StatusSignal before returning it; defaults to true

Returns

StatusSignal<bool>

Fault_RotorFault2 Status Signal Object

GetStickyFault_RotorFault1(bool)

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 ValueFalse

This refreshes and returns a cached StatusSignal object.

StatusSignal<bool> GetStickyFault_RotorFault1(bool refresh = true)

Parameters

refresh bool

Whether to refresh the StatusSignal before returning it; defaults to true

Returns

StatusSignal<bool>

StickyFault_RotorFault1 Status Signal Object

GetStickyFault_RotorFault2(bool)

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 ValueFalse

This refreshes and returns a cached StatusSignal object.

StatusSignal<bool> GetStickyFault_RotorFault2(bool refresh = true)

Parameters

refresh bool

Whether to refresh the StatusSignal before returning it; defaults to true

Returns

StatusSignal<bool>

StickyFault_RotorFault2 Status Signal Object

SetControl(Diff_MotionMagicExpoTorqueCurrentFOC_Open)

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

Diff_MotionMagicExpoTorqueCurrentFOC_Open Parameters

  • AverageRequestAverage MotionMagicExpoTorqueCurrentFOC request of the mechanism.
  • DifferentialRequestDifferential TorqueCurrentFOC request of the mechanism.
StatusCode SetControl(Diff_MotionMagicExpoTorqueCurrentFOC_Open request)

Parameters

request Diff_MotionMagicExpoTorqueCurrentFOC_Open

Control object to request of the device

Returns

StatusCode

Code response of the request

SetControl(Diff_MotionMagicExpoTorqueCurrentFOC_Position)

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

Diff_MotionMagicExpoTorqueCurrentFOC_Position Parameters

  • AverageRequestAverage MotionMagicExpoTorqueCurrentFOC request of the mechanism.
  • DifferentialRequestDifferential PositionTorqueCurrentFOC request of the mechanism.
StatusCode SetControl(Diff_MotionMagicExpoTorqueCurrentFOC_Position request)

Parameters

request Diff_MotionMagicExpoTorqueCurrentFOC_Position

Control object to request of the device

Returns

StatusCode

Code response of the request

SetControl(Diff_MotionMagicExpoTorqueCurrentFOC_Velocity)

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

Diff_MotionMagicExpoTorqueCurrentFOC_Velocity Parameters

  • AverageRequestAverage MotionMagicExpoTorqueCurrentFOC request of the mechanism.
  • DifferentialRequestDifferential VelocityTorqueCurrentFOC request of the mechanism.
StatusCode SetControl(Diff_MotionMagicExpoTorqueCurrentFOC_Velocity request)

Parameters

request Diff_MotionMagicExpoTorqueCurrentFOC_Velocity

Control object to request of the device

Returns

StatusCode

Code response of the request

SetControl(Diff_MotionMagicTorqueCurrentFOC_Open)

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

Diff_MotionMagicTorqueCurrentFOC_Open Parameters

  • AverageRequestAverage MotionMagicTorqueCurrentFOC request of the mechanism.
  • DifferentialRequestDifferential TorqueCurrentFOC request of the mechanism.
StatusCode SetControl(Diff_MotionMagicTorqueCurrentFOC_Open request)

Parameters

request Diff_MotionMagicTorqueCurrentFOC_Open

Control object to request of the device

Returns

StatusCode

Code response of the request

SetControl(Diff_MotionMagicTorqueCurrentFOC_Position)

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

Diff_MotionMagicTorqueCurrentFOC_Position Parameters

  • AverageRequestAverage MotionMagicTorqueCurrentFOC request of the mechanism.
  • DifferentialRequestDifferential PositionTorqueCurrentFOC request of the mechanism.
StatusCode SetControl(Diff_MotionMagicTorqueCurrentFOC_Position request)

Parameters

request Diff_MotionMagicTorqueCurrentFOC_Position

Control object to request of the device

Returns

StatusCode

Code response of the request

SetControl(Diff_MotionMagicTorqueCurrentFOC_Velocity)

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

Diff_MotionMagicTorqueCurrentFOC_Velocity Parameters

  • AverageRequestAverage MotionMagicTorqueCurrentFOC request of the mechanism.
  • DifferentialRequestDifferential VelocityTorqueCurrentFOC request of the mechanism.
StatusCode SetControl(Diff_MotionMagicTorqueCurrentFOC_Velocity request)

Parameters

request Diff_MotionMagicTorqueCurrentFOC_Velocity

Control object to request of the device

Returns

StatusCode

Code response of the request

SetControl(Diff_MotionMagicVelocityTorqueCurrentFOC_Open)

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

Diff_MotionMagicVelocityTorqueCurrentFOC_Open Parameters

  • AverageRequestAverage MotionMagicVelocityTorqueCurrentFOC request of the mechanism.
  • DifferentialRequestDifferential TorqueCurrentFOC request of the mechanism.
StatusCode SetControl(Diff_MotionMagicVelocityTorqueCurrentFOC_Open request)

Parameters

request Diff_MotionMagicVelocityTorqueCurrentFOC_Open

Control object to request of the device

Returns

StatusCode

Code response of the request

SetControl(Diff_MotionMagicVelocityTorqueCurrentFOC_Position)

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

Diff_MotionMagicVelocityTorqueCurrentFOC_Position Parameters

  • AverageRequestAverage MotionMagicVelocityTorqueCurrentFOC request of the mechanism.
  • DifferentialRequestDifferential PositionTorqueCurrentFOC request of the mechanism.
StatusCode SetControl(Diff_MotionMagicVelocityTorqueCurrentFOC_Position request)

Parameters

request Diff_MotionMagicVelocityTorqueCurrentFOC_Position

Control object to request of the device

Returns

StatusCode

Code response of the request

SetControl(Diff_MotionMagicVelocityTorqueCurrentFOC_Velocity)

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

Diff_MotionMagicVelocityTorqueCurrentFOC_Velocity Parameters

  • AverageRequestAverage MotionMagicVelocityTorqueCurrentFOC request of the mechanism.
  • DifferentialRequestDifferential VelocityTorqueCurrentFOC request of the mechanism.
StatusCode SetControl(Diff_MotionMagicVelocityTorqueCurrentFOC_Velocity request)

Parameters

request Diff_MotionMagicVelocityTorqueCurrentFOC_Velocity

Control object to request of the device

Returns

StatusCode

Code response of the request

SetControl(Diff_PositionTorqueCurrentFOC_Open)

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

Diff_PositionTorqueCurrentFOC_Open Parameters

  • AverageRequestAverage PositionTorqueCurrentFOC request of the mechanism.
  • DifferentialRequestDifferential TorqueCurrentFOC request of the mechanism.
StatusCode SetControl(Diff_PositionTorqueCurrentFOC_Open request)

Parameters

request Diff_PositionTorqueCurrentFOC_Open

Control object to request of the device

Returns

StatusCode

Code response of the request

SetControl(Diff_PositionTorqueCurrentFOC_Position)

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

Diff_PositionTorqueCurrentFOC_Position Parameters

  • AverageRequestAverage PositionTorqueCurrentFOC request of the mechanism.
  • DifferentialRequestDifferential PositionTorqueCurrentFOC request of the mechanism.
StatusCode SetControl(Diff_PositionTorqueCurrentFOC_Position request)

Parameters

request Diff_PositionTorqueCurrentFOC_Position

Control object to request of the device

Returns

StatusCode

Code response of the request

SetControl(Diff_PositionTorqueCurrentFOC_Velocity)

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

Diff_PositionTorqueCurrentFOC_Velocity Parameters

  • AverageRequestAverage PositionTorqueCurrentFOC request of the mechanism.
  • DifferentialRequestDifferential VelocityTorqueCurrentFOC request of the mechanism.
StatusCode SetControl(Diff_PositionTorqueCurrentFOC_Velocity request)

Parameters

request Diff_PositionTorqueCurrentFOC_Velocity

Control object to request of the device

Returns

StatusCode

Code response of the request

SetControl(Diff_TorqueCurrentFOC_Open)

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

Diff_TorqueCurrentFOC_Open Parameters

  • AverageRequestAverage TorqueCurrentFOC request of the mechanism.
  • DifferentialRequestDifferential TorqueCurrentFOC request of the mechanism.
StatusCode SetControl(Diff_TorqueCurrentFOC_Open request)

Parameters

request Diff_TorqueCurrentFOC_Open

Control object to request of the device

Returns

StatusCode

Code response of the request

SetControl(Diff_TorqueCurrentFOC_Position)

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

Diff_TorqueCurrentFOC_Position Parameters

  • AverageRequestAverage TorqueCurrentFOC request of the mechanism.
  • DifferentialRequestDifferential PositionTorqueCurrentFOC request of the mechanism.
StatusCode SetControl(Diff_TorqueCurrentFOC_Position request)

Parameters

request Diff_TorqueCurrentFOC_Position

Control object to request of the device

Returns

StatusCode

Code response of the request

SetControl(Diff_TorqueCurrentFOC_Velocity)

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

Diff_TorqueCurrentFOC_Velocity Parameters

  • AverageRequestAverage TorqueCurrentFOC request of the mechanism.
  • DifferentialRequestDifferential VelocityTorqueCurrentFOC request of the mechanism.
StatusCode SetControl(Diff_TorqueCurrentFOC_Velocity request)

Parameters

request Diff_TorqueCurrentFOC_Velocity

Control object to request of the device

Returns

StatusCode

Code response of the request

SetControl(Diff_VelocityTorqueCurrentFOC_Open)

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

Diff_VelocityTorqueCurrentFOC_Open Parameters

  • AverageRequestAverage VelocityTorqueCurrentFOC request of the mechanism.
  • DifferentialRequestDifferential TorqueCurrentFOC request of the mechanism.
StatusCode SetControl(Diff_VelocityTorqueCurrentFOC_Open request)

Parameters

request Diff_VelocityTorqueCurrentFOC_Open

Control object to request of the device

Returns

StatusCode

Code response of the request

SetControl(Diff_VelocityTorqueCurrentFOC_Position)

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

Diff_VelocityTorqueCurrentFOC_Position Parameters

  • AverageRequestAverage VelocityTorqueCurrentFOC request of the mechanism.
  • DifferentialRequestDifferential PositionTorqueCurrentFOC request of the mechanism.
StatusCode SetControl(Diff_VelocityTorqueCurrentFOC_Position request)

Parameters

request Diff_VelocityTorqueCurrentFOC_Position

Control object to request of the device

Returns

StatusCode

Code response of the request

SetControl(Diff_VelocityTorqueCurrentFOC_Velocity)

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

Diff_VelocityTorqueCurrentFOC_Velocity Parameters

  • AverageRequestAverage VelocityTorqueCurrentFOC request of the mechanism.
  • DifferentialRequestDifferential VelocityTorqueCurrentFOC request of the mechanism.
StatusCode SetControl(Diff_VelocityTorqueCurrentFOC_Velocity request)

Parameters

request Diff_VelocityTorqueCurrentFOC_Velocity

Control object to request of the device

Returns

StatusCode

Code response of the request

SetControl(ControlRequest)

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

StatusCode SetControl(ControlRequest request)

Parameters

request ControlRequest

Control object to request of the device

Returns

StatusCode

Status Code of the request, 0 is OK

SetControl(DynamicMotionMagicExpoTorqueCurrentFOC)

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

  • PositionPosition to drive toward in rotations.
  • kVMechanism kV for profiling. Unlike the kV slot gain, this is always in units of V/rps.
                        <p></p>
    
                        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.</li><li><span class="term">kA</span>Mechanism kA for profiling.  Unlike the
                        kA slot gain, this is always in units of V/rps².
    
                        <p></p>
    
                        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.</li><li><span class="term">Velocity</span>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.</li><li><span class="term">FeedForward</span>Feedforward to apply in torque
                                 current in Amperes. This is added to the
                                 output of the onboard feedforward terms.
    
                                 <p></p>
    
                                 User can use motor's kT to scale
                                 Newton-meter to Amperes.</li><li><span class="term">Slot</span>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].</li><li><span class="term">OverrideCoastDurNeutral</span>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).</li><li><span class="term">LimitForwardMotion</span>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.</li><li><span class="term">LimitReverseMotion</span>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.</li><li><span class="term">IgnoreHardwareLimits</span>Set to true to ignore
                                          hardware limit switches and the
                                          LimitForwardMotion and
                                          LimitReverseMotion parameters,
                                          instead allowing motion.
    
                                          <p></p>
    
                                          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.
    
                                          <p></p>
    
                                          The hardware limit faults and
                                          Forward/ReverseLimit signals will
                                          still report the values of the
                                          limit switches regardless of this
                                          parameter.</li><li><span class="term">IgnoreSoftwareLimits</span>Set to true to ignore
                                          software limits, instead allowing
                                          motion.
    
                                          <p></p>
    
                                          This can be useful when
                                          calibrating the zero point of a
                                          mechanism such as an elevator.
    
                                          <p></p>
    
                                          The software limit faults will
                                          still report the values of the
                                          software limits regardless of this
                                          parameter.</li><li><span class="term">UseTimesync</span>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.
    
                                 <p></p>
    
                                 This requires setting the
                                 ControlTimesyncFreqHz config in
                                 MotorOutputConfigs. Additionally, when this
                                 is enabled, the UpdateFreqHz of this
                                 request should be set to 0
                                 Hz.</li></ul>
    
StatusCode SetControl(DynamicMotionMagicExpoTorqueCurrentFOC request)

Parameters

request DynamicMotionMagicExpoTorqueCurrentFOC

Control object to request of the device

Returns

StatusCode

Code response of the request

SetControl(DynamicMotionMagicTorqueCurrentFOC)

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

  • PositionPosition to drive toward in rotations.
  • VelocityCruise velocity for profiling. The signage does not matter as the device will use the absolute value for profile generation.
  • AccelerationAcceleration for profiling. The signage does not matter as the device will use the absolute value for profile generation.
  • JerkJerk for profiling. The signage does not matter as the device will use the absolute value for profile generation.
                          <p></p>
    
                          Jerk is optional; if this is set to zero, then
                          Motion Magic® will not apply a Jerk
                          limit.</li><li><span class="term">FeedForward</span>Feedforward to apply in torque
                                 current in Amperes. This is added to the
                                 output of the onboard feedforward terms.
    
                                 <p></p>
    
                                 User can use motor's kT to scale
                                 Newton-meter to Amperes.</li><li><span class="term">Slot</span>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].</li><li><span class="term">OverrideCoastDurNeutral</span>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).</li><li><span class="term">LimitForwardMotion</span>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.</li><li><span class="term">LimitReverseMotion</span>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.</li><li><span class="term">IgnoreHardwareLimits</span>Set to true to ignore
                                          hardware limit switches and the
                                          LimitForwardMotion and
                                          LimitReverseMotion parameters,
                                          instead allowing motion.
    
                                          <p></p>
    
                                          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.
    
                                          <p></p>
    
                                          The hardware limit faults and
                                          Forward/ReverseLimit signals will
                                          still report the values of the
                                          limit switches regardless of this
                                          parameter.</li><li><span class="term">IgnoreSoftwareLimits</span>Set to true to ignore
                                          software limits, instead allowing
                                          motion.
    
                                          <p></p>
    
                                          This can be useful when
                                          calibrating the zero point of a
                                          mechanism such as an elevator.
    
                                          <p></p>
    
                                          The software limit faults will
                                          still report the values of the
                                          software limits regardless of this
                                          parameter.</li><li><span class="term">UseTimesync</span>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.
    
                                 <p></p>
    
                                 This requires setting the
                                 ControlTimesyncFreqHz config in
                                 MotorOutputConfigs. Additionally, when this
                                 is enabled, the UpdateFreqHz of this
                                 request should be set to 0
                                 Hz.</li></ul>
    
StatusCode SetControl(DynamicMotionMagicTorqueCurrentFOC request)

Parameters

request DynamicMotionMagicTorqueCurrentFOC

Control object to request of the device

Returns

StatusCode

Code response of the request

SetControl(MotionMagicExpoTorqueCurrentFOC)

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

  • PositionPosition to drive toward in rotations.
  • FeedForwardFeedforward to apply in torque current in Amperes. This is added to the output of the onboard feedforward terms.
                                 <p></p>
    
                                 User can use motor's kT to scale
                                 Newton-meter to Amperes.</li><li><span class="term">Slot</span>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].</li><li><span class="term">OverrideCoastDurNeutral</span>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).</li><li><span class="term">LimitForwardMotion</span>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.</li><li><span class="term">LimitReverseMotion</span>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.</li><li><span class="term">IgnoreHardwareLimits</span>Set to true to ignore
                                          hardware limit switches and the
                                          LimitForwardMotion and
                                          LimitReverseMotion parameters,
                                          instead allowing motion.
    
                                          <p></p>
    
                                          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.
    
                                          <p></p>
    
                                          The hardware limit faults and
                                          Forward/ReverseLimit signals will
                                          still report the values of the
                                          limit switches regardless of this
                                          parameter.</li><li><span class="term">IgnoreSoftwareLimits</span>Set to true to ignore
                                          software limits, instead allowing
                                          motion.
    
                                          <p></p>
    
                                          This can be useful when
                                          calibrating the zero point of a
                                          mechanism such as an elevator.
    
                                          <p></p>
    
                                          The software limit faults will
                                          still report the values of the
                                          software limits regardless of this
                                          parameter.</li><li><span class="term">UseTimesync</span>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.
    
                                 <p></p>
    
                                 This requires setting the
                                 ControlTimesyncFreqHz config in
                                 MotorOutputConfigs. Additionally, when this
                                 is enabled, the UpdateFreqHz of this
                                 request should be set to 0
                                 Hz.</li></ul>
    
StatusCode SetControl(MotionMagicExpoTorqueCurrentFOC request)

Parameters

request MotionMagicExpoTorqueCurrentFOC

Control object to request of the device

Returns

StatusCode

Code response of the request

SetControl(MotionMagicTorqueCurrentFOC)

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

  • PositionPosition to drive toward in rotations.
  • FeedForwardFeedforward to apply in torque current in Amperes. This is added to the output of the onboard feedforward terms.
                                 <p></p>
    
                                 User can use motor's kT to scale
                                 Newton-meter to Amperes.</li><li><span class="term">Slot</span>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].</li><li><span class="term">OverrideCoastDurNeutral</span>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).</li><li><span class="term">LimitForwardMotion</span>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.</li><li><span class="term">LimitReverseMotion</span>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.</li><li><span class="term">IgnoreHardwareLimits</span>Set to true to ignore
                                          hardware limit switches and the
                                          LimitForwardMotion and
                                          LimitReverseMotion parameters,
                                          instead allowing motion.
    
                                          <p></p>
    
                                          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.
    
                                          <p></p>
    
                                          The hardware limit faults and
                                          Forward/ReverseLimit signals will
                                          still report the values of the
                                          limit switches regardless of this
                                          parameter.</li><li><span class="term">IgnoreSoftwareLimits</span>Set to true to ignore
                                          software limits, instead allowing
                                          motion.
    
                                          <p></p>
    
                                          This can be useful when
                                          calibrating the zero point of a
                                          mechanism such as an elevator.
    
                                          <p></p>
    
                                          The software limit faults will
                                          still report the values of the
                                          software limits regardless of this
                                          parameter.</li><li><span class="term">UseTimesync</span>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.
    
                                 <p></p>
    
                                 This requires setting the
                                 ControlTimesyncFreqHz config in
                                 MotorOutputConfigs. Additionally, when this
                                 is enabled, the UpdateFreqHz of this
                                 request should be set to 0
                                 Hz.</li></ul>
    
StatusCode SetControl(MotionMagicTorqueCurrentFOC request)

Parameters

request MotionMagicTorqueCurrentFOC

Control object to request of the device

Returns

StatusCode

Code response of the request

SetControl(MotionMagicVelocityTorqueCurrentFOC)

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

  • VelocityTarget velocity to drive toward in rotations per second. This can be changed on-the fly.
  • AccelerationThis 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.
  • FeedForwardFeedforward to apply in torque current in Amperes. This is added to the output of the onboard feedforward terms.
                                 <p></p>
    
                                 User can use motor's kT to scale
                                 Newton-meter to Amperes.</li><li><span class="term">Slot</span>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].</li><li><span class="term">OverrideCoastDurNeutral</span>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).</li><li><span class="term">LimitForwardMotion</span>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.</li><li><span class="term">LimitReverseMotion</span>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.</li><li><span class="term">IgnoreHardwareLimits</span>Set to true to ignore
                                          hardware limit switches and the
                                          LimitForwardMotion and
                                          LimitReverseMotion parameters,
                                          instead allowing motion.
    
                                          <p></p>
    
                                          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.
    
                                          <p></p>
    
                                          The hardware limit faults and
                                          Forward/ReverseLimit signals will
                                          still report the values of the
                                          limit switches regardless of this
                                          parameter.</li><li><span class="term">IgnoreSoftwareLimits</span>Set to true to ignore
                                          software limits, instead allowing
                                          motion.
    
                                          <p></p>
    
                                          This can be useful when
                                          calibrating the zero point of a
                                          mechanism such as an elevator.
    
                                          <p></p>
    
                                          The software limit faults will
                                          still report the values of the
                                          software limits regardless of this
                                          parameter.</li><li><span class="term">UseTimesync</span>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.
    
                                 <p></p>
    
                                 This requires setting the
                                 ControlTimesyncFreqHz config in
                                 MotorOutputConfigs. Additionally, when this
                                 is enabled, the UpdateFreqHz of this
                                 request should be set to 0
                                 Hz.</li></ul>
    
StatusCode SetControl(MotionMagicVelocityTorqueCurrentFOC request)

Parameters

request MotionMagicVelocityTorqueCurrentFOC

Control object to request of the device

Returns

StatusCode

Code response of the request

SetControl(PositionTorqueCurrentFOC)

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

  • PositionPosition to drive toward in rotations.
  • VelocityVelocity to drive toward in rotations per second. This is typically used for motion profiles generated by the robot program.
  • FeedForwardFeedforward to apply in torque current in Amperes. This is added to the output of the onboard feedforward terms.
                                 <p></p>
    
                                 User can use motor's kT to scale
                                 Newton-meter to Amperes.</li><li><span class="term">Slot</span>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].</li><li><span class="term">OverrideCoastDurNeutral</span>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).</li><li><span class="term">LimitForwardMotion</span>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.</li><li><span class="term">LimitReverseMotion</span>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.</li><li><span class="term">IgnoreHardwareLimits</span>Set to true to ignore
                                          hardware limit switches and the
                                          LimitForwardMotion and
                                          LimitReverseMotion parameters,
                                          instead allowing motion.
    
                                          <p></p>
    
                                          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.
    
                                          <p></p>
    
                                          The hardware limit faults and
                                          Forward/ReverseLimit signals will
                                          still report the values of the
                                          limit switches regardless of this
                                          parameter.</li><li><span class="term">IgnoreSoftwareLimits</span>Set to true to ignore
                                          software limits, instead allowing
                                          motion.
    
                                          <p></p>
    
                                          This can be useful when
                                          calibrating the zero point of a
                                          mechanism such as an elevator.
    
                                          <p></p>
    
                                          The software limit faults will
                                          still report the values of the
                                          software limits regardless of this
                                          parameter.</li><li><span class="term">UseTimesync</span>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.
    
                                 <p></p>
    
                                 This requires setting the
                                 ControlTimesyncFreqHz config in
                                 MotorOutputConfigs. Additionally, when this
                                 is enabled, the UpdateFreqHz of this
                                 request should be set to 0
                                 Hz.</li></ul>
    
StatusCode SetControl(PositionTorqueCurrentFOC request)

Parameters

request PositionTorqueCurrentFOC

Control object to request of the device

Returns

StatusCode

Code response of the request

SetControl(TorqueCurrentFOC)

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

  • OutputAmount of motor current in Amperes
  • MaxAbsDutyCycleThe 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.
  • DeadbandDeadband 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.
  • OverrideCoastDurNeutralSet 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).
  • LimitForwardMotionSet 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.
  • LimitReverseMotionSet 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.
  • IgnoreHardwareLimitsSet to true to ignore hardware limit switches and the LimitForwardMotion and LimitReverseMotion parameters, instead allowing motion.
                                          <p></p>
    
                                          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.
    
                                          <p></p>
    
                                          The hardware limit faults and
                                          Forward/ReverseLimit signals will
                                          still report the values of the
                                          limit switches regardless of this
                                          parameter.</li><li><span class="term">IgnoreSoftwareLimits</span>Set to true to ignore
                                          software limits, instead allowing
                                          motion.
    
                                          <p></p>
    
                                          This can be useful when
                                          calibrating the zero point of a
                                          mechanism such as an elevator.
    
                                          <p></p>
    
                                          The software limit faults will
                                          still report the values of the
                                          software limits regardless of this
                                          parameter.</li><li><span class="term">UseTimesync</span>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.
    
                                 <p></p>
    
                                 This requires setting the
                                 ControlTimesyncFreqHz config in
                                 MotorOutputConfigs. Additionally, when this
                                 is enabled, the UpdateFreqHz of this
                                 request should be set to 0
                                 Hz.</li></ul>
    
StatusCode SetControl(TorqueCurrentFOC request)

Parameters

request TorqueCurrentFOC

Control object to request of the device

Returns

StatusCode

Code response of the request

SetControl(VelocityTorqueCurrentFOC)

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

  • VelocityVelocity to drive toward in rotations per second.
  • AccelerationAcceleration to drive toward in rotations per second squared. This is typically used for motion profiles generated by the robot program.
  • FeedForwardFeedforward to apply in torque current in Amperes. This is added to the output of the onboard feedforward terms.
                                 <p></p>
    
                                 User can use motor's kT to scale
                                 Newton-meter to Amperes.</li><li><span class="term">Slot</span>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].</li><li><span class="term">OverrideCoastDurNeutral</span>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).</li><li><span class="term">LimitForwardMotion</span>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.</li><li><span class="term">LimitReverseMotion</span>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.</li><li><span class="term">IgnoreHardwareLimits</span>Set to true to ignore
                                          hardware limit switches and the
                                          LimitForwardMotion and
                                          LimitReverseMotion parameters,
                                          instead allowing motion.
    
                                          <p></p>
    
                                          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.
    
                                          <p></p>
    
                                          The hardware limit faults and
                                          Forward/ReverseLimit signals will
                                          still report the values of the
                                          limit switches regardless of this
                                          parameter.</li><li><span class="term">IgnoreSoftwareLimits</span>Set to true to ignore
                                          software limits, instead allowing
                                          motion.
    
                                          <p></p>
    
                                          This can be useful when
                                          calibrating the zero point of a
                                          mechanism such as an elevator.
    
                                          <p></p>
    
                                          The software limit faults will
                                          still report the values of the
                                          software limits regardless of this
                                          parameter.</li><li><span class="term">UseTimesync</span>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.
    
                                 <p></p>
    
                                 This requires setting the
                                 ControlTimesyncFreqHz config in
                                 MotorOutputConfigs. Additionally, when this
                                 is enabled, the UpdateFreqHz of this
                                 request should be set to 0
                                 Hz.</li></ul>
    
StatusCode SetControl(VelocityTorqueCurrentFOC request)

Parameters

request VelocityTorqueCurrentFOC

Control object to request of the device

Returns

StatusCode

Code response of the request