@Quintin_Brand ODrive handles step/dir inputs via interrupts. The estimated limit is a 50kHz step rate, but I’m not aware if that has been tested. For reference, the ODrive control loop runs at 8kHz. Getting more than one interrupt per control loop cycle isn’t a problem - it’s just a larger input step. The limit here with step/dir is step size vs achievable max speed (due to the step rate limit). For the input filter, it looks like that is part of a newer firmware than master
- my apologies. I’m not sure when it was added.
The 2nd order filter code is here on the devel
branch. Based on the input filter gains and position/velocity error, feedforward terms are calculated for position, velocity and acceleration. It isn’t unique to the step/dir input, just a feature that could be useful.
I think you’re on the right track!
@bungle I’m not sure how much slower the ODrive control loop reacts compared to a stepper motor. Note that it isn’t unique to ODrive, it’s a characteristic of all feedback control systems. In the situation of ODrives and steppers on the same machine using step/dir commands, the “reaction speed” difference should not be enough to be noticeable. I think it would be noticeable if you were trying to fling the bed off the printer (but at that point you’re way beyond what a NEMA 17 is capable of).
In my opinion, there is not much benefit to implementing the klipper command protocol on ODrive vs using step/dir from a printer controller to ODrive. The information is the same, so the only difference is that it’s over a more reliable communication method.
I think it would be difficult to modify klipper such that it outputs step times and position/velocity commands in a synchronized way, but I could be wrong.
For the velocity/acceleration feedforward (really velocity is the most important), this is a good graphical reference.
For step generation, a trapezoidal velocity profile is made for a move command in the gcode. A position profile is calculated from the velocity profile. Then, step times are calculated to minimize the error between the “achievable stepper motion” and the desired position profile.
For the feedforward idea, in klipper, you’d take the position and velocity profiles and sample them at a fixed rate. In other words, if the move takes 1s total, slice that up into pos/vel commands for every 1ms of the move. Each position/velocity sample is then a command sent to ODrive. No need for step/dir inputs to ODrive with this scheme.