Class CoreTalonFX

Direct Known Subclasses:
TalonFX

public class CoreTalonFX
extends ParentDevice
Class description for the Talon FX integrated motor controller that runs on associated Falcon motors.
  • Constructor Details

    • CoreTalonFX

      public CoreTalonFX​(int deviceId)
      Constructs a new Talon FX motor controller object.

      Constructs the device using the default CAN bus for the system:

      • "rio" on roboRIO
      • "can0" on Linux
      • "*" on Windows
      Parameters:
      deviceId - ID of the device, as configured in Phoenix Tuner.
    • CoreTalonFX

      public CoreTalonFX​(int deviceId, String canbus)
      Constructs a new Talon FX motor controller object.
      Parameters:
      deviceId - ID of the device, as configured in Phoenix Tuner.
      canbus - Name of the CAN bus this device is on. Possible CAN bus strings are:
      • "rio" for the native roboRIO CAN bus
      • CANivore name or serial number
      • SocketCAN interface (non-FRC Linux only)
      • "*" for any CANivore seen by the program
      • empty string (default) to select the default for the system:
        • "rio" on roboRIO
        • "can0" on Linux
        • "*" on Windows
  • Method Details

    • reportIfTooOld

      protected void reportIfTooOld()
      Specified by:
      reportIfTooOld in class ParentDevice
    • hasResetOccurred

      public boolean hasResetOccurred()
      Returns:
      true if device has reset since the previous call of this routine.
    • getConfigurator

      Gets the configurator to use with this device's configs
      Returns:
      Configurator for this object
    • getSimState

      Get the simulation state for this device.

      This function reuses an allocated simulation state object, so it is safe to call this function multiple times in a robot loop.

      Returns:
      Simulation state
    • getVersionMajor

      App Major Version number.
      • Minimum Value: 0
      • Maximum Value: 255
      • Default Value: 0
      • Units:
      Default Rates:
      • CAN: 4.0 Hz
      Returns:
      VersionMajor Status Signal Value object
    • getVersionMinor

      App Minor Version number.
      • Minimum Value: 0
      • Maximum Value: 255
      • Default Value: 0
      • Units:
      Default Rates:
      • CAN: 4.0 Hz
      Returns:
      VersionMinor Status Signal Value object
    • getVersionBugfix

      App Bugfix Version number.
      • Minimum Value: 0
      • Maximum Value: 255
      • Default Value: 0
      • Units:
      Default Rates:
      • CAN: 4.0 Hz
      Returns:
      VersionBugfix Status Signal Value object
    • getVersionBuild

      App Build Version number.
      • Minimum Value: 0
      • Maximum Value: 255
      • Default Value: 0
      • Units:
      Default Rates:
      • CAN: 4.0 Hz
      Returns:
      VersionBuild Status Signal Value object
    • getVersion

      Full Version. The format is a four byte value.

      Full Version of firmware in device. The format is a four byte value.

      • Minimum Value: 0
      • Maximum Value: 4294967295
      • Default Value: 0
      • Units:
      Default Rates:
      • CAN: 4.0 Hz
      Returns:
      Version Status Signal Value object
    • getFaultField

      Integer representing all faults

      This returns the fault flags reported by the device. These are device specific and are not used directly in typical applications. Use the signal specific GetFault_*() methods instead.

      • Minimum Value: 0
      • Maximum Value: 1048575
      • Default Value: 0
      • Units:
      Default Rates:
      • CAN: 4.0 Hz
      Returns:
      FaultField Status Signal Value object
    • getStickyFaultField

      Integer representing all sticky faults

      This returns the persistent "sticky" fault flags reported by the device. These are device specific and are not used directly in typical applications. Use the signal specific GetStickyFault_*() methods instead.

      • Minimum Value: 0
      • Maximum Value: 1048575
      • Default Value: 0
      • Units:
      Default Rates:
      • CAN: 4.0 Hz
      Returns:
      StickyFaultField Status Signal Value object
    • getForwardLimit

      Forward Limit Pin. Default Rates:
      • CAN: 100.0 Hz
      Returns:
      ForwardLimit Status Signal Value object
    • getReverseLimit

      Reverse Limit Pin. Default Rates:
      • CAN: 100.0 Hz
      Returns:
      ReverseLimit Status Signal Value object
    • getAppliedRotorPolarity

      The applied rotor polarity. This typically is determined by the Inverted config, but can be overridden if using Follower features. Default Rates:
      • CAN: 100.0 Hz
      Returns:
      AppliedRotorPolarity Status Signal Value object
    • getDutyCycle

      The applied motor duty cycle.
      • Minimum Value: -2.0
      • Maximum Value: 1.9990234375
      • Default Value: 0
      • Units: fractional
      Default Rates:
      • CAN: 100.0 Hz
      Returns:
      DutyCycle Status Signal Value object
    • getTorqueCurrent

      Current corresponding to the torque output by the motor. Similar to StatorCurrent. Users will likely prefer this current to calculate the applied torque to the rotor.

      Stator current where positive current means torque is applied in the forward direction as determined by the Inverted setting

      • Minimum Value: -327.68
      • Maximum Value: 327.67
      • Default Value: 0
      • Units: A
      Default Rates:
      • CAN: 100.0 Hz
      Returns:
      TorqueCurrent Status Signal Value object
    • getStatorCurrent

      Current corresponding to the stator windings. Similar to TorqueCurrent. Users will likely prefer TorqueCurrent over StatorCurrent.

      Stator current where Positive current indicates motoring regardless of direction. Negative current indicates regenerative braking regardless of direction.

      • Minimum Value: -327.68
      • Maximum Value: 327.67
      • Default Value: 0
      • Units: A
      Default Rates:
      • CAN 2.0: 5.0 Hz
      • CAN FD: 100.0 Hz
      Returns:
      StatorCurrent Status Signal Value object
    • getSupplyCurrent

      Measured supply side current
      • Minimum Value: -327.68
      • Maximum Value: 327.67
      • Default Value: 0
      • Units: A
      Default Rates:
      • CAN 2.0: 5.0 Hz
      • CAN FD: 100.0 Hz
      Returns:
      SupplyCurrent Status Signal Value object
    • getSupplyVoltage

      Measured supply voltage to the TalonFX.
      • Minimum Value: 4.0
      • Maximum Value: 16.75
      • Default Value: 4
      • Units: V
      Default Rates:
      • CAN 2.0: 5.0 Hz
      • CAN FD: 100.0 Hz
      Returns:
      SupplyVoltage Status Signal Value object
    • getDeviceTemp

      Temperature of device

      This is the temperature that the device measures itself to be at. Similar to Processor Temperature.

      • Minimum Value: 0.0
      • Maximum Value: 255.0
      • Default Value: 0
      • Units:
      Default Rates:
      • CAN 2.0: 5.0 Hz
      • CAN FD: 100.0 Hz
      Returns:
      DeviceTemp Status Signal Value object
    • getProcessorTemp

      Temperature of the processor

      This is the temperature that the processor measures itself to be at. Similar to Device Temperature.

      • Minimum Value: 0.0
      • Maximum Value: 255.0
      • Default Value: 0
      • Units:
      Default Rates:
      • CAN 2.0: 5.0 Hz
      • CAN FD: 100.0 Hz
      Returns:
      ProcessorTemp Status Signal Value object
    • getRotorVelocity

      Velocity of motor rotor.
      • Minimum Value: -512.0
      • Maximum Value: 511.998046875
      • Default Value: 0
      • Units: rotations per second
      Default Rates:
      • CAN 2.0: 5.0 Hz
      • CAN FD: 100.0 Hz
      Returns:
      RotorVelocity Status Signal Value object
    • getRotorPosition

      Position of motor rotor.
      • Minimum Value: -16384.0
      • Maximum Value: 16383.999755859375
      • Default Value: 0
      • Units: rotations
      Default Rates:
      • CAN 2.0: 5.0 Hz
      • CAN FD: 100.0 Hz
      Returns:
      RotorPosition Status Signal Value object
    • getVelocity

      Velocity of device.
      • Minimum Value: -512.0
      • Maximum Value: 511.998046875
      • Default Value: 0
      • Units: rotations per second
      Default Rates:
      • CAN 2.0: 50.0 Hz
      • CAN FD: 100.0 Hz
      Returns:
      Velocity Status Signal Value object
    • getPosition

      Position of device.
      • Minimum Value: -16384.0
      • Maximum Value: 16383.999755859375
      • Default Value: 0
      • Units: rotations
      Default Rates:
      • CAN 2.0: 50.0 Hz
      • CAN FD: 100.0 Hz
      Returns:
      Position Status Signal Value object
    • getControlMode

      The active control mode of the motor controller Default Rates:
      • CAN 2.0: 5.0 Hz
      • CAN FD: 100.0 Hz
      Returns:
      ControlMode Status Signal Value object
    • getMotionMagicIsRunning

      Check if Motion Magic® is running. This is equivalent to checking that the reported control mode is a Motion Magic® based mode. Default Rates:
      • CAN 2.0: 5.0 Hz
      • CAN FD: 100.0 Hz
      Returns:
      MotionMagicIsRunning Status Signal Value object
    • getDeviceEnable

      Indicates if device is actuator enabled. Default Rates:
      • CAN 2.0: 5.0 Hz
      • CAN FD: 100.0 Hz
      Returns:
      DeviceEnable Status Signal Value object
    • getClosedLoopSlot

      Closed loop slot in use

      This is the slot that the closed loop PID is using.

      • Minimum Value: 0
      • Maximum Value: 2
      • Default Value: 0
      • Units:
      Default Rates:
      • CAN 2.0: 5.0 Hz
      • CAN FD: 100.0 Hz
      Returns:
      ClosedLoopSlot Status Signal Value object
    • getBridgeOuput

      The applied output of the bridge. Default Rates:
      • CAN: 100.0 Hz
      Returns:
      BridgeOuput Status Signal Value object
    • getFault_Hardware

      Hardware fault occurred
      • Default Value: False
      Default Rates:
      • CAN: 4.0 Hz
      Returns:
      Fault_Hardware Status Signal Value object
    • getStickyFault_Hardware

      Hardware fault occurred
      • Default Value: False
      Default Rates:
      • CAN: 4.0 Hz
      Returns:
      StickyFault_Hardware Status Signal Value object
    • getFault_ProcTemp

      Processor temperature exceeded limit
      • Default Value: False
      Default Rates:
      • CAN: 4.0 Hz
      Returns:
      Fault_ProcTemp Status Signal Value object
    • getStickyFault_ProcTemp

      Processor temperature exceeded limit
      • Default Value: False
      Default Rates:
      • CAN: 4.0 Hz
      Returns:
      StickyFault_ProcTemp Status Signal Value object
    • getFault_DeviceTemp

      Device temperature exceeded limit
      • Default Value: False
      Default Rates:
      • CAN: 4.0 Hz
      Returns:
      Fault_DeviceTemp Status Signal Value object
    • getStickyFault_DeviceTemp

      Device temperature exceeded limit
      • Default Value: False
      Default Rates:
      • CAN: 4.0 Hz
      Returns:
      StickyFault_DeviceTemp Status Signal Value object
    • getFault_Undervoltage

      Device supply voltage dropped to near brownout levels
      • Default Value: False
      Default Rates:
      • CAN: 4.0 Hz
      Returns:
      Fault_Undervoltage Status Signal Value object
    • getStickyFault_Undervoltage

      Device supply voltage dropped to near brownout levels
      • Default Value: False
      Default Rates:
      • CAN: 4.0 Hz
      Returns:
      StickyFault_Undervoltage Status Signal Value object
    • getFault_BootDuringEnable

      Device boot while detecting the enable signal
      • Default Value: False
      Default Rates:
      • CAN: 4.0 Hz
      Returns:
      Fault_BootDuringEnable Status Signal Value object
    • getStickyFault_BootDuringEnable

      Device boot while detecting the enable signal
      • Default Value: False
      Default Rates:
      • CAN: 4.0 Hz
      Returns:
      StickyFault_BootDuringEnable Status Signal Value object
    • getFault_OverSupplyV

      Supply Voltage has exceeded the maximum voltage rating of device.
      • Default Value: False
      Default Rates:
      • CAN: 4.0 Hz
      Returns:
      Fault_OverSupplyV Status Signal Value object
    • getStickyFault_OverSupplyV

      Supply Voltage has exceeded the maximum voltage rating of device.
      • Default Value: False
      Default Rates:
      • CAN: 4.0 Hz
      Returns:
      StickyFault_OverSupplyV Status Signal Value object
    • getFault_UnstableSupplyV

      Supply Voltage is unstable. Ensure you are using a battery and current limited power supply.
      • Default Value: False
      Default Rates:
      • CAN: 4.0 Hz
      Returns:
      Fault_UnstableSupplyV Status Signal Value object
    • getStickyFault_UnstableSupplyV

      Supply Voltage is unstable. Ensure you are using a battery and current limited power supply.
      • Default Value: False
      Default Rates:
      • CAN: 4.0 Hz
      Returns:
      StickyFault_UnstableSupplyV Status Signal Value object
    • getFault_ReverseHardLimit

      Reverse limit switch has been asserted. Output is set to neutral.
      • Default Value: False
      Default Rates:
      • CAN: 4.0 Hz
      Returns:
      Fault_ReverseHardLimit Status Signal Value object
    • getStickyFault_ReverseHardLimit

      Reverse limit switch has been asserted. Output is set to neutral.
      • Default Value: False
      Default Rates:
      • CAN: 4.0 Hz
      Returns:
      StickyFault_ReverseHardLimit Status Signal Value object
    • getFault_ForwardHardLimit

      Forward limit switch has been asserted. Output is set to neutral.
      • Default Value: False
      Default Rates:
      • CAN: 4.0 Hz
      Returns:
      Fault_ForwardHardLimit Status Signal Value object
    • getStickyFault_ForwardHardLimit

      Forward limit switch has been asserted. Output is set to neutral.
      • Default Value: False
      Default Rates:
      • CAN: 4.0 Hz
      Returns:
      StickyFault_ForwardHardLimit Status Signal Value object
    • getFault_ReverseSoftLimit

      Reverse soft limit has been asserted. Output is set to neutral.
      • Default Value: False
      Default Rates:
      • CAN: 4.0 Hz
      Returns:
      Fault_ReverseSoftLimit Status Signal Value object
    • getStickyFault_ReverseSoftLimit

      Reverse soft limit has been asserted. Output is set to neutral.
      • Default Value: False
      Default Rates:
      • CAN: 4.0 Hz
      Returns:
      StickyFault_ReverseSoftLimit Status Signal Value object
    • getFault_ForwardSoftLimit

      Forward soft limit has been asserted. Output is set to neutral.
      • Default Value: False
      Default Rates:
      • CAN: 4.0 Hz
      Returns:
      Fault_ForwardSoftLimit Status Signal Value object
    • getStickyFault_ForwardSoftLimit

      Forward soft limit has been asserted. Output is set to neutral.
      • Default Value: False
      Default Rates:
      • CAN: 4.0 Hz
      Returns:
      StickyFault_ForwardSoftLimit Status Signal Value object
    • getFault_MissingRemoteSensor

      The remote sensor is not present on CAN Bus.
      • Default Value: False
      Default Rates:
      • CAN: 4.0 Hz
      Returns:
      Fault_MissingRemoteSensor Status Signal Value object
    • getStickyFault_MissingRemoteSensor

      The remote sensor is not present on CAN Bus.
      • Default Value: False
      Default Rates:
      • CAN: 4.0 Hz
      Returns:
      StickyFault_MissingRemoteSensor Status Signal Value object
    • getFault_FusedSensorOutOfSync

      The remote sensor used for fusion has fallen out of sync to the local sensor. A re-synchronization has occurred, which may cause a discontinuity. This typically happens if there is significant slop in the mechanism, or if the RotorToSensorRatio configuration parameter is incorrect.
      • Default Value: False
      Default Rates:
      • CAN: 4.0 Hz
      Returns:
      Fault_FusedSensorOutOfSync Status Signal Value object
    • getStickyFault_FusedSensorOutOfSync

      The remote sensor used for fusion has fallen out of sync to the local sensor. A re-synchronization has occurred, which may cause a discontinuity. This typically happens if there is significant slop in the mechanism, or if the RotorToSensorRatio configuration parameter is incorrect.
      • Default Value: False
      Default Rates:
      • CAN: 4.0 Hz
      Returns:
      StickyFault_FusedSensorOutOfSync Status Signal Value object
    • getFault_StatorCurrLimit

      Stator current limit occured.
      • Default Value: False
      Default Rates:
      • CAN: 4.0 Hz
      Returns:
      Fault_StatorCurrLimit Status Signal Value object
    • getStickyFault_StatorCurrLimit

      Stator current limit occured.
      • Default Value: False
      Default Rates:
      • CAN: 4.0 Hz
      Returns:
      StickyFault_StatorCurrLimit Status Signal Value object
    • getFault_SupplyCurrLimit

      Supply current limit occured.
      • Default Value: False
      Default Rates:
      • CAN: 4.0 Hz
      Returns:
      Fault_SupplyCurrLimit Status Signal Value object
    • getStickyFault_SupplyCurrLimit

      Supply current limit occured.
      • Default Value: False
      Default Rates:
      • CAN: 4.0 Hz
      Returns:
      StickyFault_SupplyCurrLimit Status Signal Value object
    • getClosedLoopProportionalOutput

      Closed loop proportional component

      The portion of the closed loop output that is the proportional to the error. Alternatively, the p-Contribution of the closed loop output. Default Rates:

      • CAN 2.0: 5.0 Hz
      • CAN FD: 100.0 Hz
      Returns:
      ClosedLoopProportionalOutput Status Signal Value object
    • getClosedLoopIntegratedOutput

      Closed loop integrated component

      The portion of the closed loop output that is proportional to the integrated error. Alternatively, the i-Contribution of the closed loop output. Default Rates:

      • CAN 2.0: 5.0 Hz
      • CAN FD: 100.0 Hz
      Returns:
      ClosedLoopIntegratedOutput Status Signal Value object
    • getClosedLoopFeedForward

      Feed Forward passed by the user

      This is the general feed forward that the user provides for the closed loop. Default Rates:

      • CAN 2.0: 5.0 Hz
      • CAN FD: 100.0 Hz
      Returns:
      ClosedLoopFeedForward Status Signal Value object
    • getClosedLoopDerivativeOutput

      Closed loop derivative component

      The portion of the closed loop output that is the proportional to the deriviative the error. Alternatively, the d-Contribution of the closed loop output. Default Rates:

      • CAN 2.0: 5.0 Hz
      • CAN FD: 100.0 Hz
      Returns:
      ClosedLoopDerivativeOutput Status Signal Value object
    • getClosedLoopOutput

      Closed loop total output

      The total output of the closed loop output. Default Rates:

      • CAN 2.0: 5.0 Hz
      • CAN FD: 100.0 Hz
      Returns:
      ClosedLoopOutput Status Signal Value object
    • getClosedLoopReference

      Value that the closed loop is targeting

      This is the value that the closed loop PID controller targets. Default Rates:

      • CAN 2.0: 5.0 Hz
      • CAN FD: 100.0 Hz
      Returns:
      ClosedLoopReference Status Signal Value object
    • getClosedLoopReferenceSlope

      Derivative of the target that the closed loop is targeting

      This is the change in the closed loop reference. This may be used in the feed-forward calculation, the derivative-error, or in application of the signage for kS. Typically, this represents the target velocity during Motion Magic®. Default Rates:

      • CAN 2.0: 5.0 Hz
      • CAN FD: 100.0 Hz
      Returns:
      ClosedLoopReferenceSlope Status Signal Value object
    • getClosedLoopError

      The difference between target reference and current measurement

      This is the value that is treated as the error in the PID loop. Default Rates:

      • CAN 2.0: 5.0 Hz
      • CAN FD: 100.0 Hz
      Returns:
      ClosedLoopError Status Signal Value object
    • setControl

      public StatusCode setControl​(DutyCycleOut request)
      Request a specified motor duty cycle.

      This control mode will output a proportion of the supplied voltage which is supplied by the user.

      • DutyCycleOut Parameters:
        • Output: Proportion of supply voltage to apply in fractional units between -1 and +1
        • EnableFOC: Set to true to use FOC commutation, which increases peak power by ~15%. Set to false to use trapezoidal commutation. FOC improves motor performance by leveraging torque (current) control. However, this may be inconvenient for applications that require specifying duty cycle or voltage. CTR-Electronics has developed a hybrid method that combines the performances gains of FOC while still allowing applications to provide duty cycle or voltage demand. This not to be confused with simple sinusoidal control or phase voltage control which lacks the performance gains.
        • OverrideBrakeDurNeutral: Set to true to static-brake 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 0V to the motor.
      Parameters:
      request - Control object to request of the device
      Returns:
      Code response of the request
    • setControl

      public StatusCode setControl​(TorqueCurrentFOC request)
      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).
      Parameters:
      request - Control object to request of the device
      Returns:
      Code response of the request
    • setControl

      public StatusCode setControl​(VoltageOut request)
      Request a specified voltage.

      This control mode will attempt to apply the specified voltage to the motor. If the supply voltage is below the requested voltage, the motor controller will output the supply voltage.

      • VoltageOut Parameters:
        • Output: Voltage to attempt to drive at
        • EnableFOC: Set to true to use FOC commutation, which increases peak power by ~15%. Set to false to use trapezoidal commutation. FOC improves motor performance by leveraging torque (current) control. However, this may be inconvenient for applications that require specifying duty cycle or voltage. CTR-Electronics has developed a hybrid method that combines the performances gains of FOC while still allowing applications to provide duty cycle or voltage demand. This not to be confused with simple sinusoidal control or phase voltage control which lacks the performance gains.
        • OverrideBrakeDurNeutral: Set to true to static-brake 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 0V to the motor.
      Parameters:
      request - Control object to request of the device
      Returns:
      Code response of the request
    • setControl

      Request PID to target position with duty cycle 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 duty cycle as an arbitrary feedforward value.

      • PositionDutyCycle Parameters:
        • Position: Position to drive toward in rotations.
        • EnableFOC: Set to true to use FOC commutation, which increases peak power by ~15%. Set to false to use trapezoidal commutation. FOC improves motor performance by leveraging torque (current) control. However, this may be inconvenient for applications that require specifying duty cycle or voltage. CTR-Electronics has developed a hybrid method that combines the performances gains of FOC while still allowing applications to provide duty cycle or voltage demand. This not to be confused with simple sinusoidal control or phase voltage control which lacks the performance gains.
        • FeedForward: Feedforward to apply in fractional units between -1 and +1.
        • 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].
        • OverrideBrakeDurNeutral: Set to true to static-brake 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 0V to the motor.
      Parameters:
      request - Control object to request of the device
      Returns:
      Code response of the request
    • setControl

      public StatusCode setControl​(PositionVoltage request)
      Request PID to target position with voltage 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 voltage as an arbitrary feedforward value.

      • PositionVoltage Parameters:
        • Position: Position to drive toward in rotations.
        • EnableFOC: Set to true to use FOC commutation, which increases peak power by ~15%. Set to false to use trapezoidal commutation. FOC improves motor performance by leveraging torque (current) control. However, this may be inconvenient for applications that require specifying duty cycle or voltage. CTR-Electronics has developed a hybrid method that combines the performances gains of FOC while still allowing applications to provide duty cycle or voltage demand. This not to be confused with simple sinusoidal control or phase voltage control which lacks the performance gains.
        • FeedForward: Feedforward to apply in volts
        • 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].
        • OverrideBrakeDurNeutral: Set to true to static-brake 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 0V to the motor.
      Parameters:
      request - Control object to request of the device
      Returns:
      Code response of the request
    • setControl

      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.
        • FeedForward: Feedforward to apply in torque current in Amperes. 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).
      Parameters:
      request - Control object to request of the device
      Returns:
      Code response of the request
    • setControl

      Request PID to target velocity with duty cycle 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 voltage as an arbitrary feedforward value.

      • VelocityDutyCycle Parameters:
        • Velocity: Velocity to drive toward in rotations per second.
        • EnableFOC: Set to true to use FOC commutation, which increases peak power by ~15%. Set to false to use trapezoidal commutation. FOC improves motor performance by leveraging torque (current) control. However, this may be inconvenient for applications that require specifying duty cycle or voltage. CTR-Electronics has developed a hybrid method that combines the performances gains of FOC while still allowing applications to provide duty cycle or voltage demand. This not to be confused with simple sinusoidal control or phase voltage control which lacks the performance gains.
        • FeedForward: Feedforward to apply in fractional units between -1 and +1.
        • 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].
        • OverrideBrakeDurNeutral: Set to true to static-brake 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 0V to the motor.
      Parameters:
      request - Control object to request of the device
      Returns:
      Code response of the request
    • setControl

      public StatusCode setControl​(VelocityVoltage request)
      Request PID to target velocity with voltage 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 voltage as an arbitrary feedforward value.

      • VelocityVoltage Parameters:
        • Velocity: Velocity to drive toward in rotations per second.
        • EnableFOC: Set to true to use FOC commutation, which increases peak power by ~15%. Set to false to use trapezoidal commutation. FOC improves motor performance by leveraging torque (current) control. However, this may be inconvenient for applications that require specifying duty cycle or voltage. CTR-Electronics has developed a hybrid method that combines the performances gains of FOC while still allowing applications to provide duty cycle or voltage demand. This not to be confused with simple sinusoidal control or phase voltage control which lacks the performance gains.
        • FeedForward: Feedforward to apply in volts
        • 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].
        • OverrideBrakeDurNeutral: Set to true to static-brake 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 0V to the motor.
      Parameters:
      request - Control object to request of the device
      Returns:
      Code response of the request
    • setControl

      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.
        • FeedForward: Feedforward to apply in torque current in Amperes. 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).
      Parameters:
      request - Control object to request of the device
      Returns:
      Code response of the request
    • setControl

      Requests Motion Magic® to target a final position using a motion profile. Users can optionally provide a duty cycle feedforward.

      Motion Magic® produces a motion profile in real-time while attempting to honor the Cruise Velocity, Acceleration, and Jerk value specified via the Motion Magic® configuration values. Target position can be changed on-the-fly and Motion Magic® will do its best to adjust the profile. This control mode is duty cycled based, so relevant closed-loop gains will use fractional duty cycle for the numerator: +1.0 represents full forward output.

      • MotionMagicDutyCycle Parameters:
        • Position: Position to drive toward in rotations.
        • EnableFOC: Set to true to use FOC commutation, which increases peak power by ~15%. Set to false to use trapezoidal commutation. FOC improves motor performance by leveraging torque (current) control. However, this may be inconvenient for applications that require specifying duty cycle or voltage. CTR-Electronics has developed a hybrid method that combines the performances gains of FOC while still allowing applications to provide duty cycle or voltage demand. This not to be confused with simple sinusoidal control or phase voltage control which lacks the performance gains.
        • FeedForward: Feedforward to apply in fractional units between -1 and +1.
        • 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].
        • OverrideBrakeDurNeutral: Set to true to static-brake 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 0V to the motor.
      Parameters:
      request - Control object to request of the device
      Returns:
      Code response of the request
    • setControl

      Requests Motion Magic® to target a final position using a motion profile. Users can optionally provide a voltage feedforward.

      Motion Magic® produces a motion profile in real-time while attempting to honor the Cruise Velocity, Acceleration, and Jerk value specified via the Motion Magic® configuration values. Target position can be changed on-the-fly and Motion Magic® will do its best to adjust the profile. This control mode is voltage-based, so relevant closed-loop gains will use Volts for the numerator.

      • MotionMagicVoltage Parameters:
        • Position: Position to drive toward in rotations.
        • EnableFOC: Set to true to use FOC commutation, which increases peak power by ~15%. Set to false to use trapezoidal commutation. FOC improves motor performance by leveraging torque (current) control. However, this may be inconvenient for applications that require specifying duty cycle or voltage. CTR-Electronics has developed a hybrid method that combines the performances gains of FOC while still allowing applications to provide duty cycle or voltage demand. This not to be confused with simple sinusoidal control or phase voltage control which lacks the performance gains.
        • FeedForward: Feedforward to apply in volts
        • 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].
        • OverrideBrakeDurNeutral: Set to true to static-brake 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 0V to the motor.
      Parameters:
      request - Control object to request of the device
      Returns:
      Code response of the request
    • setControl

      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 Jerk value specified via the Motion Magic® configuration values. 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. 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).
      Parameters:
      request - Control object to request of the device
      Returns:
      Code response of the request
    • setControl

      public StatusCode setControl​(Follower request)
      Follow the motor output of another Talon.

      If Talon is in torque control, the torque is copied - which will increase the total torque applied. If Talon is in percent supply output control, the duty cycle is matched. Motor direction either matches master's configured direction or opposes it based on OpposeMasterDirection.

      • Follower Parameters:
        • MasterID: Device ID of the master to follow.
        • OpposeMasterDirection: Set to false for motor invert to match the master's configured Invert - which is typical when master and follower are mechanically linked and spin in the same direction. Set to true for motor invert to oppose the master's configured Invert - this is typical where the the master and follower mechanically spin in opposite directions.
      Parameters:
      request - Control object to request of the device
      Returns:
      Code response of the request
    • setControl

      public StatusCode setControl​(StrictFollower request)
      Follow the motor output of another Talon while ignoring the master's invert setting.

      If Talon is in torque control, the torque is copied - which will increase the total torque applied. If Talon is in percent supply output control, the duty cycle is matched. Motor direction is strictly determined by the configured invert and not the master. If you want motor direction to match or oppose the master, use FollowerRequest instead.

      • StrictFollower Parameters:
        • MasterID: Device ID of the master to follow.
      Parameters:
      request - Control object to request of the device
      Returns:
      Code response of the request
    • setControl

      public StatusCode setControl​(NeutralOut request)
      Request neutral output of actuator. The applied brake type is determined by the NeutralMode configuration.
      • NeutralOut Parameters:
      Parameters:
      request - Control object to request of the device
      Returns:
      Code response of the request
    • setControl

      public StatusCode setControl​(CoastOut request)
      Request coast neutral output of actuator. The bridge is disabled and the rotor is allowed to coast.
      • CoastOut Parameters:
      Parameters:
      request - Control object to request of the device
      Returns:
      Code response of the request
    • setControl

      public StatusCode setControl​(StaticBrake request)
      Applies full neutral-brake by shorting motor leads together.
      • StaticBrake Parameters:
      Parameters:
      request - Control object to request of the device
      Returns:
      Code response of the request
    • setControl

      public StatusCode setControl​(ControlRequest request)
      Control motor 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:
      request - Control object to request of the device
      Returns:
      Status Code of the request, 0 is OK
    • setRotorPosition

      public StatusCode setRotorPosition​(double newValue, double timeoutSeconds)
      The position to set the rotor position to right now.
      Parameters:
      newValue - Value to set to.
      timeoutSeconds - Maximum time to wait up to in seconds.
      Returns:
      StatusCode of the set command
    • setRotorPosition

      public StatusCode setRotorPosition​(double newValue)
      The position to set the rotor position to right now.

      This will wait up to 0.050 seconds (50ms) by default.

      Parameters:
      newValue - Value to set to.
      Returns:
      StatusCode of the set command
    • clearStickyFaults

      public StatusCode clearStickyFaults​(double timeoutSeconds)
      Clear the sticky faults in the device.

      This typically has no impact on the device functionality. Instead, it just clears telemetry faults that are accessible via API and Tuner Self-Test.

      Parameters:
      timeoutSeconds - Maximum time to wait up to in seconds.
      Returns:
      StatusCode of the set command
    • clearStickyFaults

      Clear the sticky faults in the device.

      This typically has no impact on the device functionality. Instead, it just clears telemetry faults that are accessible via API and Tuner Self-Test.

      This will wait up to 0.050 seconds (50ms) by default.

      Returns:
      StatusCode of the set command