diff options
author | lonkaars <loek@pipeframe.xyz> | 2023-05-19 13:34:31 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2023-05-19 13:34:31 +0200 |
commit | ff7a914055cf851c994ee037342a331902f84a0c (patch) | |
tree | 790f9398aa23bb526f93787bb3af73a426877e76 /zumo/pid.h | |
parent | 2ed0ea4f12a5532092428f57e040f2cefb5fb973 (diff) |
add pidtest
Diffstat (limited to 'zumo/pid.h')
-rw-r--r-- | zumo/pid.h | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -2,6 +2,19 @@ #include "protocol.h" +class PID { +private: + float A0, A1, A2; + float error[3] = {0}; + float dt = 0.010; + float output = 0; + +public: + PID(float P, float I, float D); + float iter(float target); + void reset(float value); +}; + /** @brief edit `current` to be closer to `target` using PID controllers */ void apply_pid(dui_state_t* target, dui_state_t* current); |