UBX decode program that is modified from i2dforce UBX program for NAV-STATUS and NAV POSLLH. I used NEO-7M and mbed LPC1768.

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
Joeatsumi
Date:
Wed Dec 23 08:19:04 2020 +0000
Parent:
1:63a0fd33d5a5
Commit message:
modified ver3

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Mon Dec 21 16:49:18 2020 +0000
+++ b/main.cpp	Wed Dec 23 08:19:04 2020 +0000
@@ -1,7 +1,5 @@
 /*
 このプログラムはNEO-7MからUBX形式でUARTを介して位置、速度(NAV-VELNED)、測位状態(NAV-STATUS)を読み取るプログラムである。
-このプログラムには欠点があり、NAV-POSSLHとNAV-VELNEDを同時に読み取る事が出来ない点である。
-具体的には。1Hzでその3つの情報を
 */
 
 #include "mbed.h"
@@ -17,8 +15,12 @@
 int gps_Fix;
 float velN_float,velE_float,velD_float;
 
-int flag_posllh,flag_velned;
-//
+int flag_posllh,flag_velned;//UBXデータを処理したかどうかのフラグ
+
+//処理時間計測の為のタイマー
+Timer processing_timer;
+//処理時間
+int processed_time,processed_time_before,processed_time_after;
 
 //Header char
 const unsigned char UBX_HEADER[]        = { 0xB5, 0x62 };
@@ -95,7 +97,6 @@
   }
 }
 
-
 // Compares the first two bytes of the ubxMessage struct with a specific message header.
 // Returns true if the two bytes match.
 bool compareMsgHeader(const unsigned char* msgHeader) {
@@ -103,7 +104,6 @@
   return ptr[0] == msgHeader[0] && ptr[1] == msgHeader[1];
 }
 
-
 // Reads in bytes from the GPS module and checks to see if a valid message has been constructed.
 // Returns the type of the message found if successful, or MT_NONE if no message was found.
 // After a successful return the contents of the ubxMessage union will be valid, for the 
@@ -116,7 +116,9 @@
   
   static unsigned char currentMsgType = MT_NONE;
   static int payloadSize = sizeof(UBXMessage);
-
+  
+  processed_time_before = processing_timer.read_us();// captureing prossing time
+  
   while ( ublox_ubx.readable() ) {
     
     unsigned char c = ublox_ubx.getc();    
@@ -213,6 +215,9 @@
       }
     }
   }
+   processed_time_after = processing_timer.read_us();// captureing prossing time
+   processed_time=processed_time_after-processed_time_before;
+   
   return MT_NONE;
 }
 
@@ -226,15 +231,29 @@
     flag_posllh=0;
     flag_velned=0;
     
+    processing_timer.start();//timer starts
+    
     while(1) {
         int msgType = processGPS();
         
         if((flag_posllh==1)&&(flag_velned==1)){
-            pc.printf("latitude=%f,longitude=%f,height=%f\r\n",latitude,longitude,height_float);
-            pc.printf("velN=%f,velE=%f,velD=%f\r\n",velN_float,velE_float,velD_float);
             
+            /*Teratermでロギングする用の表示*/
+            pc.printf("%f,%f,%f,%f,%f,%f\r\n",latitude,longitude,height_float,velN_float,velE_float,velD_float);
+            /*計測ではなくデバッグ用の表示*/
+            //pc.printf("latitude=%f,longitude=%f,height=%f\r\n",latitude,longitude,height_float);
+            //pc.printf("velN=%f,velE=%f,velD=%f\r\n",velN_float,velE_float,velD_float);
+            //pc.printf("processed_time(us)=%d\r\n",processed_time);
+            
+            
+            /*processGPSの処理時間の表示*/
+            //pc.printf("processed_time_before(us)=%d\r\n",(processed_time_before));
+            //pc.printf("processed_time_after(us)=%d\r\n",(processed_time_after));
+            
+            /*フラグを0に戻す*/
             flag_posllh=0;
             flag_velned=0;
+            
             }
         else{}
         /*