dcservo icon indicating copy to clipboard operation
dcservo copied to clipboard

Incorrect output in 'S' command.

Open misan opened this issue 8 years ago • 0 comments

With the exception of the dcservoProMicro_trapezoidal.ino file, all the others have it wrong when responding the 'S' command.

The idea of that command is that you can monitor the execution of the last move ('X' command) which is useful for tuning purposes. However the command should provide a sample value of the encoder input every few milliseconds.

The error was that PID.Compute() call returns whether it calculate a new value or not, so each loop is not taking 1ms but an unspecified amount of time, possible lower many times.

A while loop can keep on calling PID.Compute() till it finally calculates a new output (because it was about time as 1ms passed) and this way make sure the loop runs once every 1ms, so each sample is now correct. I will fix that when I have a moment, but now you know about the problem and how to fix it.

misan avatar May 04 '16 08:05 misan