Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: Controller/SpeedController.cpp
- Revision:
- 1:d7a26e14bc4d
- Parent:
- 0:c88a81d07287
- Child:
- 2:8a7b4b3cb4c1
--- a/Controller/SpeedController.cpp Wed Nov 06 01:17:46 2019 +0000
+++ b/Controller/SpeedController.cpp Tue Nov 10 13:35:03 2020 +0000
@@ -27,21 +27,19 @@
float PIDController::update(float measured_value, float timestamp)
{
+ // TODO
+ // Fill in the blank
+
float delta_time = timestamp - m_last_timestamp;
-// if(delta_time < 0.001) return 0;
- float error = m_set_point - measured_value;
+ float error = /* fill in the blank */;
+
m_last_timestamp = timestamp;
-// float q;
-// if(error>200) {
-// q=0.0;
-// } else {
-// q=1.0;
-// }
-// m_error_sum += error*delta_time*q;
-
- m_error_sum += error*delta_time;
- float delta_error = error - m_last_error;
+
+ m_error_sum = /* fill in the blank */;
+
+ float delta_error = /* fill in the blank */;
+
if(delta_error > 10.0) {
delta_error = 0.0;
}