![](/media/cache/profiles/8158fa3e4de806e614f7ff02e7b22fde.jpg.50x50_q85.png)
New version of quadcopter software written to OO principles
Dependencies: mbed MODSERIAL filter mbed-rtos ConfigFile PID PPM FreeIMU_external_magnetometer TinyGPS
Sensors/Gps/Gps.h@4:9ffbf9101992, 2015-05-08 (annotated)
- Committer:
- joe4465
- Date:
- Fri May 08 09:07:38 2015 +0000
- Revision:
- 4:9ffbf9101992
- Parent:
- 3:4823d6750629
End of FYP
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
joe4465 | 2:969dfa4f2436 | 1 | #include "mbed.h" |
joe4465 | 2:969dfa4f2436 | 2 | #include "Global.h" |
joe4465 | 2:969dfa4f2436 | 3 | #include <TinyGPS.h> |
joe4465 | 2:969dfa4f2436 | 4 | #include "MODSERIAL.h" |
joe4465 | 2:969dfa4f2436 | 5 | |
joe4465 | 2:969dfa4f2436 | 6 | #ifndef Gps_H |
joe4465 | 2:969dfa4f2436 | 7 | #define Gps_H |
joe4465 | 2:969dfa4f2436 | 8 | |
joe4465 | 2:969dfa4f2436 | 9 | class Gps |
joe4465 | 2:969dfa4f2436 | 10 | { |
joe4465 | 2:969dfa4f2436 | 11 | public: |
joe4465 | 2:969dfa4f2436 | 12 | Gps(PinName gpsPinTx, PinName gpsPinRx); |
joe4465 | 2:969dfa4f2436 | 13 | ~Gps(); |
joe4465 | 2:969dfa4f2436 | 14 | |
joe4465 | 2:969dfa4f2436 | 15 | struct Value |
joe4465 | 2:969dfa4f2436 | 16 | { |
joe4465 | 2:969dfa4f2436 | 17 | double latitude; |
joe4465 | 2:969dfa4f2436 | 18 | double longitude; |
joe4465 | 2:969dfa4f2436 | 19 | double altitude; |
joe4465 | 2:969dfa4f2436 | 20 | bool fix; |
joe4465 | 2:969dfa4f2436 | 21 | }; |
joe4465 | 2:969dfa4f2436 | 22 | |
joe4465 | 3:4823d6750629 | 23 | struct Difference |
joe4465 | 3:4823d6750629 | 24 | { |
joe4465 | 3:4823d6750629 | 25 | double x; |
joe4465 | 3:4823d6750629 | 26 | double y; |
joe4465 | 3:4823d6750629 | 27 | double bearing; |
joe4465 | 3:4823d6750629 | 28 | double distance; |
joe4465 | 3:4823d6750629 | 29 | }; |
joe4465 | 3:4823d6750629 | 30 | |
joe4465 | 2:969dfa4f2436 | 31 | Value getValues(); |
joe4465 | 3:4823d6750629 | 32 | Difference getDifference(Value latLong1, Value latLong2); |
joe4465 | 2:969dfa4f2436 | 33 | |
joe4465 | 2:969dfa4f2436 | 34 | private: |
joe4465 | 2:969dfa4f2436 | 35 | MODSERIAL *_gps; |
joe4465 | 2:969dfa4f2436 | 36 | TinyGPS _tinyGPS; |
joe4465 | 2:969dfa4f2436 | 37 | Value _values; |
joe4465 | 3:4823d6750629 | 38 | double deg2rad(double deg); |
joe4465 | 3:4823d6750629 | 39 | double rad2deg(double rad); |
joe4465 | 2:969dfa4f2436 | 40 | }; |
joe4465 | 2:969dfa4f2436 | 41 | |
joe4465 | 2:969dfa4f2436 | 42 | #endif |