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.
Revision 5:81e5cc52b4fe, committed 2020-11-10
- Comitter:
- yeongsookim
- Date:
- Tue Nov 10 14:47:43 2020 +0000
- Parent:
- 4:050d1efdee90
- Commit message:
- test
Changed in this revision
| Controller/SpeedController.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/Controller/SpeedController.cpp Tue Nov 10 14:47:01 2020 +0000
+++ b/Controller/SpeedController.cpp Tue Nov 10 14:47:43 2020 +0000
@@ -1,5 +1,6 @@
#include "SpeedController.h"
+
PIDController::PIDController(float kp, float ki, float kd, float max_windup,
float start_time, float umin, float umax)
{
@@ -30,14 +31,14 @@
// Fill in the blank
float delta_time = timestamp - m_last_timestamp;
- float error = /* fill in the blank */;
+ float error = m_set_point - measured_value;
m_last_timestamp = timestamp;
- m_error_sum = /* fill in the blank */;
+ m_error_sum += error*delta_time;
- float delta_error = /* fill in the blank */;
+ float delta_error = error - m_last_error;
if(delta_error > 10.0) {
delta_error = 0.0;
@@ -94,4 +95,4 @@
float PIDController::getLastTimeStamp()
{
return this->m_last_timestamp;
-}
+}
\ No newline at end of file