From 4f02edac51b13c2c2682315d8bafe00513ae8a6c Mon Sep 17 00:00:00 2001 From: jasonshort Date: Sun, 29 Aug 2010 22:08:33 +0000 Subject: [PATCH] New GPS Lib git-svn-id: https://arducopter.googlecode.com/svn/trunk@342 f9c3cf11-9bcb-44bc-f272-b75c42450872 --- libraries/AP_GPS/AP_GPS_IMU.cpp | 1 + libraries/AP_GPS/AP_GPS_IMU.h | 4 ++-- libraries/AP_GPS/AP_GPS_MTK.cpp | 13 ++++++++----- libraries/AP_GPS/AP_GPS_MTK.h | 4 ++-- libraries/AP_GPS/AP_GPS_NMEA.cpp | 1 + libraries/AP_GPS/AP_GPS_NMEA.h | 6 ++---- libraries/AP_GPS/AP_GPS_UBLOX.cpp | 3 ++- libraries/AP_GPS/AP_GPS_UBLOX.h | 8 ++++---- 8 files changed, 22 insertions(+), 18 deletions(-) diff --git a/libraries/AP_GPS/AP_GPS_IMU.cpp b/libraries/AP_GPS/AP_GPS_IMU.cpp index 8b20c4a7f6..dcfe13380c 100755 --- a/libraries/AP_GPS/AP_GPS_IMU.cpp +++ b/libraries/AP_GPS/AP_GPS_IMU.cpp @@ -27,6 +27,7 @@ */ #include "AP_GPS_IMU.h" +#include "WProgram.h" // Constructors //////////////////////////////////////////////////////////////// diff --git a/libraries/AP_GPS/AP_GPS_IMU.h b/libraries/AP_GPS/AP_GPS_IMU.h index 3c2269a456..19bc4d4ba2 100755 --- a/libraries/AP_GPS/AP_GPS_IMU.h +++ b/libraries/AP_GPS/AP_GPS_IMU.h @@ -1,10 +1,10 @@ #ifndef AP_GPS_IMU_h #define AP_GPS_IMU_h -#include "AP_GPS.h" +#include #define MAXPAYLOAD 32 -class AP_GPS_IMU : public AP_GPS +class AP_GPS_IMU : public GPS { public: // Methods diff --git a/libraries/AP_GPS/AP_GPS_MTK.cpp b/libraries/AP_GPS/AP_GPS_MTK.cpp index e48f8a518e..5feac81c11 100644 --- a/libraries/AP_GPS/AP_GPS_MTK.cpp +++ b/libraries/AP_GPS/AP_GPS_MTK.cpp @@ -1,6 +1,6 @@ /* - AP_GPS_MTK.cpp - Ublox GPS library for Arduino - Code by Jordi MuÃ’oz and Jose Julio. DIYDrones.com + GPS_MTK.cpp - Ublox GPS library for Arduino + Code by Jordi Munoz and Jose Julio. DIYDrones.com This code works with boards based on ATMega168 / 328 and ATMega1280 (Serial port 1) This library is free software; you can redistribute it and / or @@ -28,6 +28,7 @@ */ #include "AP_GPS_MTK.h" +#include "WProgram.h" // Constructors //////////////////////////////////////////////////////////////// AP_GPS_MTK::AP_GPS_MTK() @@ -38,6 +39,8 @@ AP_GPS_MTK::AP_GPS_MTK() // Public Methods ////////////////////////////////////////////////////////////// void AP_GPS_MTK::init(void) { + Serial.print("$PGCMD,16,0,0,0,0,0*6A\r\n"); + ck_a = 0; ck_b = 0; step = 0; @@ -146,15 +149,15 @@ AP_GPS_MTK::parse_gps(void) //Checking the UBX ID case 0x05: // ID Custom j = 0; - lattitude= join_4_bytes(&buffer[j]); // lon * 10000000 + lattitude= join_4_bytes(&buffer[j]) * 10; // lon * 10000000 j += 4; - longitude = join_4_bytes(&buffer[j]); // lat * 10000000 + longitude = join_4_bytes(&buffer[j]) * 10; // lat * 10000000 j += 4; altitude = join_4_bytes(&buffer[j]); // MSL j += 4; speed_3d = ground_speed = join_4_bytes(&buffer[j]); j += 4; - ground_course = join_4_bytes(&buffer[j]); + ground_course = join_4_bytes(&buffer[j]) / 10000; j += 4; num_sats = buffer[j]; j++; diff --git a/libraries/AP_GPS/AP_GPS_MTK.h b/libraries/AP_GPS/AP_GPS_MTK.h index 1135a1421b..4b8c5f1a4b 100644 --- a/libraries/AP_GPS/AP_GPS_MTK.h +++ b/libraries/AP_GPS/AP_GPS_MTK.h @@ -1,10 +1,10 @@ #ifndef AP_GPS_MTK_h #define AP_GPS_MTK_h -#include +#include #define MAXPAYLOAD 32 -class AP_GPS_MTK : public AP_GPS +class AP_GPS_MTK : public GPS { public: // Methods diff --git a/libraries/AP_GPS/AP_GPS_NMEA.cpp b/libraries/AP_GPS/AP_GPS_NMEA.cpp index 0d706c46ad..1d9be6f34f 100644 --- a/libraries/AP_GPS/AP_GPS_NMEA.cpp +++ b/libraries/AP_GPS/AP_GPS_NMEA.cpp @@ -37,6 +37,7 @@ NOTE : This code has been tested on a Locosys 20031 GPS receiver (MTK chipset) */ #include "AP_GPS_NMEA.h" +#include "WProgram.h" // Constructors //////////////////////////////////////////////////////////////// AP_GPS_NMEA::AP_GPS_NMEA() diff --git a/libraries/AP_GPS/AP_GPS_NMEA.h b/libraries/AP_GPS/AP_GPS_NMEA.h index 75d3b88ea3..492e479131 100644 --- a/libraries/AP_GPS/AP_GPS_NMEA.h +++ b/libraries/AP_GPS/AP_GPS_NMEA.h @@ -1,10 +1,10 @@ #ifndef AP_GPS_NMEA_h #define AP_GPS_NMEA_h -#include "AP_GPS.h" +#include #define GPS_BUFFERSIZE 120 -class AP_GPS_NMEA : public AP_GPS +class AP_GPS_NMEA : public GPS { public: // Methods @@ -30,6 +30,4 @@ class AP_GPS_NMEA : public AP_GPS }; -extern AP_GPS_NMEA GPS; - #endif \ No newline at end of file diff --git a/libraries/AP_GPS/AP_GPS_UBLOX.cpp b/libraries/AP_GPS/AP_GPS_UBLOX.cpp index 90cf202cfe..1665db6699 100644 --- a/libraries/AP_GPS/AP_GPS_UBLOX.cpp +++ b/libraries/AP_GPS/AP_GPS_UBLOX.cpp @@ -1,5 +1,5 @@ /* - AP_GPS_UBLOX.cpp - Ublox GPS library for Arduino + GPS_UBLOX.cpp - Ublox GPS library for Arduino Code by Jordi Muñoz and Jose Julio. DIYDrones.com This code works with boards based on ATMega168/328 and ATMega1280 (Serial port 1) @@ -34,6 +34,7 @@ */ #include "AP_GPS_UBLOX.h" +#include "WProgram.h" // Constructors //////////////////////////////////////////////////////////////// AP_GPS_UBLOX::AP_GPS_UBLOX() diff --git a/libraries/AP_GPS/AP_GPS_UBLOX.h b/libraries/AP_GPS/AP_GPS_UBLOX.h index c74364b0e4..90e6c8ee48 100644 --- a/libraries/AP_GPS/AP_GPS_UBLOX.h +++ b/libraries/AP_GPS/AP_GPS_UBLOX.h @@ -1,10 +1,10 @@ -#ifndef GPS_UBLOX_h -#define GPS_UBLOX_h +#ifndef AP_GPS_UBLOX_h +#define AP_GPS_UBLOX_h -#include +#include #define MAXPAYLOAD 60 -class AP_GPS_UBLOX : public AP_GPS +class AP_GPS_UBLOX : public GPS { public: // Methods