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.
Dependencies: MODSERIAL mbed EMG_Input QEI biquadFilter
Diff: Motor/motor.cpp
- Revision:
- 10:27fdd43f3b85
- Parent:
- 9:19dafcb4a098
- Child:
- 11:4382c567e0d4
--- a/Motor/motor.cpp Thu Oct 27 19:36:12 2016 +0000
+++ b/Motor/motor.cpp Fri Oct 28 06:51:13 2016 +0000
@@ -8,10 +8,10 @@
bq2(1.839030E-01, 3.678060E-01, 1.839030E-01, 1.000000E+00, -3.289757E-01, 6.458765E-02),
P(p), I(i), D(d){
flip = flipped;
- position = 0;
integral = 0;
olderr = 0;
bqc.add(&bq1).add(&bq2);
+ pwm.period_ms(2);
sense.reset();
}
@@ -28,6 +28,7 @@
void motor::PID(double setpoint, double dt){
double error;
double derivative;
+ double position;
double pid;
position = flip?-this->getPosition():this->getPosition();