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: HIDScope QEI biquadFilter mbed
Fork of NR_method by
Diff: NR_method_1.cpp
- Revision:
- 15:56775c151fee
- Parent:
- 14:1eee224b54d8
- Child:
- 16:fb52c8d7f242
--- a/NR_method_1.cpp Fri Nov 02 09:20:12 2018 +0000 +++ b/NR_method_1.cpp Fri Nov 02 09:40:19 2018 +0000 @@ -57,8 +57,8 @@ double Cxx = -35; // Goal position double Cyy = 27; // Goal position double Kp = 4; -double Ki = 5; -double Kd = 0.4; +double Ki = 4.5; +double Kd = 0.7; double Ts = 0.002; bool startCalc; bool calpos1; @@ -148,11 +148,11 @@ Cxx =x1; pc.printf("Moving in the x direction\n\r"); if (dir == true) { - if(x1 > -46.3) { + if(x1 > -45.7) { x1 = x1-4.2; - } else if ( x1 <= -46.3) { + } else if ( x1 <= -45.7) { x1 =-17; } else { @@ -162,7 +162,7 @@ x1 = x1+4.2; } else if ( x1 >= -17) { - x1 = -46.3; + x1 = -45.7; } else { } } @@ -178,20 +178,20 @@ Cyy=y1; pc.printf("Moving in the y direction\r\n"); if(dir == true) { - if(y1 < 32.4) { - y1 = y1+4.2; + if(y1 < 31.7) { + y1 = y1+4.1; //return y1; - } else if ( y1 >= 32.4) { + } else if ( y1 >= 31.7) { y1 = 3; //return y1; } else { } } else { if(y1 > 3) { - y1 = y1-4.2; + y1 = y1-4.1; //return y1; } else if ( y1 <= 3) { - y1 = 32.4; + y1 = 31.7; //return y1; } else { }