Package frc.spectrumLib.hardware
Class SpectrumCANcoder
java.lang.Object
frc.spectrumLib.hardware.SpectrumCANcoder
Wraps a CTRE CANcoder and applies Spectrum configuration. When the config says the encoder is
attached, the constructor also points the supplied TalonFX's feedback at it.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumSelects how the TalonFX reads position data from the remote CANcoder. -
Constructor Summary
ConstructorsConstructorDescriptionSpectrumCANcoder(int CANcoderID, SpectrumCANcoderConfig config, TalonFX motor, Mechanism.Config mechConfig, SpectrumCANcoder.CANCoderFeedbackType feedbackSource) Configures the CANcoder, and when it is attached points the motor's feedback at it. -
Method Summary
Modifier and TypeMethodDescriptionbooleancanCoderResponseOK(StatusCode response) True when the configurator's response came back OK, and prints the failure toTelemetrywhen it did not.booleanmodifyMotorConfig(TalonFX motor, Mechanism.Config mechConfig) Points the motor's feedback at this CANcoder using the configured source and ratios.
-
Constructor Details
-
SpectrumCANcoder
public SpectrumCANcoder(int CANcoderID, SpectrumCANcoderConfig config, TalonFX motor, Mechanism.Config mechConfig, SpectrumCANcoder.CANCoderFeedbackType feedbackSource) Configures the CANcoder, and when it is attached points the motor's feedback at it. Nothing else happens if the config marks the encoder unattached.
-
-
Method Details
-
isAttached
public boolean isAttached() -
modifyMotorConfig
Points the motor's feedback at this CANcoder using the configured source and ratios. Modifies mechConfig's stored TalonFX config in place, then applies it to the motor. -
canCoderResponseOK
True when the configurator's response came back OK, and prints the failure toTelemetrywhen it did not. -
getCanCoder
-