[3] | 1 | // %flair:license{
|
---|
[15] | 2 | // This file is part of the Flair framework distributed under the
|
---|
| 3 | // CECILL-C License, Version 1.0.
|
---|
[3] | 4 | // %flair:license}
|
---|
| 5 | /*!
|
---|
[51] | 6 | * \file NmeaGps.h
|
---|
| 7 | * \brief Base class for GPS using NMEA sentances
|
---|
[3] | 8 | * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
| 9 | * \date 2013/08/23
|
---|
| 10 | * \version 4.0
|
---|
| 11 | */
|
---|
| 12 |
|
---|
[51] | 13 | #ifndef NMEAGPS_H
|
---|
| 14 | #define NMEAGPS_H
|
---|
[3] | 15 |
|
---|
| 16 | #include <IODevice.h>
|
---|
[167] | 17 | #include <Vector3D.h>
|
---|
[3] | 18 | #include <nmea/nmea.h>
|
---|
| 19 |
|
---|
[15] | 20 | namespace flair {
|
---|
[51] | 21 | namespace core {
|
---|
| 22 | class FrameworkManager;
|
---|
| 23 | class GeoCoordinate;
|
---|
| 24 | class GpsData;
|
---|
| 25 | }
|
---|
| 26 | namespace gui {
|
---|
| 27 | class Layout;
|
---|
| 28 | class DataPlot1D;
|
---|
| 29 | class Tab;
|
---|
| 30 | class TabWidget;
|
---|
| 31 | class PushButton;
|
---|
| 32 | class Map;
|
---|
| 33 | class Label;
|
---|
[55] | 34 | class GroupBox;
|
---|
[51] | 35 | }
|
---|
[3] | 36 | }
|
---|
| 37 |
|
---|
[15] | 38 | namespace flair {
|
---|
| 39 | namespace sensor {
|
---|
[51] | 40 |
|
---|
| 41 | /*! \class NmeaGps
|
---|
[15] | 42 | *
|
---|
[51] | 43 | * \brief Base class for GPS using NMEA sentances
|
---|
[15] | 44 | */
|
---|
[51] | 45 | class NmeaGps : public core::IODevice {
|
---|
[15] | 46 | public:
|
---|
| 47 | /*!
|
---|
| 48 | \enum NMEAFlags_t
|
---|
| 49 | \brief NMEA flags
|
---|
| 50 | */
|
---|
| 51 | enum NMEAFlags_t {
|
---|
| 52 | GGA = 0x01, /*!< GGA */
|
---|
| 53 | VTG = 0x02, /*!< VTG */
|
---|
| 54 | GST = 0x04, /*!< GST */
|
---|
[180] | 55 | GSA = 0x08, /*!< GSA */
|
---|
[15] | 56 | };
|
---|
[3] | 57 |
|
---|
[15] | 58 | /*!
|
---|
| 59 | * \brief Constructor
|
---|
| 60 | *
|
---|
[51] | 61 | * Construct a NmeaGps.
|
---|
[137] | 62 | * It will be child of the FrameworkManager.
|
---|
| 63 | *
|
---|
[15] | 64 | * \param name name
|
---|
| 65 | * \param NMEAFlags NMEA sentances to enable
|
---|
| 66 | */
|
---|
[137] | 67 | NmeaGps(std::string name,
|
---|
[15] | 68 | NMEAFlags_t NMEAFlags);
|
---|
[3] | 69 |
|
---|
[15] | 70 | /*!
|
---|
| 71 | * \brief Destructor
|
---|
| 72 | *
|
---|
| 73 | */
|
---|
[51] | 74 | ~NmeaGps();
|
---|
[3] | 75 |
|
---|
[15] | 76 | /*!
|
---|
[51] | 77 | * \brief Get GPS datas
|
---|
| 78 | *
|
---|
| 79 | * \return GpsData
|
---|
| 80 | */
|
---|
| 81 | const core::GpsData *GetDatas(void) const;
|
---|
| 82 |
|
---|
| 83 | /*!
|
---|
[15] | 84 | * \brief Use default plot
|
---|
| 85 | *
|
---|
| 86 | */
|
---|
| 87 | void UseDefaultPlot(void);
|
---|
[3] | 88 |
|
---|
[15] | 89 | /*!
|
---|
| 90 | * \brief East plot
|
---|
| 91 | *
|
---|
| 92 | * \return east plot
|
---|
| 93 | */
|
---|
| 94 | gui::DataPlot1D *EPlot(void) const;
|
---|
[3] | 95 |
|
---|
[15] | 96 | /*!
|
---|
| 97 | * \brief North plot
|
---|
| 98 | *
|
---|
| 99 | * \return north plot
|
---|
| 100 | */
|
---|
| 101 | gui::DataPlot1D *NPlot(void) const;
|
---|
[3] | 102 |
|
---|
[15] | 103 | /*!
|
---|
| 104 | * \brief Up plot
|
---|
| 105 | *
|
---|
| 106 | * \return up plot
|
---|
| 107 | */
|
---|
| 108 | gui::DataPlot1D *UPlot(void) const;
|
---|
[3] | 109 |
|
---|
[15] | 110 | /*!
|
---|
| 111 | * \brief East velocity plot
|
---|
| 112 | *
|
---|
| 113 | * \return east velocity plot
|
---|
| 114 | */
|
---|
| 115 | gui::DataPlot1D *VEPlot(void) const;
|
---|
[3] | 116 |
|
---|
[15] | 117 | /*!
|
---|
| 118 | * \brief North velocity plot
|
---|
| 119 | *
|
---|
| 120 | * \return north velocity plot
|
---|
| 121 | */
|
---|
| 122 | gui::DataPlot1D *VNPlot(void) const;
|
---|
[3] | 123 |
|
---|
[15] | 124 | /*!
|
---|
| 125 | * \brief Main tab
|
---|
| 126 | *
|
---|
| 127 | * \return main tab
|
---|
| 128 | */
|
---|
| 129 | gui::TabWidget *GetTab(void) const;
|
---|
[3] | 130 |
|
---|
[15] | 131 | /*!
|
---|
| 132 | * \brief Setup Layout
|
---|
| 133 | *
|
---|
| 134 | * \return setup Layout
|
---|
| 135 | */
|
---|
| 136 | gui::Layout *GetLayout(void) const;
|
---|
[3] | 137 |
|
---|
[15] | 138 | /*!
|
---|
| 139 | * \brief Plot tab
|
---|
| 140 | *
|
---|
| 141 | * \return plot Tab
|
---|
| 142 | */
|
---|
| 143 | gui::Tab *GetPlotTab(void) const;
|
---|
[3] | 144 |
|
---|
[15] | 145 | /*!
|
---|
| 146 | * \brief Set reference for ENU coordinates
|
---|
| 147 | *
|
---|
| 148 | * The actual position is used as reference to calculate
|
---|
| 149 | * ENU coordinates.
|
---|
| 150 | *
|
---|
| 151 | * \return fix quality
|
---|
| 152 | */
|
---|
| 153 | void SetRef(void);
|
---|
[3] | 154 |
|
---|
[15] | 155 | protected:
|
---|
| 156 | /*!
|
---|
| 157 | * \brief Parse a NMEA frame
|
---|
| 158 | *
|
---|
| 159 | * This function must be called by the reimplemented class. \n
|
---|
| 160 | * When a frame is parsed, GPS datas are filled.
|
---|
| 161 | *
|
---|
| 162 | * \param frame NMEA frame
|
---|
| 163 | * \param frame_size frame size
|
---|
| 164 | *
|
---|
| 165 | */
|
---|
| 166 | void parseFrame(const char *frame, int frame_size);
|
---|
[3] | 167 |
|
---|
[15] | 168 | NMEAFlags_t NMEAFlags;
|
---|
[3] | 169 |
|
---|
[51] | 170 | /*!
|
---|
| 171 | * \brief Get GPS datas
|
---|
| 172 | *
|
---|
| 173 | * \param gpsData GPS datas
|
---|
| 174 | */
|
---|
| 175 | void GetDatas(core::GpsData **gpsData) const;
|
---|
| 176 |
|
---|
[15] | 177 | /*!
|
---|
[55] | 178 | * \brief Setup GroupBox
|
---|
[15] | 179 | *
|
---|
[55] | 180 | * \return setup GroupBox
|
---|
[15] | 181 | */
|
---|
[55] | 182 | gui::GroupBox *GetGroupBox(void) const;
|
---|
[3] | 183 |
|
---|
[55] | 184 | private:
|
---|
| 185 | gui::Tab *mainTab, *sensorTab;
|
---|
[15] | 186 | gui::TabWidget *tab;
|
---|
[55] | 187 | gui::GroupBox *setupGroupbox;
|
---|
| 188 | gui::PushButton *buttonRef;
|
---|
| 189 | gui::DataPlot1D *ePlot;
|
---|
| 190 | gui::DataPlot1D *nPlot;
|
---|
| 191 | gui::DataPlot1D *uPlot;
|
---|
| 192 | gui::DataPlot1D *vePlot;
|
---|
| 193 | gui::DataPlot1D *vnPlot;
|
---|
| 194 | gui::Tab *plotTab;
|
---|
[15] | 195 | gui::Map *map;
|
---|
[55] | 196 | gui::Label *nbSatLabel, *fixLabel;
|
---|
| 197 | core::GeoCoordinate *position;
|
---|
| 198 | bool takeRef;
|
---|
[15] | 199 | nmeaINFO info;
|
---|
| 200 | nmeaPARSER parser;
|
---|
| 201 | nmeaGPGGA pack;
|
---|
| 202 | nmeaPOS pos;
|
---|
[55] | 203 | double latRef, longRef, altRef;
|
---|
[51] | 204 | core::GpsData* gpsData;
|
---|
[15] | 205 | };
|
---|
[3] | 206 | } // end namespace sensor
|
---|
[170] | 207 | } // end namespace flair
|
---|
[51] | 208 | #endif // NMEAGPS_H
|
---|