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
Fork of Roboshark_V6 by
Diff: Fahren.cpp
- Revision:
- 8:a7f1ee7840d0
- Parent:
- 7:862d80e0ea2d
- Child:
- 9:bdbf4447b55e
diff -r 862d80e0ea2d -r a7f1ee7840d0 Fahren.cpp --- a/Fahren.cpp Fri May 04 16:26:59 2018 +0000 +++ b/Fahren.cpp Sun May 06 14:17:07 2018 +0000 @@ -16,7 +16,7 @@ //Konstruktor Fahren::Fahren(Controller& controller, EncoderCounter& counterLeft, EncoderCounter& counterRight, Regler& regler, int reglerEin): - controller(controller), counterLeft(counterLeft), counterRight(counterRight), regler(regler), reglerEin(reglerEin){ + controller(controller), counterLeft(counterLeft), counterRight(counterRight), regler(regler), reglerEin(reglerEin) { //IRSENSOR IETAH SpeedR = 50; SpeedL = 50; @@ -34,8 +34,8 @@ if(reglerEin == 1){ SpeedR = regler.getSpeedR(); SpeedL = regler.getSpeedL(); - }else {SpeedR = 50; - SpeedL = 50; + }else {SpeedR = regler.getSpeedR(); + SpeedL = regler.getSpeedL(); } //printf("SpeedR in F = %f\n",SpeedR); @@ -100,15 +100,14 @@ initialClicksLeft = counterLeft.read(); //Anzahl Clicks die der Encoder zählen soll - wegRechts = 1773; - wegLinks = 1773; + wegRechts = 1788; //vo 1773 + wegLinks = 1788; //vo 1773 //Geschwindigkeit //speedRight = 50;//SpeedR //speedLeft = 50;//SpeedL - - + //Zustand, dass der Roboter nicht gestoppt hat stopRight = false; stopLeft = false; @@ -116,8 +115,8 @@ //Drehrichtung der Motoren controller.setDesiredSpeedRight(SpeedR); controller.setDesiredSpeedLeft(-(SpeedL)); - printf("SpeedR in F2= %f\n",SpeedR); - printf("SpeedL in F2= %f\n",SpeedL); + //printf("SpeedR in F2= %f\n",SpeedR); + //printf("SpeedL in F2= %f\n",SpeedL); while(1){ @@ -131,7 +130,7 @@ } //If Schleife, wenn Clicks erreicht sind, muss der Motor stoppen - if(counterLeft.read() - initialClicksLeft >= wegLinks || counterLeft.read() - initialClicksLeft <= -wegLinks ){ + if(counterLeft.read() - initialClicksLeft >= wegLinks || counterLeft.read() - initialClicksLeft <= -wegLinks){ controller.setDesiredSpeedLeft(0); stopLeft = true; } @@ -152,22 +151,22 @@ initialClicksLeft = counterLeft.read(); //Anzahl Clicks die der Encoder zählen soll - wegRechts = 868; - wegLinks = 868; + wegRechts = 863; + wegLinks = 863; //Geschwindigkeit - //speedRight = 50; - //speedLeft = 50; + speedRight = 50; + speedLeft = 50; //Zustand, dass der Roboter nicht gestoppt hat stopRight = false; stopLeft = false; //Drehrichtung der Motoren - controller.setDesiredSpeedRight((SpeedR)); - controller.setDesiredSpeedLeft((SpeedL)); - //printf("SpeedR in F = %f\n",SpeedR); - //printf("SpeedL in F = %f\n",SpeedL); + controller.setDesiredSpeedRight(SpeedR); + controller.setDesiredSpeedLeft(SpeedL); + //printf("SpeedR in F = %f\n", SpeedR); + //printf("SpeedL in F = %f\n", SpeedL); while(1){ // printf("Encoderrechts %d \n\r", counterRight.read()); //Debugging Zweck (Putty benutzen!)