How to use magcoder for kraken x60 for swerve

Hello, we are a new team and jumped of the deep end and picked up a swerve drive with the kraken x60 motors. we have been trying to lean this system and are having some trouble. We thought we needed these srx talon controls to read the magcoders and this was not correct. We found these gadgeteer break out boards to convert to pwm. Is this the correct way to go? for pwm we need power ground signal. is the signal the 3.3 pin out on this board? is there a way to know what wire in the cable are for these and do i need this break out board. Any direction would be appreciated.

The Kraken motor (and its internal Talon FX controller) does not have a Gadgeteer port for an encoder connection like the Talon SRX and Talon FXS controllers. So it will not be able to interface directly with a Mag Encoder. I assume you want to use it as an absolute encoder for the swerve angle. You have a few options:

  1. Replace the Mag Encoder with a CANcoder and use the Remote Sensor option to reference it. This is the method recommended by CTRE (but requires you buying CANcoders)
  2. Use the Gadgeteer breakout board to connect the Mag Encoder PWM absolute output to a DIO port on the roboRIO (and 5V and GND to the DIO 5V and GND respectively). Use the Mag Encoder only to update the offset periodically, and otherwise work off the internal encoder of the Kraken. Note that we have had persistent issues with noisy signals +/- 2° using this method
  3. Same as 2, but run the PID controller externally on the roboRIO. Has all the downsides of 2 and more with no real benefits. But it is technically an option
  4. Take the Talon SRX that you were planning on using and connect the Mag Encoder to it. Read the encoder position from the SRX and use that to periodically set the offset on the Kraken. Then you have the option to use the SRX for a brushed motor that doesn’t need closed-loop control (e.g. on an intake or conveyor). This is essentially making a CANcoder out of parts you already have
2 Likes

To add a note, there is an approach to get rid of the noisy signals. You could update the offsets only when the robot is stationary. Some teams only do it once (when the robot initializes).

1 Like