---
Dependencies: mbed
Fork of MicroMouse_MASTER_FIVE by
Revision 11:8c8dba56bfda, committed 2018-05-23
- Comitter:
- TheDarkDurzo
- Date:
- Wed May 23 17:59:26 2018 +0000
- Parent:
- 10:e8110fb94686
- Commit message:
- ---
Changed in this revision
Drive.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/Drive.cpp Tue May 22 14:20:20 2018 +0000 +++ b/Drive.cpp Wed May 23 17:59:26 2018 +0000 @@ -7,9 +7,9 @@ using namespace std; -const float Drive::FRONTDISTANCE = 70.0f; //Abstand Sensor zur VorderWand //DONT TOUCH //62.0f //55.0 110.0 +const float Drive::FRONTDISTANCE = 73.0f; //Abstand Sensor zur VorderWand //DONT TOUCH //62.0f //55.0 110.0 const float Drive::DRIVINGSPEED = 130.0f;//Fahrgeschwindigkeit Drehzahl in [rpm] //130.0f -const int Drive::DRIVINGCOUNTS = 1380; //Entspricht Strecke von 20cm //DONT TOUCH /1773 //1800 //1350 /////1390 +const int Drive::DRIVINGCOUNTS = 1390; //Entspricht Strecke von 20cm //DONT TOUCH /1773 //1800 //1350 /////1390 Drive::Drive(KontrastSensor& kontrastSensor, EncoderCounter& counterLeft, EncoderCounter& counterRight, Controller& controller, IRSensor& irSensor0, IRSensor& irSensor1, IRSensor& irSensor2, IRSensor& irSensor3, int& dontStop, int& modeStart, int& path, int& pathNext): kontrastSensor(kontrastSensor), @@ -55,6 +55,10 @@ if(dontStop == 2) { //geradeaus softStart =0.0f; + + /********/ + //countCorrection = -400.0f; + /*******/ } int drive; @@ -125,7 +129,7 @@ //Berechung Korrektur - speedCorrection = ((0.3f * rightLeftDif) + (0.6f * parallelDif) + (0.6f * leftDif) + (0.6f * rightDif)); //DONT TOUCH 0.35 0.7 0.7 0.7 + speedCorrection = ((0.45f * rightLeftDif) + (0.7f * parallelDif) + (0.9f * leftDif) + (0.9f * rightDif)); //DONT TOUCH 0.35 0.7 0.7 0.7 //Anfahrrampe damit die Raeder nicht durchdrehen @@ -151,13 +155,13 @@ drive = 0; } - } else if((((DRIVINGCOUNTS - countsRight) < 220) || ((countsLeft + DRIVINGCOUNTS) < 220)) && ((irSensor2.read() > 120.0f) && ((modeStart != 1) || (pathNext == 2)))) { //Anhaltrampe wenn nach counts gefahren + } else if((((DRIVINGCOUNTS - countsRight) < 250) || ((countsLeft + DRIVINGCOUNTS) < 250)) && ((irSensor2.read() > 120.0f) && ((modeStart != 1) || (pathNext == 2)))) { //Anhaltrampe wenn nach counts gefahren slowdown = slowdown + 5.0f; if (slowdown >= DRIVINGSPEED - 20.0f) { slowdown = DRIVINGSPEED - 20.0f; } - } else if((((DRIVINGCOUNTS - countsRight) < 220) || ((countsLeft + DRIVINGCOUNTS) < 220)) && ((irSensor0.read() > 120.0f) && ((modeStart == 1) && (pathNext == 3)))) { //Anhaltrampe wenn nach counts gefahren + } else if((((DRIVINGCOUNTS - countsRight) < 250) || ((countsLeft + DRIVINGCOUNTS) < 250)) && ((irSensor0.read() > 120.0f) && ((modeStart == 1) && (pathNext == 3)))) { //Anhaltrampe wenn nach counts gefahren slowdown = slowdown + 5.0f; if (slowdown >= DRIVINGSPEED - 20.0f) {