Through bore limited

I have an arm on the FRC robot, my encoder is connected to an axis that transfers movement to another axis via a current, the problem is that for the mechanism to make a full half turn, the initial axis needs to turn twice, as I am using an absolute encoder, the initial position of the half turn is 0.89, but halfway through, the encoder reaches 0 and starts counting until it reaches 0.89.

Can anyone help me?

So we are going to set aside what others may say about “put the encoder on the arm axis” because that is not your question.

You really have two options here of varying levels of safety. (There is a good reason I bring up being careful of starting the arm/ knowing if the arm is in the correct range of safe positions at the start of this post)

  1. Assume the arm is always starting in the same spot when the code starts - which may be a perfectly valid assumption, but means you could have two options for something like 36 degrees. you select the “correct” 36 degrees by placing it in the correct spot

  2. Add a second sensor (such as a limit switch or even better a beam break) to verify the arm is in the correct spot on code start, then you know that the “correct” 36 degrees if the beam break see the arm in the right area.

Now, the root of your problem I think is you have sensor value (encoder) → controls. You address this by continuing to accumulate once it “rolls over” zero. so you will need another “layer” to keep track of encoder values instead of piping the raw sensor value into the controls loop (presumably some flavor of PID) . We should probably call this layer that keeps track of rollover and keeps adding/subtracting “accumulator” to be consistent with software convention.

The danger comes if your code expects the accumulator to get to 720 degrees (2 turns of the encoder). If the arm starts in the wrong spot and the accumulator initializes at 0 with it in the wrong spot all of a sudden you have the chance for the robot to crash into itself as it thinks there may be more room for motion than available in reality.

In 2019 I had responsibility for the gearbox on the pivot that swung the end effector around on the elevator. If you look closely in this video there is a small yellow semi-circle of plastic on the black circular part in the elevator carriage, there was a small time of flight sensor looking for this plastic. The gearbox had an encoder, but a 3:1 reduction after it, so there was a “correct 120 degrees” to start the arm in. The code looked to see if the arm was in the correct degree range on start up (and maybe at some other points)

Here is the prototype of that gearbox:

4 Likes

I was faced with a similar issue this last season. Due to a miscommunication between myself and our design team, I had to determine the height of our elevator from a through-bore encoder that would make five full rotations. As you said, the issue lies in the absolute encoder’s ability to measure a single rotation before wrapping back around to zero. As a quick solution, I wrote a wrapper class for the through-bore that accumulated the wrap-around, effectively reading the encoder as relative after initializing an initial absolute value.

The linked code should be pretty straightforward to read, but I’m happy to answer any questions you have. The only caveat to this solution is that I recommend orienting the encoder’s zero position away from the mechanism’s default position so that you don’t mess up your absolute offset when initializing.

1 Like

To elaborate on what @Skyehawk said here’s some more pictures:

Here’s a close up of what we called the biscuit and the banana.

The sensor is a nearsighted optical sensor that trips when it gets close to a bright color. https://www.digikey.com/en/products/detail/tt-electronics-optek-technology/OPB716Z/1015170

It can go to a DIO on the RoboRio. In this example, the RoboRio can figure out where the biscuit is at IF the sensor sees a bright color. The encoder wrap around is 120 degrees.

Here’s another example on a turret:

Notice the yellow flag is really small. That’s because there was a bunch gear ratio between the turret and the encoder thus the encoder wrap around was just a few degrees of turret movement.

2 Likes