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

Branch:
DistanceRegulation
Revision:
31:5f1737e480f3
Parent:
27:5956d5e3ff63
Child:
32:c729e6da7f9a
--- a/main.cpp	Sat Jan 20 12:09:04 2018 +0000
+++ b/main.cpp	Sun Feb 04 15:21:12 2018 +0000
@@ -29,6 +29,18 @@
     _sonic = new HCSR04(p29, p30);
     _groundDistance = new PID(0, 0, 0, 0.005);
     
+    //setup PID
+    loadConfigFile();
+    // 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);
+    _groundDistance->setOutputLimits(_groundPidMinOutput, _groundPidMaxOutput);
+    _groundDistance->setBias(_bias);
+
     // STARTING THREADS
     serverThread.start(serverRun);
     serverThread.set_priority(osPriorityLow);