-
Notifications
You must be signed in to change notification settings - Fork 2
Gps Data Parsing
BROWN1213 edited this page Jun 15, 2018
·
2 revisions
GPS에서 실제로 나오는 데이터를 parsing해 봅시다
우선 passthru 코드를 통해 GPS 에서 어떤 신호가 나오는지 확인 합니다.
아래 코드는 cansat용 package가 arduino에 인스톨 되어야 합니다. 아래를 참고 하세요
https://github.com/cchamchi/cansat/wiki/Cansat-Package-install
#include <CansatSystem.h>
#include <CansatSerial.h>
static CansatHwSerial PLport(Serial1);
void setup() {
CansatSystemInit();
PLport.begin(9600);
Serial.begin(9600);
PLport.RxModePortSet(RxMode_GPS_PORT);
}
void loop() {
while (Serial.available()) Serial1.write(Serial.read());
while (Serial1.available()) Serial.write(Serial1.read());
}
아래의 데이터가 1초 간격으로 반복적으로 출력됩니다.
$GNGGA,064537.00,3723.06061,N,12707.40444,E,2,11,1.04,53.6,M,18.9,M,,0000*70
$GNGSA,A,3,08,26,27,31,50,16,21,23,42,,,,1.64,1.04,1.26*12
$GNGSA,A,3,74,85,,,,,,,,,,,1.64,1.04,1.26*11
$GPGSV,3,1,10,04,20,079,46,08,44,228,38,16,57,042,41,21,21,052,46*78
$GPGSV,3,2,10,23,32,241,42,26,35,074,48,27,88,298,47,31,11,137,43*70
$GPGSV,3,3,10,42,43,152,39,50,43,152,40*75
$GLGSV,1,1,04,74,38,102,42,75,,,32,85,77,100,34,,,,22*64
$GNGLL,3723.06061,N,12707.40444,E,064537.00,A,D*76
$GNRMC,064538.00,A,3723.06067,N,12707.40443,E,0.018,,050418,,,D*60
$GNVTG,,T,,M,0.018,N,0.034,K,D*36
각각의 의미는 http://navspark.mybigcommerce.com/content/NMEA_Format_v0.1.pdf 문서를 참고하세요
우리는 GGA,RMC,VTG 정보를 이용할 것입니다. GGA정보는 동일하니 아래 GPGGA포멧을 봅시다

$GNGGA,064537.00,3723.06061,N,12707.40444,E,2,11,1.04,53.6,M,18.9,M,,0000*70
- UTC는 064537.00 입니다. 06시 45분 37.00초 입니다.한국시간으로는 9를더한 15시47분37초네요
hour=
Dongwon Lee(https://github.com/cchamchi/cansat.wiki.git)