aboutsummaryrefslogtreecommitdiff
path: root/zumo/pidtest.cpp
diff options
context:
space:
mode:
authorUnavailableDev <69792062+UnavailableDev@users.noreply.github.com>2023-05-25 21:07:27 +0200
committerUnavailableDev <69792062+UnavailableDev@users.noreply.github.com>2023-05-25 21:07:27 +0200
commitfbe109a12420033c3421733072d36a875e154f64 (patch)
tree3f0efe7cee27c2389d057f411261fd037fccbb2b /zumo/pidtest.cpp
parent76df689d48df0b5056769b9c8ca968ac4a0eb261 (diff)
parent6daf8036c1342899196b2f7830ae5a18f0918d07 (diff)
Merge branch 'master' of https://github.com/unavailabledev/avans-dui
Diffstat (limited to 'zumo/pidtest.cpp')
-rw-r--r--zumo/pidtest.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/zumo/pidtest.cpp b/zumo/pidtest.cpp
new file mode 100644
index 0000000..b9ce50b
--- /dev/null
+++ b/zumo/pidtest.cpp
@@ -0,0 +1,18 @@
+#include <cstdio>
+#include <random>
+
+#include "pid.h"
+
+int main() {
+ float P, I, D;
+ P = -0.02;
+ I = 0.13;
+ D = -300;
+ PID test(P, I, D);
+ test.reset(0.0);
+
+ fprintf(stderr, "P: %.3f :: I: %.3f :: D: %.3f\n", P, I, D);
+ for (unsigned int i = 0; i < 100; i++) {
+ printf("%2.8f\n", test.iter(i < 50 ? 1.0 : 0.0));
+ }
+}