As you’ve indicated elsewhere, I’ve played with this a little bit over the years. I think it is certainly possible to implement a closed loop feedback system within Klipper. However, the complexity and benefits vary notably depending on the requirements - in particular how fast does the system need to respond to sensor inputs and what is the ultimate goal of the closed loop system.
If one is basing the work on the Klipper software then the desired sensor to motor latency plays an important role on where one would implement it. I’ve discussed this briefly at Fast closed-loop controllers on the MCU? - #2 by koconnor .
Ultimately, I came to the conclusion that “closed loop” control over typical 3d printer stepper motors would not be worthwhile (as mentioned briefly at Mechaduino experiment ). The issue I ran into is: the implementation would be complex and there is a high risk it could produce lower quality prints. In particular, the time it would take for a sensor to detect a positional error and move the motors to correct it would take too long to avoid a visible blemish from the initial positional error. And then one would ultimately have two surface blemishes - the blemish resulting from the original positional deviation and the subsequent blemish resulting from the motors moving back to their ideal position. I concluded this effect would likely cause “salmon skin” effects on the surfaces of prints.
That said, closed loop control might very well be useful for other motors (eg, your position control of mirrors).
Well, the rp2350, tmc2209, and as5147d are all supported in Klipper today (I don’t know how much the as5147u differs from the as5147d). If you know a little bit of python coding you could try wiring up a simple host based control loop just to see if it works. It’d likely be slow, but might get you some initial results to inform future plans.
Maybe that helps a little,
-Kevin
EDIT: Just to be clear, I concluded that a traditional PID type closed-loop control of 3d printer XYZ stepper motors would not be worthwhile. A non-traditional “closed loop” approach, such as using sensor input to tweak future movements in the hope of avoiding future positional errors, might very well be worthwhile.