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: mbed
Diff: PID.cpp
- Revision:
- 8:45797dcd8b66
- Parent:
- 7:edd065946e9b
--- a/PID.cpp Wed Nov 22 06:58:41 2017 +0000
+++ b/PID.cpp Fri Dec 01 20:07:48 2017 +0000
@@ -15,8 +15,6 @@
{
double error = 0;
error= signed( counterM1- counterM2);
- pc.printf("counter1: %6.6f",counterM1);
- pc.printf("counter2: %6.6f",counterM2);
double P = Kp * error;
total_error = (total_error+error);
double I = Ki * total_error;
@@ -42,10 +40,6 @@
double error = 0;
error= signed ( LL_t.read_u16()-RR_t.read_u16());
- // pc.printf("ledL: %d\n",LL_t.read_u16());
-// pc.printf("LedR: %d\n",RR_t.read_u16());
- // pc.printf("kp error: %8.8f\n",(signed ( LL_t.read_u16()-RR_t.read_u16()))*Kp_e);
-
double P = Kp_e * error;
total_error = (total_error+error);
double I = Ki_e * total_error;
@@ -58,18 +52,18 @@
//opening on right side
bool opening_r(double threshold_p, double threshold_d)
{
- return threshold_p < LL_t.read_u16 && prev_error > threshold;
+ return threshold_p < LL_t.read_u16() && prev_error > threshold_d;
}
bool opening_l(double threshold_p, double threshold_d)
{
- return threshold_p < LL_t.read_u16) && prev_error > threshold;
+ return threshold_p < LL_t.read_u16() && prev_error > threshold_d;
}
//wall in fron the car
bool wall_front(double threshold_r, double threshold_l)
{
- return threshold_r < R_t.read_u(16) && threshold_l < L_t.read_u(16);
+ return threshold_r < R_t.read_u16() && threshold_l < L_t.read_u16();
}