Encoder steps.. Issue with returning sprocket to 12 o'clock after precise number of links fed out... again

I just ran into this myself today. Surprised this has been an issue for two years. It was very disturbing when I saw it, I was concerned that our encoder counts could have gotten messed up again. But I was relieved to find this thread.

The issue wasn’t really software, but more of a controls issue. The difference between B02 and B09 is that B02 directly called axis.detach() when it was done. This is a no-no. The PID controls should handle detaching the axes directly, and nothing else except maybe an E-Stop.

What was happening, was that the final position call was made to endMove, and then before that could be completed, B02 would get the axis position and print it. This is why it reported being less than the commanded length. Then it would call detach() before endMove() could finish its job. When the axis is detached while moving it has some momentum so it would carry on past the desired location. endMove drives the axis to a stop by reversing to brake at the proper location.

Anyways, it was a simple fix, and now we end up at the precise step count that we expect. I made this pull request https://github.com/WebControlCNC/Firmware/pull/8 but honestly, I have no idea where things are supposed to go these days.

5 Likes