Understanding the Options We Have Moving Away From Vex

Hello!

In our pursuit to switch away from Vex, we have come to the natural conclusion that andymark 775’s, ctre control devices and sensors, and the products offered by rev our the things that we can and want to use. We use all of the ctre sensors and control devices on our robots now, but without encoders from the vex gearboxes, we think we may no longer be able to use those things. In light of this, we have been investigating rev quite a bit, but there is so much confusion about what we can and can’t use. I’m wondering if someone could clarify this or give us some alternatives.

Does the spark max have an integrated control loop functionality(pids of some form)
If so, what frequency does it run at, and is the latency manageable?
What feedback devices can be used with this?
Can you use things like a ctre mag encoder?
If so do you need a breakout board of some type?
Is the onboard neo encoder adequate for a swerve drive?
If so, how did you get this to work? Or, did you use a can coder or mag encoder?
If it uses a can coder, how did you get reliable feedback over the jittery can network?
If you used the mag encoder, did you somehow plug it into the sparkmax, or did you use it over dio or something else?
Does rev plan on making an encoder, 10:1 , or 90 degree cartridge for their maxplanetary gearbox system?
If so, when can we expect them? This season?(not trying to be pushy or anything just genuinely curious, I know their world is probably on fire with all of the demand right now)
Are there any plans for a motor with a more capable(again coming from a talon fx user) built-in encoder and software solution to accommodate(motion profiling etc)?
We are trying our best to understand so we can make this shift, any help would be amazing!
Thank you!

Don’t know if I can answer all your questions, but I’ll take a stab. We have been building our swerve around a Neo550 for steering and a Neo for drive. The SparkMax has integrated control PID for position or speed control with the motor encoders but you can also use an external encoder. We’ve been running the Neos in speed mode with the SparkMax loop closure. We run loops on the Rio for steering control with feedback from Lamprey absolute Hall effects.

It’s early days for us, but this setup has been working out well so far. Can’t say that SparkMax latency has impacted us, but I’ve seen posts here about it.

Hope this is helpful. I’m sure more seasoned teams will have more to say.

1 Like

I’ll try to answer – I have no inside info from REV, but expect others will correct anything that is wrong, and/or confirm anything that is more of a guess (just the frequency). Also, there is a forthcoming F/W update (and 2023 API changes) that might expand things out from here.

Does the spark max have an integrated control loop functionality(pids of some form)

Absolutely. See Closed Loop Control - SPARK MAX.

If so, what frequency does it run at, and is the latency manageable?

This is a guess, but going by some of the config parameters, 2000Hz (500µs) – see Configuration Parameters - SPARK MAX. It is possible that it actually adjusts the setpoint at a lower frequency, perhaps a multiple of the 2000Hz period. The latency is an issue for velocity control, and steering uses position control.

What feedback devices can be used with this?

There is a built-in encoder, which is suited to some uses and less so to others. Then, there is the “alternate encoder” expansion port (see Alternate Encoder Mode - SPARK MAX). You can use a quadrature encoder, an analog sensor (potentiometer or something like the ThriftyBot encoder), and I think for 2023 it will be possible to use a PWM encoder. I am including links to a couple of posts that should be pretty authoritative. The REV Through Bore Encoder is also supported.

Can you use things like a ctre mag encoder?

Absolutely, we have done this.

If so do you need a breakout board of some type?

Yes. In theory, you could also use a cable, with the proper connector on one end and individual wires on the other – but I would not recommend this. Not all breakout boards will work with every type of encoder, so best to select the type of encoder first and go from there.

Is the onboard neo encoder adequate for a swerve drive?

For drive, sure. For steering, probably not. For one thing, you probably want an absolute encoder for steering. For this reason alone, I’d plan to use a separate encoder for steering, which is provided for with most (all?) of the COTS swerve modules. But again, the built-in encoder should be OK for position control – but this would be on the wrong side of the gears/belts, so not ideal.

If so, how did you get this to work? Or, did you use a can coder or mag encoder?

