CORE / Mbed 2 deprecated 2019_nosiro_GeminiQuest_CanSat

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
ishiyamayuto
Date:
Wed Aug 21 09:15:30 2019 +0000
Parent:
1:2b0573b2e9f8
Commit message:
LPC1768,MPU9250; launch -> acceleration land -> time goal -> GPS

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 2b0573b2e9f8 -r 59effa94b6e2 main.cpp
--- a/main.cpp	Wed Aug 21 08:59:41 2019 +0000
+++ b/main.cpp	Wed Aug 21 09:15:30 2019 +0000
@@ -1,4 +1,5 @@
 /*2019.8 能代打ち上げ実験 CanSat用プログラム*/
+/*動作試験も本番も全く動かすことなく終わってしまったため,予想と異なる動きをする可能性がある(サイドスラスターの動く無機など).*/
 #include "mbed.h"                   
 #include "MPU9250.h"
 #include "math.h"
@@ -247,7 +248,7 @@
 /*usbに1,2のデータを書き込むvoid型関数*/
 {
     FILE *fp= fopen("/usb/test.txt", "a");
-    fprintf(fp,"\n%d,",time);
+    fprintf(fp,"\n%d,",time);//ファイルはCSV表記で記録し,エクセルでインポート出来るようにする
     fprintf(fp,"%f,",gps_x);
     fprintf(fp,"%f,",gps_y);
 }
@@ -372,13 +373,13 @@
 /*目標ベクトルを8つの方向変数の内から返す*/
 {
     int o_vector;
-    if(dis_x == 0){
-        if(0 < dis_y){
-            o_vector = n_n;
-        }else{
-            o_vector = s_s;
+    if(dis_x == 0){//x方向で目標との距離がない場合
+        if(0 < dis_y){//ベクトルがy方向に正の値を示す場合
+            o_vector = n_n;//機体は北を向いているということ
+        }else{//
+            o_vector = s_s;//機体は南を向いているということ(x=0かつy=0となってもs_sを入れることになるが,実際はそうなる前にゴール判定が下されているはず)    
         }
-    }else if(dis_y == 0){
+    }else if(dis_y == 0){//y方向で目標との距離がない場合(以下同じように考える)
         if(0 < dis_x){
             o_vector = e_e;
         }else{