I'm looking for pointers or ideas for what seems like a simple control system, but is turning out to be a little tricky (or I'm just being obtuse).
Here's my setup...
I have an absolute rotary encoder that spits out it's position at a fixed frequency. A relatively low end mircocontroller (yeah integer math) is connected to this encoder and is also connected to a stepper motor through a standard step+direction driver. The goal of the system is to have the stepper motor's shaft smoothly mirror the motion of the encoder. Should be easy, right? The encoder moves 10 clicks, move the motor 10 clicks. That kind of works, but in reality, it fails in a couple key areas. Without closed loop velocity control, slow encoder moves equate to choppy motor movements. Very rapid encoder accelerations or decelerations cause the stepper to loose steps, e.g. it needs proper acceleration ramping. Since I'm pretty familiar with steppers drives, these failures are not really surprising, but the surprising thing is that I can't seem to find a "standard" solution to this problem. I've done a fair bit of googling, and either the algorithms are buried into an expensive piece of hardware (with little explanation how they work) or the algorithms don't really support real-time position updates. I've found some algorithms in old EETimes articles, AVR446, etc. but they assume that each movement is discrete, knowing how far the motor will travel before it even starts. This works fine for a CNC controller, but not for real-time position tracking.
Before I start writing my own nested velocity matching, integer-approximated linear ramped acceleration, position control system, I figured I'd post to see if anyone knows of something like this already out in the wild.
Thanks!