
Howdy,
In my previous post I introduced the PID controller; this time I’m gonna illustrate how to formulate the algorithm in a way which simplify the coding on board our EV3. This post will be saved as a static page here.
I know, I know, there’s some more math; but I think it’s worth it.
So, we’ve got the following equation representing the canonical form of the discrete PID controller:
,
which gives the controller output at each instant . To implement this controller, one thing to do is to consider the
, i.e. the increment of the control signal
from one instant to the other. So if we define:
,
we get
,
which yields
.
Grouping the addenda by the k-instant we get the almost final version of the algorithm:
,
which can be better formulated to ease implementation in code as follows:
,
,
,
,
,
.
Ok! Now that should do, it’s time to code and test! Wait for my next post!