GPS module (GYSFDMAXB) 57600 bps

Dependencies:   Vector3

Dependents:   HAPS_GPS_Test_0001

GYSFDMAXB GPSセンサーGYSFDMAXBのライブラリ 57600 bps

手順 [1] シリアルピンを設定 GYSFDMAXB gps(tx_pin, rx_pin); [2] 零点を設定する(NED座標系における零点) gps.Initialize(); [3] 自動的にデータを受信しては更新していくので、適宜メンバ変数を読み込んで使う

Committer:
cocorlow
Date:
Mon Apr 26 08:18:48 2021 +0000
Revision:
10:8f574ff249bd
Parent:
9:8595608c56ca
GPS completed [volatile]

Who changed what in which revision?

UserRevisionLine numberNew contents of line
cocorlow 5:6fc37ae3f262 1 #ifndef __GYSFDMAXB_HPP__
cocorlow 5:6fc37ae3f262 2 #define __GYSFDMAXB_HPP__
cocorlow 5:6fc37ae3f262 3
cocorlow 5:6fc37ae3f262 4 #include "mbed.h"
cocorlow 5:6fc37ae3f262 5 #include "Vector3.hpp"
cocorlow 5:6fc37ae3f262 6
cocorlow 5:6fc37ae3f262 7 /*
cocorlow 5:6fc37ae3f262 8 $GPZDA,030049.971,06,04,2021,,*54
cocorlow 5:6fc37ae3f262 9 $GPGGA,030050.971,,,,,0,0,,,M,,M,,*41
cocorlow 5:6fc37ae3f262 10 $GPGLL,,,,,030050.971,V,N*73
cocorlow 5:6fc37ae3f262 11 $GPGSA,A,1,,,,,,,,,,,,,,,*1E
cocorlow 5:6fc37ae3f262 12 $GPGSV,1,1,00*79
cocorlow 5:6fc37ae3f262 13 $GPRMC,030050.971,V,,,,,0.00,0.00,060421,,,N*45
cocorlow 5:6fc37ae3f262 14 $GPVTG,0.00,T,,M,0.00,N,0.00,K,N*32
cocorlow 5:6fc37ae3f262 15 $GPZDA,030050.971,06,04,2021,,*5C
cocorlow 5:6fc37ae3f262 16 $GPGGA,030051.971,,,,,0,0,,,M,,M,,*40
cocorlow 5:6fc37ae3f262 17 $GPGLL,,,,,030051.971,V,N*72
cocorlow 5:6fc37ae3f262 18 $GPGSA,A,1,,,,,,,,,,,,,,,*1E
cocorlow 5:6fc37ae3f262 19 $GPGSV,1,1,00*79
cocorlow 5:6fc37ae3f262 20 $GPRMC,030051.971,V,,,,,0.00,0.00,060421,,,N*44
cocorlow 5:6fc37ae3f262 21 $GPVTG,0.00,T,,M,0.00,N,0.00,K,N*32
cocorlow 5:6fc37ae3f262 22 $GPZDA,030051.971,06,04,2021,,*5D
cocorlow 5:6fc37ae3f262 23 */
cocorlow 5:6fc37ae3f262 24
cocorlow 5:6fc37ae3f262 25
cocorlow 5:6fc37ae3f262 26 class GYSFDMAXB
cocorlow 5:6fc37ae3f262 27 {
cocorlow 5:6fc37ae3f262 28 private:
cocorlow 5:6fc37ae3f262 29 Serial serial;
cocorlow 5:6fc37ae3f262 30 volatile bool receive_flag;
cocorlow 5:6fc37ae3f262 31 const int start_size = 32;
cocorlow 5:6fc37ae3f262 32 char* uart_start[start_size];
cocorlow 5:6fc37ae3f262 33 volatile int start_index;
cocorlow 8:9b573e4c4a85 34 const int uart_size = 4096;
cocorlow 5:6fc37ae3f262 35 char uart_buffer[uart_size];
cocorlow 5:6fc37ae3f262 36 volatile int uart_index;
cocorlow 5:6fc37ae3f262 37 Ticker timer;
cocorlow 5:6fc37ae3f262 38
cocorlow 5:6fc37ae3f262 39 static const float Radius = 6378136.6f;
cocorlow 5:6fc37ae3f262 40
cocorlow 5:6fc37ae3f262 41 void Receive();
cocorlow 5:6fc37ae3f262 42 void Punctuate();
cocorlow 5:6fc37ae3f262 43
cocorlow 5:6fc37ae3f262 44 public:
cocorlow 5:6fc37ae3f262 45 // GPGGA
cocorlow 10:8f574ff249bd 46 volatile int Quality;
cocorlow 10:8f574ff249bd 47 volatile int Satellites;
cocorlow 10:8f574ff249bd 48 volatile float HDOP;
cocorlow 10:8f574ff249bd 49 volatile float Elevation;
cocorlow 10:8f574ff249bd 50 volatile char UnitElevation;
cocorlow 10:8f574ff249bd 51 volatile float GeoidElevation;
cocorlow 10:8f574ff249bd 52 volatile char UnitGeoidElevation;
cocorlow 5:6fc37ae3f262 53
cocorlow 5:6fc37ae3f262 54 // GPRMC
cocorlow 10:8f574ff249bd 55 volatile int Hours;
cocorlow 10:8f574ff249bd 56 volatile int Minutes;
cocorlow 10:8f574ff249bd 57 volatile int Seconds;
cocorlow 10:8f574ff249bd 58 volatile int Milliseconds;
cocorlow 10:8f574ff249bd 59 volatile char Status;
cocorlow 10:8f574ff249bd 60 volatile float Latitude;
cocorlow 10:8f574ff249bd 61 volatile char N_S;
cocorlow 10:8f574ff249bd 62 volatile float Longitude;
cocorlow 10:8f574ff249bd 63 volatile char E_W;
cocorlow 10:8f574ff249bd 64 volatile float Speed;
cocorlow 10:8f574ff249bd 65 volatile float Direction;
cocorlow 10:8f574ff249bd 66 volatile int Day;
cocorlow 10:8f574ff249bd 67 volatile int Month;
cocorlow 10:8f574ff249bd 68 volatile int Year;
cocorlow 10:8f574ff249bd 69 volatile float GeomagneticDeclination ;
cocorlow 10:8f574ff249bd 70 volatile char GeomagneticE_W;
cocorlow 10:8f574ff249bd 71 volatile char Mode;
cocorlow 5:6fc37ae3f262 72
cocorlow 5:6fc37ae3f262 73 Vector3 UniversalZeroPosition;
cocorlow 5:6fc37ae3f262 74 Vector3 UniversalZeroUnitN;
cocorlow 5:6fc37ae3f262 75 Vector3 UniversalZeroUnitE;
cocorlow 5:6fc37ae3f262 76 Vector3 UniversalZeroUnitD;
cocorlow 5:6fc37ae3f262 77 Vector3 UniversalPosition;
cocorlow 5:6fc37ae3f262 78 Vector3 Position;
cocorlow 5:6fc37ae3f262 79
cocorlow 5:6fc37ae3f262 80 GYSFDMAXB(PinName tx, PinName rx);
cocorlow 5:6fc37ae3f262 81 void Update();
cocorlow 5:6fc37ae3f262 82 void Initialize();
cocorlow 5:6fc37ae3f262 83 Vector3 ToUniversalUnit();
cocorlow 5:6fc37ae3f262 84 Vector3 ToUniversal();
cocorlow 5:6fc37ae3f262 85 void CalcurateUnit();
cocorlow 5:6fc37ae3f262 86 void Calcurate();
cocorlow 5:6fc37ae3f262 87 Vector3 Calcurate(Vector3 position);
cocorlow 5:6fc37ae3f262 88 };
cocorlow 5:6fc37ae3f262 89
cocorlow 5:6fc37ae3f262 90 #endif