Conceptual question about absolute encoders

I had a quick question about absolute encoders. On the NEOs we use from REV, the built-in encoder resets when the robot is turned on. I’ve read that this is a relative encoder. I’ve heard on swerve there is an absolute encoder for the steering motors. What I don’t understand is how the wheel’s rotational position is tracked when the robot is turned off. From my understanding, any electronic component will stop tracking position when power is cut, right? So if the wheels are rotated between matches or something, How does the swerve know the correct rotation of the wheels when it is powered back on? Do the absolute encoders track the rotation of the wheels while the robot is powered off? If so, how?

Sorry if this sounds dumb/wrong, I have no experience with swerve.

Edit: Changed category to technical - sensors

Great question! Absolute encoders have no “memory” between power cycles, but they don’t need it. These encoders work by detecting the magnetic fields around a permanent magnet nearby the encoder’s sensor. The CANcoders, for example, use a special magnet that’s “diametric”, which means it’s north and south poles are found on the cylindrical length, rather than at the ends.
The absolute encoder uses Hall Effect and similar physics to detect where in the magnetic field it is — near the South Pole, or the North Pole, or somewhere in between, and can determine where in a 360 degree rotation the wheel axis is.

Now, there’s a limitation to this. Absolute encoders know where within their single rotation they are, but if you are using a gear reduction, you don’t know how many rotations you’ve gone through your full range of motion. So, teams who use gear reductions to drive mechanisms and want to use absolute encoders, also need to install another gear that will represent 1:1 where their mechanism is located (or put it directly on an output shaft, for instance)

2 Likes

Ok I see now! It makes sense that they are used to find the position of swerve steering wheels then because it doesn’t matter how many rotations the motor has gone it only matters where it is in the rotation.

I’m still a little confused on how this works. When you say there needs to be a 1x1 gear where the mechanism is located, how does this gear mitigate the problem of not knowing how many rotations the motor has traveled?

Thanks so much for helping me understand this better!

1 Like

What I’m saying is, you need a way to map 1 full rotation of encoder, to the full length of travel of your mechanism. For example, say you are running an elevator that drives a sprocket/chain and it takes 10 rotations of that sprocket to lift the elevator the full distance.
On that same output shaft, you can add a gear, then a second gear with a 10:1 reduction, such that the larger gear has 1 full rotation for the elevator’s range of motion. The gears are “locked” together, so you always know how many rotations of the output shaft equate to a position in the 360-degree circle of the larger gear.

Made a very quick/crude drawing to explain:

2 Likes

Ohhh I see, so the absolute encoder goes on the output gear/gearbox rather than the motor itself?

1 Like

Yep! This is generally a better way to get positive confirmation of your mechanism’s actual position anyway. If your chain/belt were to skip, the motor doesn’t have any knowledge of that and will run the mechanism to the wrong position. In general, the best place to put an encoder is where it can directly measure a mechanism’s position (if possible)

2 Likes

Good explanation and hints at the final problem of the wheels that the OP presented. Where are the wheels pointing with respect to the field or the driver’s controller which comes down to where is the chassis pointing with respect to the field?

A compass would work in many circumstances but not usually considered reliable for FRC robots so we manually have to assure the wheels are pointing a known direction with respect to the mechanism (robot chassis) at initialization assuming we have set the orientation of the chassis to a known position (sighting along a straight edge of the field or now AprilTags we’ve seen being used).

Putting the encoder on the output also helps with backlash. Also, since the magnet is indicating absolute position, it needs to be aligned, to set the zero position.

Because the magnet normally doesn’t have any visual indication where the North and South poles are located and, even if it did, the resolution is high enough that is would be very hard to precisely align it, there is normally an offset that has to be applied in order to adjust where the zero position is located. Often, any time a mechanism is reassembled, this will need to be reset. This is because things like gear mesh change. But, if the encoder is directly mounted to the output shaft, this last issue is often eliminated.

The REV through bore encoder is aligned at the factory and has a little mark at the zero position. BTW, not all absolute encoders use magnets, although this is the most common mechanism.

1 Like

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