I’m looking for some advice about which encoders to use for swerve. My team is going to be using the MK4i kit with SPARKMax Controllers and NEO motors, and are currently deciding betwen using Thrifty Absolute Magnetic Encoders and CANcoders. We have a set of each, but we need to decide which would work better before buying another set. I’m mostly just wondering what the differences between the two are - other than price - because I cant seem to find anything major to differentiate them.
We have used both and they work fine. The programming and wiring are a little different on both. Candoders will be on the can bus and the thrifty uses an analog output (we wired them directly to the analog ports on the rio).
So price and initial wiring a little simpler in my opinion for the Thrifty. Does not utilize can bus so that can be helpful if there is a lot of can utilization.
Most example programs use Cancoders so that is a benefit for them.
I’d suggest learning about closed loop control, which is convenient. you’d wire the thriftybot encoders to the sparkmax directly; it wouldn’t work with the cancoders.
This is the problem I am going through right now. Same system…all these encoders…and no real direction on how to connect them to the brains. Regardless of the system. Do I direct connect to the roborio? Can I connect to the sparkmax (and how)? Do I need to go though a SRX?
I have looked at several of them. SDS only shows how to hook up an encoder to the module…after that…you are on your own. IF a say a Cancoder can be hooked directly to the Roborio…say it. Less headache. IF it can be hooked up to a sparkmax…show us.
I don’t want to buy a $90 part (per corner)…and it not work for what we need because of lack of direction.
if you’re just starting out, then i’d recommend the thriftybot encoder wired directly to the roborio analog input. it’s the simplest option, and it works fine.
the other main options given the OP’s sparkmax/neo choice are:
- cancoder with code in the roborio. the main advantage is that it avoids potentially-troublesome analog signals; the main disadvantage is dealing with CAN setup and (perhaps) congestion.
- thriftybot with sparkmax. this uses the sparkmax “data” port analog input. you’d run profiles in the roborio and follow them with PID in the sparkmax.
Are the thrifty bot encoders absolute encoders?
Presumably you want an absolute encoder for swerve drive modules so you don’t have to make sure the wheels are perfectly lined up at the start of every match…
And I was under the impression that Sparkmaxes don’t work with absolute encoders while in brushless mode.
Spark maxes need a separate breakout board on top of them in order to take an absolute encoder input. See rev swerve/rev hex encoder
I would also like to hear about using the Helium Canandcoder from Redux Robotics for this configuration (MK4i with NEO/Sparkmax). This encoder could be directly wired into the alt encoder port on SparkMax, so seems like a good option on the surface. I am not a programmer, so no idea how this affects the code needed to operate the swerve.
The Canandcoder plugs in directly to a SMAX. Code example here: Using the PWM Output with Spark Max — Redux-Documentation 1.0.0 documentation
You might find this code helpful to see programmatic differences https://github.com/BroncBotz3481/YAGSL-Example/tree/main/src%2Fmain%2Fjava%2Fswervelib%2Fencoders
Yes, the Thriftys are absolute. You can wire them into a Spark Max with this nifty guy:
This thread has more on using the Thrifty encoders, etc. There are other threads with details on all of these options. There are many options, and teams have used most (all?) of these. Our team has used the SRX Mag Encoder for 3+ years now, they are pretty easy to wire and do what we need.
We used Mag encoders as well this year (dusted them off after switching away from Talon SRX’s years ago). They worked fine - the only downside is that ribbon cables are garbage. How did we forget that?