Class TalonFXFactory
java.lang.Object
frc.spectrumLib.hardware.TalonFXFactory
Creates CANTalon objects and configures all the parameters we care about to factory defaults.
Closed-loop and sensor parameters are not set, as these are expected to be set by the
application.
-
Method Summary
Modifier and TypeMethodDescriptionstatic TalonFXcreateConfigTalon(CanDeviceId id, TalonFXConfiguration config) Creates a TalonFX and applies the supplied configuration.static TalonFXCreates a TalonFX configured with Spectrum's default parameter set.static TalonFXcreatePermanentFollowerTalon(CanDeviceId followerId, TalonFX leaderTalonFX, MotorAlignmentValue motorAlignment) Follow the motor output of another Talon.static TalonFXConfigurationBuilds aTalonFXConfigurationpopulated with Spectrum's standard defaults: brake neutral mode, counter-clockwise positive invert, 4 % duty-cycle deadband, 40 A supply current limit, software and hardware limits disabled, rotor sensor feedback, and audio cues enabled.
-
Method Details
-
createDefaultTalon
Creates a TalonFX configured with Spectrum's default parameter set.- Parameters:
id- CAN device identifier (device number + bus name)- Returns:
- the configured TalonFX
-
createConfigTalon
Creates a TalonFX and applies the supplied configuration.- Parameters:
id- CAN device identifierconfig- TheTalonFXConfigurationto apply- Returns:
- the configured TalonFX
-
createPermanentFollowerTalon
public static TalonFX createPermanentFollowerTalon(CanDeviceId followerId, TalonFX leaderTalonFX, MotorAlignmentValue motorAlignment) Follow the motor output of another Talon.- Parameters:
followerId- Device ID of the follower.leaderTalonFX- The leader TalonFX to follow.motorAlignment- Aligned makes the motor invert match the leader's configured Invert. That is typical when leader and follower are mechanically linked and spin in the same direction. Opposed makes it oppose the leader's Invert, which is typical when they spin in opposite directions.
-
getDefaultConfig
Builds aTalonFXConfigurationpopulated with Spectrum's standard defaults: brake neutral mode, counter-clockwise positive invert, 4 % duty-cycle deadband, 40 A supply current limit, software and hardware limits disabled, rotor sensor feedback, and audio cues enabled.- Returns:
- a new configuration object with default values applied
-