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_V10 by
Revision 16:2623db4996af, committed 2018-05-21
- Comitter:
- fluckmi1
- Date:
- Mon May 21 20:18:21 2018 +0000
- Parent:
- 15:8e8b23d4abb4
- Commit message:
- Michi mit ertestete wert;
Changed in this revision
Fahren.cpp | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/Fahren.cpp Tue May 15 21:50:26 2018 +0000 +++ b/Fahren.cpp Mon May 21 20:18:21 2018 +0000 @@ -17,8 +17,8 @@ //Konstruktor Fahren::Fahren(Controller& controller, EncoderCounter& counterLeft, EncoderCounter& counterRight, IRSensor& iRSensor): controller(controller), counterLeft(counterLeft), counterRight(counterRight), iRSensor (iRSensor){ -SpeedR = 90.0f; //120 -SpeedL = 90.0f; //120 +SpeedR = 100.0f; //100 isch noice +SpeedL = 100.0f; //100 disF = 0.0f; //ticker.attach(callback(this, &Fahren::reset), PERIOD); } @@ -39,8 +39,8 @@ initialClicksLeft = counterLeft.read(); //Anzahl Clicks die der Encoder zählen soll - wegRechts = 1675; - wegLinks = 1675; + wegRechts = 1742; //1675 bis anhin , 1802 fahrt er ufm tisch gnau 20cm würkt im labyrinth aber nach zvil / 1733 + wegLinks = 1742; //Zustand, dass der Roboter nicht gestoppt hat @@ -50,27 +50,27 @@ reglerEinL = 1; while(1){ - float diff = (iRSensor.readR() - iRSensor.readL())*0.95f; //Regler 0.81 + float diff = (iRSensor.readR() - iRSensor.readL())*0.86f; //Regler 0.81 / 0.95 workt /0.25 scheisse /0.55 naja geht aber gaga if(iRSensor.readR()>80.0f) diff= 0; if(iRSensor.readL()>80.0f) diff= 0; //printf("diff =%f \n",diff); controller.setDesiredSpeedRight(SpeedR+diff); controller.setDesiredSpeedLeft(-(SpeedL-diff)); - printf("diff = %f\n",diff); + //printf("diff = %f\n",diff); wait(0.02); //0.02 // printf("Encoderrechts %d \n\r", counterRight.read()); //Debugging Zweck (Putty benutzen!) // printf("Encoderlinks %d \n\r", counterLeft.read()); //Debugging Zweck (Putty benutzen!) //If Schleife, wenn Clicks erreicht sind, muss der Motor stoppen - if(counterRight.read() - initialClicksRight >= wegRechts || counterRight.read() - initialClicksRight <= -wegRechts || iRSensor.readF() < 50.0f){ + if(counterRight.read() - initialClicksRight >= wegRechts || counterRight.read() - initialClicksRight <= -wegRechts || iRSensor.readF() < 55.0f){ //50 standard controller.setDesiredSpeedRight(0); stopRight = true; reglerEinR = 0; } //If Schleife, wenn Clicks erreicht sind, muss der Motor stoppen - if(counterLeft.read() - initialClicksLeft >= wegLinks || counterLeft.read() - initialClicksLeft <= -wegLinks || iRSensor.readF() < 50.0f){ + if(counterLeft.read() - initialClicksLeft >= wegLinks || counterLeft.read() - initialClicksLeft <= -wegLinks || iRSensor.readF() < 55.0f){ //50 standard controller.setDesiredSpeedLeft(0); stopLeft = true; reglerEinL = 0; @@ -93,16 +93,16 @@ initialClicksLeft = counterLeft.read(); //Anzahl Clicks die der Encoder zählen soll - wegRechts = 868; - wegLinks = 868; + wegRechts = 868; //868 guter Wert + wegLinks = 868; //868 guter Wert //Zustand, dass der Roboter nicht gestoppt hat stopRight = false; stopLeft = false; //Drehrichtung der Motoren - controller.setDesiredSpeedRight((SpeedR)); - controller.setDesiredSpeedLeft((SpeedL)); + controller.setDesiredSpeedRight((SpeedR+20.0f)); + controller.setDesiredSpeedLeft((SpeedL+20.0f)); //printf("SpeedR in F = %f\n",SpeedR); //printf("SpeedL in F = %f\n",SpeedL); while(1){ @@ -148,8 +148,8 @@ stopLeft = false; //Drehrichtung der Motoren - controller.setDesiredSpeedRight((SpeedR)); - controller.setDesiredSpeedLeft((SpeedL)); + controller.setDesiredSpeedRight((SpeedR+30.0f)); + controller.setDesiredSpeedLeft((SpeedL+30.0f)); while(1){ @@ -193,8 +193,8 @@ stopLeft = false; //Drehrichtung der Motoren - controller.setDesiredSpeedRight((-SpeedR)); - controller.setDesiredSpeedLeft((-SpeedL)); + controller.setDesiredSpeedRight((-SpeedR-20.0f)); + controller.setDesiredSpeedLeft((-SpeedL-20.0f)); while(1){
--- a/main.cpp Tue May 15 21:50:26 2018 +0000 +++ b/main.cpp Mon May 21 20:18:21 2018 +0000 @@ -3,7 +3,7 @@ Erstellt: J. Blunschi geändert: V.Ahlers V.5.18 -main zu Robishark +main zu Roboshark */ @@ -127,8 +127,10 @@ printf("IR Front = %d\n",IrF);*/ switch(links) { - case 0: // State machine für methode Rechts - if((IrR==0) && (IrL==0) && (IrF==1) && (ende == 0)){ + case 0: + if((IrR==0) && (IrL==0) && (IrF==0) && (ende == 0)){ + caseDrive = 2; // State machine für methode Rechts + } else if((IrR==0) && (IrL==0) && (IrF==1) && (ende == 0)){ caseDrive = 2; } else if ((IrR==0) && (IrL==1) && (IrF==0) && (ende == 0)){ caseDrive = 2; @@ -174,9 +176,9 @@ } - printf("ende = %d\n",ende); + //printf("ende = %d\n",ende); - wait (0.01); + wait (0.01); //0.01