Absolute encoders and swerve

On a swerve robot, do you only need the absolue encoder for starting up or for the tracking the rotation of the modules at all time?

If you’re asking whether you can run swerve open-loop (that is, without sensor feedback), that would be a definite “all times”. Without knowing the current orientation of the modules, there is no way to translate the driver’s commands into motor movement.

On the other hand, if you’re asking if just relative encoders are good enough after initialization, some teams don’t have absolute encoders at all; they just make sure the robot modules are properly oriented before the start of the match.

so we need an encoder that always know the rotation of the module?

Yes, you technically can just use the absolute encoder at the beginning and then rely on the internal encoder in one of the brushless motor to keep track of the steering position of each module. This method would allow the actual PID control of the steering for each module to be done locally on the motor controller.

In general it is a good idea to have a “zero” button that your driver can hit to reset the zero location of all the modules in case the gyro accumulates a lot of error or something goes wrong.

2 Likes

its also possible to use the motor controller pid with an absolute encoder. that’s how we do it in our code. the rio never looks at encoder data it just spits out the desired positions to the motor controllers

Having an absolute encoder is best practice for sure, and there are several good ones in widespread use in FRC these days. Not having one, or trying to only use the built-in encoder on a motor is possible, but likely to be painful, to one degree or another. In these cases, one sometimes sees some kind of sensor to detect a zero position. So it is possible to only use the zero information at startup, or even to have your field crew have to manually position the modules to zero before they power up.

Source? I don’t think anyone has done that in a long time, as it will immediately ruin your autonomous if they’re even slightly off.
Many teams will use an absolute encoder to set the motor encoder position at the start of a match, then use the motor encoder to control rotation from that point onwards.

Yes, absolute encoders are the way to go. When you have the modules assembled and the absolute encoder mounted, then you can set the offset once, and you are good to go. When we used incremental encoders, we had to use jigs to prep the wheels straight, that was so inconvenient. You would set one wheel slightly off at bootup and the whole match was a struggle.

I’m a new mentor this year and at my first competition I happened to notice a team doing just this before the start of the match: lifting the bot and rotating the swerve wheels. Now I know what they were doing!

We did that in 2020 (because the Lamprey encoders we were using were not working). It worked well enough for a blue banner, but I would have felt more comfortable if we had absolute encoders.

We have found that using the built in encoders on the MiNEO steering motors is very reliable. I have not issues with relying on that for steering control once you set the initial position. Also, the motor controllers do not drop their value in a brown-out scenario, so it is actually a bit more robust than absolute encoders.

We used absolute encoders for control before 2020. That is very solid as long as the encoder does not skip. We used some 48DP gears to drive our absolute encoder and we had occasional issues with those gears slipping.

For 2022, we have added an absolute encoder back into our design, but I am pretty sure we are just going to use it to initialize the modules and then use the MiNEO encoder for position and control from then on.