Swerve Drive Specialties MK3 Encoder Help

We are attempting to use SRX mag encoders with our SDS MK3 modules (neo version). Currently, they are connected to the sparkmax dataport and are thus running quadrature mode. Though they work, we have to manually position the wheels to dead straight every time we turn the robot on. Thus we are hoping to get absolute encoders working. The documentation seems to suggest the mag encoders have a PWM output that outputs an absolute signal. Is there any way for the Rio to decode that signal? We tried using the DIO and AIO but were only getting a snapshot of the voltage sent from the encoder (0 or 3.3 volts) with no apparent way to get a short-term average. Has anyone had any success using mag encoders as absolute without talons?

You can use the Duty Cycle Encoder class to read the PWM signal:

1 Like

Using this class, is the Mag Encoder connected to the Spark Max motor controller or the RoboRio?
If the RoboRio the DIO or the AIO?
Thank you for your help.

This would have the mag encoder connected to the roborio using a gadgeteer breakout. You will want to use a DIO port with 5V power pin.

you are literally the person I have been looking for
did you have to do anything special to get the mag encoders to work with the spark max i have seen a lot of things like rewiring the ribbon cable or its not working in a certain version of the spark max has any of that change is it just plug and play?

https://github.com/Jagwires7443/SwerveSensorInterfaceBoard has a lot of info. In particular, see the paragraph in bold in the REAME.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.