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: BioroboticsMotorControl MODSERIAL mbed
Diff: main.cpp
- Revision:
- 3:689f3f2e78e8
- Parent:
- 2:3be8cd780b3d
- Child:
- 4:fce8c7458e97
--- a/main.cpp Fri Oct 19 08:43:25 2018 +0000
+++ b/main.cpp Fri Oct 19 09:06:28 2018 +0000
@@ -9,9 +9,9 @@
const int PULSES_PER_ROTATION = 6533; // Amount of motor encoder pulses per rotation. When using X4 encoding.
const float pid_period = 0.0001; // PID sample period in seconds.
-const double Kp = 5.0;
-const double Ki = 0.1;
-const double Kd = 0.1;
+const double Kp = 10.0;
+const double Ki = 0.5;
+const double Kd = 0.5;
const double motor_threshold_rps = 0.3; // Rad/s under which we send 0 to the motor, to prevent it from jittering around.
const double motor_stall_pwm = 0.5; // PWM fraction above which the motor starts to move.
@@ -62,7 +62,7 @@
if (rps > 0 && rps < motor_threshold_rps) {
rps = 0;
}
- if (rps < 0 && rps > motor_threshold_rps) {
+ if (rps < 0 && rps > -motor_threshold_rps) {
rps = 0;
}