summaryrefslogtreecommitdiff
path: root/zumo/pid.cpp
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2023-05-19 14:50:22 +0200
committerlonkaars <loek@pipeframe.xyz>2023-05-19 14:50:22 +0200
commitba026d8229744a01818d38552ec7271e689d19eb (patch)
treead6500284878fedc730d0034e5bf442f0e0fad58 /zumo/pid.cpp
parent473ab3fd794d0baddd9a6a29ab25cea3d2217fc8 (diff)
update pid in arduino sketch
Diffstat (limited to 'zumo/pid.cpp')
-rw-r--r--zumo/pid.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/zumo/pid.cpp b/zumo/pid.cpp
index fabe1da..7c1cbda 100644
--- a/zumo/pid.cpp
+++ b/zumo/pid.cpp
@@ -41,13 +41,12 @@ void PID::reset(float value) {
output = value;
}
-PID speed_pid(0.1, 0.0, 0.0); // TODO: tune these (garbage values)
-PID steer_pid(0.1, 0.0, 0.0);
-PID speed_mod_pid(1, 1, 1);
+PID speed_pid = PID();
+PID steer_pid = PID();
+PID speed_mod_pid = PID();
void apply_pid(dui_state_t* target, dui_state_t* current) {
current->speed = speed_pid.iter(target->speed);
current->steer = steer_pid.iter(target->steer);
- // current->speed_mod = speed_mod_pid.iter(current->speed_mod, target->speed_mod);
- current->speed_mod = target->speed_mod;
+ current->speed_mod = speed_mod_pid.iter(target->speed_mod);
}