SDS Swerve Drive - Mag encoder Analog Input

This may be simple, but we cannot find the doc for this.
We are using SDS Swerve Drive Mk3. Trying to use SDS code.
Encoder: CTRE Mag Encoder
Motor: Neo, SparkMax Encoder

How do you connect the 4 Mag Encoders for “Analog” input.

Thank you for your help in advance

Mark Tayler
HC FRC 4361

The CTRE mag encoders do not have an analog output. If you’re hooking them up to a Rio, you can use the DutyCycleEncoder class to read the “PWM” output of the mag encoder via a DIO.

Thank you for your response.
I am trying to understand why the Swerve Drive Systems would use an
analog input “edu.wpi.first.wpilibj.AnalogInput;” for something that is digital.
Don’t know if you are familiar with their system, but we are trying to use this code

Again, thank you.

Presumably this example is for use with an analog encoder / continuous potentiometer, not a CTRE mag encoder. That being said, DutyCycleEncoder should be a near drop-in here for a PWM output one.

So I see our folly.
The code supplied is for the Mk2, which I knew, but it uses the MA3 analog encoder,
we are using the CTRE Mag Encoder.
There is work to do.

1 Like