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:
- 32:c729e6da7f9a
- Parent:
- 31:5f1737e480f3
- Child:
- 33:a2f9fea05cb9
diff -r 5f1737e480f3 -r c729e6da7f9a main.cpp --- a/main.cpp Sun Feb 04 15:21:12 2018 +0000 +++ b/main.cpp Sat Feb 17 15:48:49 2018 +0000 @@ -31,10 +31,10 @@ //setup PID loadConfigFile(); + _newP = _P; + _newI = _I; + _newD = _D; // to show values in web browser after first load - _tempP = _P; - _tempI = _I; - _tempD = _D; _groundDistance->setInputLimits(0, 300); _groundDistance->setMode(AUTO_MODE); _groundDistance->setTunings(_P, _I, _D); @@ -42,8 +42,10 @@ _groundDistance->setBias(_bias); // STARTING THREADS + printf("starting server thread \n\r"); serverThread.start(serverRun); - serverThread.set_priority(osPriorityLow); + serverThread.set_priority(osPriorityHigh); + printf("starting distance thread \n\r"); _distanceThread = new Thread(distanceRegulationThread); _distanceThread->set_priority(osPriorityRealtime); //distanceRegulation.start(2);