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: MotorDriver.cpp
- Revision:
- 7:b5bf886ae13c
- Parent:
- 1:056cd61800e9
- Child:
- 8:73c8188916dc
--- a/MotorDriver.cpp Mon Apr 30 13:53:09 2018 +0000 +++ b/MotorDriver.cpp Mon Apr 30 13:55:37 2018 +0000 @@ -68,11 +68,11 @@ //printf("%f\n",CorrectFactor); if(abs(CorrectFactor) <= 5.0f) { //erkennt Wand oder Lücke auf linker Seite - controller.setDesiredSpeedLeft((Speed * (-1.0f)) - CorrectFactor); //Bei Wand wird korrigiert - controller.setDesiredSpeedRight(Speed - CorrectFactor); + controller.setDesiredSpeedLeft((Speed) - CorrectFactor); //Bei Wand wird korrigiert + controller.setDesiredSpeedRight((Speed * (-1.0f)) - CorrectFactor); } else { - controller.setDesiredSpeedLeft(Speed * (-1.0f)); //Bei Lücke wird nach Counter gefahren - controller.setDesiredSpeedRight(Speed); + controller.setDesiredSpeedRight(Speed * (-1.0f)); //Bei Lücke wird nach Counter gefahren + controller.setDesiredSpeedLeft(Speed); } if(distance_front <= 3) @@ -104,8 +104,8 @@ int turnLeft(int direction) { - controller.setDesiredSpeedLeft(-15.0f); // Drehzahl in [rpm] bei 31/1 enspricht es ca. 374/min - controller.setDesiredSpeedRight(-15.0f); + controller.setDesiredSpeedRight(-15.0f); // Drehzahl in [rpm] bei 31/1 enspricht es ca. 374/min + controller.setDesiredSpeedLeft(-15.0f); while(((abs(counterLeft.read())+abs(counterRight.read()))/2)<= 590) { //do nothing } @@ -140,8 +140,8 @@ void driveDist(int Distance, int Direction) { - controller.setDesiredSpeedLeft(-20.0f*Direction); // Drehzahl in [rpm] - controller.setDesiredSpeedRight(20.0f*Direction); + controller.setDesiredSpeedRight(-20.0f*Direction); // Drehzahl in [rpm] + controller.setDesiredSpeedLeft(20.0f*Direction); while(((abs(counterLeft.read())+abs(counterRight.read()))/2)<= 100*Distance) { //Fährt bis Anzahl umdrehungen erreicht sind