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:
41:5fe200d20022
Parent:
40:0aa1cefe80ab
--- a/hardware.h	Tue May 15 10:34:35 2018 +0000
+++ b/hardware.h	Tue May 22 19:43:09 2018 +0000
@@ -36,7 +36,7 @@
 Thread  *_distanceThread;
 
 
-InterruptIn*    _interruptPort =    new InterruptIn(p28);
+InterruptIn*    _interruptPin =    new InterruptIn(p28);
 PwmOut*         _roll =             new PwmOut(p21);
 PwmOut*         _pitch =            new PwmOut(p22);
 PwmOut*         _throttle =         new PwmOut(p23);
@@ -53,18 +53,19 @@
 float _P = 0;
 float _I = 0;
 float _D = 0;
-float _groundSetPoint = 0;
-float _bias = 0;
-float _groundPidMinOutput = 0;
-float _groundPidMaxOutput = 0;
+int _groundSetPoint = 0;
+int _bias = 0;
+int _groundPidMinOutput = 0;
+int _groundPidMaxOutput = 0;
 bool _groundRegulation = false;
 // Temporary values for Server to filter noise
 float _newP;
 float _newI;
 float _newD;
-float _newGroundSetPoint;
+int _newGroundSetPoint;
 bool _tempGroundRegulation = false;
 bool _goAhead = false;
+bool _backWall = true;
 bool _frontWall = false;
 
 
@@ -72,6 +73,7 @@
 
 
 
+
 void loadConfigFile(void){
     //reading configFile
     _configFile.read("/local/config.cfg");
@@ -133,7 +135,7 @@
 //Converts float to char array
 void ConvertToCharArray(float number)
 {
-    sprintf(_str, "%3.6f", number );  
+    sprintf(_str, "%3.2f", number );  
 }
 
 //Converts integer to char array