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: Encoder HIDScope MODSERIAL TouchButton mbed-dsp mbed
Fork of Robot2mooiemanier by
Revision 29:9dea548d6d6c, committed 2014-11-01
- Comitter:
- Tanja2211
- Date:
- Sat Nov 01 12:33:16 2014 +0000
- Parent:
- 28:bee27c74a835
- Child:
- 30:488e24ed1cb1
- Commit message:
- pid positie: error=setposition-measurement; Kpp=0.2 kip=0.02
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Sat Nov 01 12:11:02 2014 +0000
+++ b/main.cpp Sat Nov 01 12:33:16 2014 +0000
@@ -10,7 +10,7 @@
#define K_D (0 /TSAMP1)
#define I_LIMIT 1.
#define K_Pp (0.2)
-#define K_Ip (0.002 *TSAMP1)
+#define K_Ip (0.02 *TSAMP1)
#define K_Dp (0 /TSAMP1)
#define TSAMP1 0.01
@@ -437,7 +437,7 @@
float out_p = 0;
static float out_i = 0;
float out_d = 0;
- error = setspeed-measurement;
+ error = setposition-measurement;
out_p = error*K_Pp;
out_i += error*K_Ip;
out_d = (error-prev_error)*K_Dp;
@@ -713,7 +713,7 @@
}
if (toestand == TERUGKEREN) {
new_pwm = pid(setspeed, motor1.getSpeed(),false);
- pwm_motor1.write(new_pwm);
+ pwm_motor1.write(0.3);
motordir1 = 0;
pc.printf("motor2.getPosition %d\r\n", motor2.getPosition());