We use mag encoder, it worked great (details sent in another thread).

If it uses a can coder, how did you get reliable feedback over the jittery can network?

I won’t try to answer this one, since we went a different direction. I would use mag encoder over CANCoder in this application, given use of SPARK MAX. But, it might not be that bad.

If you used the mag encoder, did you somehow plug it into the sparkmax, or did you use it over dio or something else?

We have done both (using MAG encoder). There was a SPARK MAX F/W bug (that looks to be fixed for 2023) that made it not really worth it to plug into SPARK MAX directly, but we did run this way – it was plugged into both SPARK MAX and roboRIO (details given in other post). This was for 2021 at home challenge. For 2022, we wound up just connecting MAG encoder directly to roboRIO (again, details in other post).

EDIT: DO NOT try to directly connect an encoder to the SPARK MAX alternate encoder port. Pins 5, 7, and 9 on the SPARK MAX alternate encoder port must not be connected to anything. And, the pinout for this type of connector is not really standardized within FRC, even just between motor controllers and sensors.

2 Likes

The Spark Max can run on board PIDs. They have velocity, position, current, and smart motion. Runs at the same 1khz as the talons. The spark Max has the same data port as the Talons and can use basically the same sensors as the talons, but with a brushless motor the motor uses the encoder pins. You can put the spark max in alternate encoder mode and use a different encoder for the feedback but will need a breakout board to connect to the different pins used in alternate encoder mode. The updated firmware will allow you to use PWM inputs like the mag encoder on the spark max.

It sounds like some people didn’t have much issue with the integrated encoder of the Neo driving the swerve. You could use mag encoder if you want higher resolution connected directly to the spark max. We used a Neo 550 and seeded it with the position of the CANCoder at startup.

The CANCoder won’t directly work with the spark max, you’d have to read it from the Roborio and then do the control loop on the rio and send it to the spark max.

We used mag encoders plugged into DIOs, but the new firmware should allow you to use them plugged directly in to the spark Max and use them directly as feedback.

They have a thread for their new products. I don’t know what REV is planning on releasing, but I wouldn’t expect anything motor wise for a bit as they just announced the NEO 1.1. Smart Motion already exists which is basically motion magic.

3 Likes

The NEO and the 550 should both have no problem with steering, its the velocity that has the 100ms delay not the position.

I don’t really know why you are saying that the “built-in encoders should be OK”, AFAIK most teams only use their absolute encoder when the robot starts up to seed initial module position and then just run off motor encoders.

There is 100ms delay on the velocity data, you can read in to 6328’s solution on how they are getting around this.

Restocking dates:

REVs current API is basically on par with the Phoenix API, excluding the FOC they just announced (which REV might or might not be able to do based of physical hardware limitations). NEOs and 550s also have good enough encoders compared to Falcon 500s for most things you would want to do.

2 Likes

We both said the same things about position control for steering and the NEO and NEO550 being suited to this. I’m sorry if this wasn’t clear.

Sure, this is an option. There are several viable options. As long as you have to have an absolute encoder anyway, why not use it all the time and just run the position control on the roboRIO? The roboRIO is updating the setpoint pretty frequently anyway. But, yes, you can just use the absolute encoder to seed the built-in encoder at start-up. There are reasons why one might choose not to do this – backlash, possible motor controller reset, and possible belt skipping are probably the main ones.

I suspect the 2023 F/W update is going to open up some even better options, although you will still likely have to deal with wiring something to the alternate encoder port, if you want to run an absolute encoder into SPARK MAX (assuming this becomes an option in 2023).

1 Like

With Falcons, yes. The low encoder resolution of the NEO (42 CPR) results in the position PID control for the azimuth motors being relatively low-accuracy. Using a WPILib PIDController with the absolute encoder as the feedback device worked far better with NEOs, at least for us.

1 Like

I would expect that the gear ratios on most swerve modules (on the MK4is you would get around 900 CPR with NEOs accounting for the gear ratio) would eliminate the need for that, but it’ll always be a game of balancing pros and cons.

1 Like