Regenerating PPM signal based on distances from ultrasonic sensors, ESP8266 for connectin via wifi. Autonomous quadcopter behaviour, autonomou height holding. Flying direction based on front and back ultrasonic sensors.
Dependencies: ConfigFile HCSR04 PID PPM2 mbed-rtos mbed
Diff: main.cpp
- Branch:
- DistanceRegulation
- Revision:
- 26:11539036f0fb
- Parent:
- 25:69190c222dbf
- Child:
- 27:5956d5e3ff63
diff -r 69190c222dbf -r 11539036f0fb main.cpp --- a/main.cpp Sun Nov 26 17:27:39 2017 +0000 +++ b/main.cpp Fri Dec 01 11:11:23 2017 +0000 @@ -18,6 +18,8 @@ //FUNCTIONS void print_ppmIn(void); +//RtosTimer distanceRegulation(distanceRegulationTask, osTimerPeriodic, (void *)0); + int main(){ pc.baud(115200); @@ -25,13 +27,16 @@ // INITIALIZE CLASSES _ppmRegen = new PpmRegen(_interruptPort); _sonic = new HCSR04(p29, p30); - _groundDistance = new PID(0, 0, 0, 10); + _groundDistance = new PID(0, 0, 0, 0.002); // STARTING THREADS serverThread.start(serverRun); - distanceThread.start(distanceRegulationThread); + //_distanceThread = new Thread(distanceRegulationThread); + //_distanceThread->set_priority(osPriorityRealtime); + //distanceRegulation.start(2); + _distanceThread.start(distanceRegulationTask); - wait(1); + //wait(1); while(1){ Thread::wait(osWaitForever);