Helvijs Kiselis
/
Micromouse
Algorithmus
Diff: Motion.cpp
- Revision:
- 33:836ab2089565
- Parent:
- 32:e984b7959cb0
- Child:
- 34:0587c0943263
--- a/Motion.cpp Wed May 23 01:34:36 2018 +0000 +++ b/Motion.cpp Wed May 23 12:30:39 2018 +0000 @@ -153,6 +153,10 @@ if (distanceC < 100.0f && lastMove == false) { break; + }else if ( ((countsL - countsLOld) >= 824 || (countsR - countsROld) <= -824) && (distanceC >= 100.0f) && (distanceC < 120.0f) ) { + countsLOld += 100; + countsROld -= 100; + //Stop after certain distance if side wall missing }else if ( (distanceL > 80.0f || distanceR > 80.0f) && lastMove == false && deceleration == true && distanceC < 190.0f) { @@ -162,7 +166,7 @@ countsL = counterLeft.read(); countsR = counterRight.read(); - while ((countsL - countsLOld) < 300.0f || (countsR - countsROld) > -300.0f) { + while ((countsL - countsLOld) < 250.0f || (countsR - countsROld) > -250.0f) { countsL = counterLeft.read(); countsR = counterRight.read(); accel(RUN_SPEED); @@ -524,7 +528,7 @@ longMove = true; deceleration = false; - }else if (reverse == false && path[task+1] == path[task] && ( path[task-1] != path[task] || task == 0) ) { //same as above, also if start field + }else if (reverse == false && path[task+1] == path[task] && ( path[task-1] != path[task] || task == 0 || path[task-1] != 4) ) { //same as above, also if start field acceleration = true; longMove = true;