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