[4] | 1 | // %flair:license{
|
---|
[13] | 2 | // This file is part of the Flair framework distributed under the
|
---|
| 3 | // CECILL-C License, Version 1.0.
|
---|
[4] | 4 | // %flair:license}
|
---|
| 5 | /*!
|
---|
| 6 | * \file Gps.h
|
---|
| 7 | * \brief Base class for GPS
|
---|
| 8 | * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
| 9 | * \date 2013/08/23
|
---|
| 10 | * \version 4.0
|
---|
| 11 | */
|
---|
| 12 |
|
---|
| 13 | #ifndef GPS_H
|
---|
| 14 | #define GPS_H
|
---|
| 15 |
|
---|
| 16 | #include <IODevice.h>
|
---|
| 17 | #include <nmea/nmea.h>
|
---|
| 18 |
|
---|
[13] | 19 | namespace flair {
|
---|
| 20 | namespace core {
|
---|
| 21 | class cvmatrix;
|
---|
| 22 | class FrameworkManager;
|
---|
| 23 | class GeoCoordinate;
|
---|
| 24 | class Vector3D;
|
---|
[4] | 25 | }
|
---|
[13] | 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 | }
|
---|
| 35 | }
|
---|
[4] | 36 |
|
---|
[13] | 37 | namespace flair {
|
---|
| 38 | namespace sensor {
|
---|
| 39 | /*! \class Gps
|
---|
| 40 | *
|
---|
| 41 | * \brief Base class for GPS
|
---|
| 42 | */
|
---|
| 43 | class Gps : public core::IODevice {
|
---|
| 44 | public:
|
---|
| 45 | /*!
|
---|
| 46 | \enum FixQuality_t
|
---|
| 47 | \brief Fix qualty indicators
|
---|
| 48 | */
|
---|
| 49 | enum class FixQuality_t {
|
---|
| 50 | Invalid = 0, /*!< invalid */
|
---|
| 51 | Gps = 1, /*!< Gps */
|
---|
| 52 | DGps = 2, /*!< Differential Gps */
|
---|
| 53 | Pps = 3, /*!< Pps */
|
---|
| 54 | Rtk = 4, /*!< RTK */
|
---|
| 55 | RtkFloat = 5, /*!< RTK float */
|
---|
| 56 | Estimated = 6, /*!< Estimated */
|
---|
| 57 | Manual = 7, /*!< Manual */
|
---|
| 58 | Simulation = 8, /*!< Simulation */
|
---|
| 59 | };
|
---|
[4] | 60 |
|
---|
[13] | 61 | /*!
|
---|
| 62 | \enum NMEAFlags_t
|
---|
| 63 | \brief NMEA flags
|
---|
| 64 | */
|
---|
| 65 | enum NMEAFlags_t {
|
---|
| 66 | GGA = 0x01, /*!< GGA */
|
---|
| 67 | VTG = 0x02, /*!< VTG */
|
---|
| 68 | GST = 0x04, /*!< GST */
|
---|
| 69 | };
|
---|
[4] | 70 |
|
---|
[13] | 71 | /*!
|
---|
| 72 | * \brief Constructor
|
---|
| 73 | *
|
---|
| 74 | * Construct a Gps.
|
---|
| 75 | *
|
---|
| 76 | * \param parent parent
|
---|
| 77 | * \param name name
|
---|
| 78 | * \param NMEAFlags NMEA sentances to enable
|
---|
| 79 | */
|
---|
| 80 | Gps(const core::FrameworkManager *parent, std::string name,
|
---|
| 81 | NMEAFlags_t NMEAFlags);
|
---|
[4] | 82 |
|
---|
[13] | 83 | /*!
|
---|
| 84 | * \brief Destructor
|
---|
| 85 | *
|
---|
| 86 | */
|
---|
| 87 | ~Gps();
|
---|
[4] | 88 |
|
---|
[13] | 89 | /*!
|
---|
| 90 | * \brief Use default plot
|
---|
| 91 | *
|
---|
| 92 | */
|
---|
| 93 | void UseDefaultPlot(void);
|
---|
[4] | 94 |
|
---|
[13] | 95 | /*!
|
---|
| 96 | * \brief East plot
|
---|
| 97 | *
|
---|
| 98 | * \return east plot
|
---|
| 99 | */
|
---|
| 100 | gui::DataPlot1D *EPlot(void) const;
|
---|
[4] | 101 |
|
---|
[13] | 102 | /*!
|
---|
| 103 | * \brief North plot
|
---|
| 104 | *
|
---|
| 105 | * \return north plot
|
---|
| 106 | */
|
---|
| 107 | gui::DataPlot1D *NPlot(void) const;
|
---|
[4] | 108 |
|
---|
[13] | 109 | /*!
|
---|
| 110 | * \brief Up plot
|
---|
| 111 | *
|
---|
| 112 | * \return up plot
|
---|
| 113 | */
|
---|
| 114 | gui::DataPlot1D *UPlot(void) const;
|
---|
[4] | 115 |
|
---|
[13] | 116 | /*!
|
---|
| 117 | * \brief East velocity plot
|
---|
| 118 | *
|
---|
| 119 | * \return east velocity plot
|
---|
| 120 | */
|
---|
| 121 | gui::DataPlot1D *VEPlot(void) const;
|
---|
[4] | 122 |
|
---|
[13] | 123 | /*!
|
---|
| 124 | * \brief North velocity plot
|
---|
| 125 | *
|
---|
| 126 | * \return north velocity plot
|
---|
| 127 | */
|
---|
| 128 | gui::DataPlot1D *VNPlot(void) const;
|
---|
[4] | 129 |
|
---|
[13] | 130 | /*!
|
---|
| 131 | * \brief Main tab
|
---|
| 132 | *
|
---|
| 133 | * \return main tab
|
---|
| 134 | */
|
---|
| 135 | gui::TabWidget *GetTab(void) const;
|
---|
[4] | 136 |
|
---|
[13] | 137 | /*!
|
---|
| 138 | * \brief Setup Layout
|
---|
| 139 | *
|
---|
| 140 | * \return setup Layout
|
---|
| 141 | */
|
---|
| 142 | gui::Layout *GetLayout(void) const;
|
---|
[4] | 143 |
|
---|
[13] | 144 | /*!
|
---|
| 145 | * \brief Plot tab
|
---|
| 146 | *
|
---|
| 147 | * \return plot Tab
|
---|
| 148 | */
|
---|
| 149 | gui::Tab *GetPlotTab(void) const;
|
---|
[4] | 150 |
|
---|
[13] | 151 | /*!
|
---|
| 152 | * \brief Number of used satellites
|
---|
| 153 | *
|
---|
| 154 | * \return number of used satellites
|
---|
| 155 | */
|
---|
| 156 | uint16_t NbSat(void) const;
|
---|
[4] | 157 |
|
---|
[13] | 158 | /*!
|
---|
| 159 | * \brief Fix Quality
|
---|
| 160 | *
|
---|
| 161 | * \return fix quality
|
---|
| 162 | */
|
---|
| 163 | FixQuality_t FixQuality(void) const;
|
---|
[4] | 164 |
|
---|
[13] | 165 | /*!
|
---|
| 166 | * \brief Set reference for ENU coordinates
|
---|
| 167 | *
|
---|
| 168 | * The actual position is used as reference to calculate
|
---|
| 169 | * ENU coordinates.
|
---|
| 170 | *
|
---|
| 171 | * \return fix quality
|
---|
| 172 | */
|
---|
| 173 | void SetRef(void);
|
---|
[4] | 174 |
|
---|
[13] | 175 | /*!
|
---|
| 176 | * \brief Get ENU position
|
---|
| 177 | *
|
---|
| 178 | * \param point to store position
|
---|
| 179 | */
|
---|
| 180 | void GetENUPosition(core::Vector3D *point);
|
---|
[4] | 181 |
|
---|
[13] | 182 | protected:
|
---|
| 183 | /*!
|
---|
| 184 | * \brief Parse a NMEA frame
|
---|
| 185 | *
|
---|
| 186 | * This function must be called by the reimplemented class. \n
|
---|
| 187 | * When a frame is parsed, GPS datas are filled.
|
---|
| 188 | *
|
---|
| 189 | * \param frame NMEA frame
|
---|
| 190 | * \param frame_size frame size
|
---|
| 191 | *
|
---|
| 192 | */
|
---|
| 193 | void parseFrame(const char *frame, int frame_size);
|
---|
[4] | 194 |
|
---|
[13] | 195 | NMEAFlags_t NMEAFlags;
|
---|
[4] | 196 |
|
---|
[13] | 197 | protected:
|
---|
| 198 | core::GeoCoordinate *position;
|
---|
[4] | 199 |
|
---|
[13] | 200 | private:
|
---|
| 201 | /*!
|
---|
| 202 | * \brief Update using provided datas
|
---|
| 203 | *
|
---|
| 204 | * Reimplemented from IODevice.
|
---|
| 205 | *
|
---|
| 206 | * \param data data from the parent to process
|
---|
| 207 | */
|
---|
| 208 | void UpdateFrom(const core::io_data *data){};
|
---|
[4] | 209 |
|
---|
[13] | 210 | gui::Tab *main_tab, *sensor_tab;
|
---|
| 211 | gui::TabWidget *tab;
|
---|
| 212 | gui::PushButton *button_ref;
|
---|
| 213 | gui::DataPlot1D *e_plot;
|
---|
| 214 | gui::DataPlot1D *n_plot;
|
---|
| 215 | gui::DataPlot1D *u_plot;
|
---|
| 216 | gui::DataPlot1D *ve_plot;
|
---|
| 217 | gui::DataPlot1D *vn_plot;
|
---|
| 218 | gui::Tab *plot_tab;
|
---|
| 219 | gui::Map *map;
|
---|
| 220 | gui::Label *nb_sat_label, *fix_label;
|
---|
| 221 | uint16_t nb_sat;
|
---|
| 222 | FixQuality_t fix;
|
---|
| 223 | bool take_ref;
|
---|
| 224 | nmeaINFO info;
|
---|
| 225 | nmeaPARSER parser;
|
---|
| 226 | nmeaGPGGA pack;
|
---|
| 227 | nmeaPOS pos;
|
---|
| 228 | double lat_ref, long_ref, alt_ref;
|
---|
[4] | 229 |
|
---|
[13] | 230 | // matrix
|
---|
| 231 | core::cvmatrix *output;
|
---|
| 232 | };
|
---|
[4] | 233 | } // end namespace sensor
|
---|
| 234 | } // end namespace framewor
|
---|
| 235 | #endif // GPS_H
|
---|