修正済みby皆川

Dependencies:   mbed Servo cansat_integrated_2 BMP180

Dependents:   cansat_integrated_2

Revision:
3:a583276d9fef
Parent:
2:d2cb6b50a8c4
Child:
4:6e24a1b3edca
--- a/main.cpp	Wed Oct 27 20:59:02 2021 +0000
+++ b/main.cpp	Thu Oct 28 07:57:02 2021 +0000
@@ -1,69 +1,11 @@
 #include "mbed.h"
 #include "BMP180.h"
 #include "direction.h"
-#include "math.h"
+#include "Landing_Judgement.h"
 #define PIN_SDA D4
 #define PIN_SCL D5
 
-GPS gps(D1, D0);
 DigitalOut Nichrome(A6);
-BMP180 bmp180(PIN_SDA,PIN_SCL);
-double bias_la=0,bias_lo=0;
-    
-int landing_judgement(){
-    
-    int x ,y ,n1 , n2 ;
-    int landing_judgement=0 ;
-    float h,dp,dt,dp0;
-    float a ,b ,dp_ave,dt_ave;
-    
-    bmp180.Initialize(27,BMP180_OSS_ULTRA_LOW_POWER);//27は府大の海抜高度
-    
-    for(int i=0;i<15;i++){
-        if(bmp180.ReadData(&dt,&dp)){
-            a = a + dp;
-            b = b + dt;
-            n1 = n1 + 1;
-            n2 = n2 + 1;
-            wait(1);
-            }
-        }
-    
-    dp_ave = a / n1;
-    dt_ave = b / n2;    
-    dp0 = calculate_dp0(dp_ave,dt_ave);
-    
-    while(x<10){
-            if(bmp180.ReadData(&dt,&dp)){
-                h = calculate_h(dp0,dp,dt);
-                if(h >= 30){
-                x = x + 1;
-                    }
-                wait(1);
-            }
-    }
-    //10秒以上高度30mにいた場合離陸判定
-    
-    wait(10);
-      
-    while(y<10){
-            if(bmp180.ReadData(&dt,&dp)){
-                h = calculate_h(dp0,dp,dt); 
-                if(h <= 10){
-                y = y + 1;
-                    }
-                wait(1);
-            }
-    }
-    
-    wait(5);
-    
-    landing_judgement = landing_judgement + 1;
-    return landing_judgement;
-    
-    //離陸判定後、10秒以上高度10m以下にいた場合着地判定
-    
-}        
              
 int parachute_separation()
 {
@@ -80,7 +22,7 @@
 //着地判定
 while(1)
 {
-    land_judgement_1 = landing_judgement();
+    land_judgement_1 = Landing_Judgement.landing_judgement();
     if(land_judgement_1==1)
     {
         break;