source: flair-dev/trunk/include/FlairSensorActuator/Gps.h @ 13

Last change on this file since 13 was 13, checked in by Bayard Gildas, 5 years ago

formatting script + include reformatted

File size: 4.1 KB
Line 
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 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
19namespace flair {
20namespace core {
21class cvmatrix;
22class FrameworkManager;
23class GeoCoordinate;
24class Vector3D;
25}
26namespace gui {
27class Layout;
28class DataPlot1D;
29class Tab;
30class TabWidget;
31class PushButton;
32class Map;
33class Label;
34}
35}
36
37namespace flair {
38namespace sensor {
39/*! \class Gps
40*
41* \brief Base class for GPS
42*/
43class Gps : public core::IODevice {
44public:
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  };
60
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  };
70
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);
82
83  /*!
84  * \brief Destructor
85  *
86  */
87  ~Gps();
88
89  /*!
90  * \brief Use default plot
91  *
92  */
93  void UseDefaultPlot(void);
94
95  /*!
96  * \brief East plot
97  *
98  * \return east plot
99  */
100  gui::DataPlot1D *EPlot(void) const;
101
102  /*!
103  * \brief North plot
104  *
105  * \return north plot
106  */
107  gui::DataPlot1D *NPlot(void) const;
108
109  /*!
110  * \brief Up plot
111  *
112  * \return up plot
113  */
114  gui::DataPlot1D *UPlot(void) const;
115
116  /*!
117  * \brief East velocity plot
118  *
119  * \return east velocity plot
120  */
121  gui::DataPlot1D *VEPlot(void) const;
122
123  /*!
124  * \brief North velocity plot
125  *
126  * \return north velocity plot
127  */
128  gui::DataPlot1D *VNPlot(void) const;
129
130  /*!
131  * \brief Main tab
132  *
133  * \return main tab
134  */
135  gui::TabWidget *GetTab(void) const;
136
137  /*!
138  * \brief Setup Layout
139  *
140  * \return setup Layout
141  */
142  gui::Layout *GetLayout(void) const;
143
144  /*!
145  * \brief Plot tab
146  *
147  * \return plot Tab
148  */
149  gui::Tab *GetPlotTab(void) const;
150
151  /*!
152  * \brief Number of used satellites
153  *
154  * \return number of used satellites
155  */
156  uint16_t NbSat(void) const;
157
158  /*!
159  * \brief Fix Quality
160  *
161  * \return fix quality
162  */
163  FixQuality_t FixQuality(void) const;
164
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);
174
175  /*!
176  * \brief Get ENU position
177  *
178  * \param point to store position
179  */
180  void GetENUPosition(core::Vector3D *point);
181
182protected:
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);
194
195  NMEAFlags_t NMEAFlags;
196
197protected:
198  core::GeoCoordinate *position;
199
200private:
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){};
209
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;
229
230  // matrix
231  core::cvmatrix *output;
232};
233} // end namespace sensor
234} // end namespace framewor
235#endif // GPS_H
Note: See TracBrowser for help on using the repository browser.