@rzusman:
not just this simple wrap, but also the features which are provided by this API lib, like partially provided by the Arduino PID_v1 lib:
e.g., there are issues, if you use PID control for quickly rotating rotary encoder motors under varying positive or negative load to precisely target an encoder value, and to avoid inertial passive overrun when the encoder target once has been reached and the motor already has been switched off (then
automatically reactivate PID control and re-allign to the target within a predefined time of latency).
Then, controlling motor rotations both by approaching an encoder target and simultaneously approaching a rotation speed during this mission for either motor.
Then, to provide a simple instantiation of a set of PID motor controls for either single motor control purposes even for 6-10 motors..
Then, when having to control several motors, starting and stopping simultaneous PID controls by different PID control settings, and all "PID motor control instances" have to be computed automatically independendly in parallel tasks or added or cancelled to already running tasks.
Then a PID control should provide different set modes, e.g. to reach a target and then switch off or to hold the target point actively by infinite re-adjusting until being disabled.
Then, when a motor has not reached a target precisely but just quite closely (e.g., stalling under heavy load close to the target), either set the control mode to try approaching it repetively or enable switch-off after a predefined time of latency and/or within a predefined target-gap nevertheless.
Then, the ability to change PID-settings temporarily even if the control already has been started, overwriting the automatic controls (PID_v1: "manual" vs. "automatic").
Then having all-over runtime control of all single current motor states like
idle
busy
ramp-up
ramp-down
off
coast
brake
hold (target)
to be able to start single motor control missions depending on the run state of one or more different other motor run states (e.g., wait for PID motor A+B to ramp down before starting PID motor D, or to synchronize motors 5+6+7 by adjusting current PID settings for motor speed during runtime.
Then, setting different ramp-up and ramp-down constants for either motor to smoothly start and stop motors.
Then, last but not least, have a way to set PID control update intervals to adjust to slow low-priority control modes (e.g., 500ms relay-switching) up to high speed+high priority controls (e.g., 50-100µs for a quickly drawing 3DOF plotter or a 6DOF assembling robot).
And after all, providing a auto-tune-module for automatical empirical computing of most appropriate kp, ki, kd settings under different runtime-circumstances.
These are examples of functional purposes which are needed to have by a PID API lib but which are not provided by the simple PID algorithm based on the formula
gordon@drogon.net wrote:there will be one ...
... in the release after the next of wiringPi.
-Gordon
that indeed sounds very promising !
.