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: Classic_PID.cpp
- Revision:
- 3:715c8245e671
- Parent:
- 2:f78e083a20c4
- Child:
- 4:7b42de70b65f
diff -r f78e083a20c4 -r 715c8245e671 Classic_PID.cpp
--- a/Classic_PID.cpp Mon Jan 19 14:20:30 2015 +0000
+++ b/Classic_PID.cpp Wed Feb 04 14:19:03 2015 +0000
@@ -33,7 +33,6 @@
// Calculate the individual parts of the PID algorithm
float Proportional = _Kp * (_error - _lastError); // Calculate the Proportional part
- //_sumError += _error; // Add this error to the sum of errors
float Intergral = _Ki * _error; // Calculate the Intergral part
// Calculate the output
@@ -101,7 +100,7 @@
float Intergral = _Ki * _sumError; // Calculate the Intergral part
// Calculate the output
- _output = ((1 / _setPoint) * _kvelff) + Proportional + Intergral;
+ _output = (_setPoint * _kvelff) + Proportional + Intergral + 0.005;
// Check for wind-up
if(_output > _maxLimit)