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_V9 by
Diff: Fahren.cpp
- Revision:
- 10:fb2195d0de0f
- Parent:
- 9:feabe0b7cea4
- Child:
- 11:474ad54d2595
--- a/Fahren.cpp Mon May 07 15:41:52 2018 +0000 +++ b/Fahren.cpp Tue May 08 09:07:37 2018 +0000 @@ -12,7 +12,7 @@ using namespace std; - +const float Fahren :: PERIOD = 5.0f; //Konstruktor Fahren::Fahren(Controller& controller, EncoderCounter& counterLeft, EncoderCounter& counterRight, IRSensor& iRSensor): @@ -20,11 +20,16 @@ SpeedR = 80.0f; SpeedL = 80.0f; disF = 0.0f; +//ticker.attach(callback(this, &Fahren::reset), PERIOD); } //Dekonstruktor -Fahren::~Fahren() {} +Fahren::~Fahren() { + //ticker.detach(); + } - +//void Fahren::reset(){ +//controller.resetEncoder(); +//} //Implementation der Methode geradeaus fahren geregelt void Fahren::geradeausG(){ @@ -34,8 +39,8 @@ initialClicksLeft = counterLeft.read(); //Anzahl Clicks die der Encoder zählen soll - wegRechts = 1776; - wegLinks = 1776; + wegRechts = 1769; + wegLinks = 1769; //Zustand, dass der Roboter nicht gestoppt hat @@ -46,7 +51,6 @@ while(1){ float diff = (iRSensor.readR() - iRSensor.readL())*0.9f; //Regler - if((diff < 1.5f) ||(diff > -1.5f)) diff = 0; if(iRSensor.readR()>60.0f) diff=0; if(iRSensor.readL()>60.0f) diff=0; //printf("diff =%f \n",diff); @@ -73,6 +77,7 @@ } if(stopRight == true && stopLeft == true){ + //controller.resetEncoder(); return; }