Helvijs Kiselis
/
Micromouse
Algorithmus
Diff: Motion.cpp
- Revision:
- 25:8854037f6336
- Parent:
- 24:11c5fb5280eb
- Child:
- 26:f964408401fa
--- a/Motion.cpp Tue May 15 15:11:37 2018 +0000 +++ b/Motion.cpp Tue May 15 15:29:02 2018 +0000 @@ -420,7 +420,7 @@ oldErrorP = errorP; - if (abs(errorP) < 80.0f) { + if (abs(errorP) > 1.0f && abs(errorP) < 80.0f) { totalError = KP*errorP + KD*errorD; }/*else{ totalError = 0; @@ -547,19 +547,19 @@ }else if(avgSpeed > targetSpeed+5.0f && deceleration == false && acceleration == false && longMove == false) { - actSpeed = 50.0f; + actSpeed = 51.0f; }else if (avgSpeed < targetSpeed*2.8f && acceleration == true) { actSpeed = ACCEL_CONST * t.read()*60.0f; - }else if (avgSpeed > targetSpeed && deceleration == true) { + }else if (avgSpeed > targetSpeed+5.0f && deceleration == true) { actSpeed = targetSpeed*2.8f - ACCEL_CONST * t.read()*60.0f; }else if (avgSpeed < targetSpeed && deceleration == true) { - actSpeed = 50.0f; + actSpeed = 51.0f; } }