source: flair-dev/trunk/include/FlairSensorActuator/NmeaGps.h@ 61

Last change on this file since 61 was 61, checked in by Sanahuja Guillaume, 7 years ago

gps

File size: 3.8 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 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>
17#include <Vector3D.h>
18#include <nmea/nmea.h>
19
20namespace 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
38namespace flair {
39namespace sensor {
40
41/*! \class NmeaGps
42*
43* \brief Base class for GPS using NMEA sentances
44*/
45class NmeaGps : public core::IODevice {
46public:
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 */
55 GSA = 0x08, /*!< GSA */
56 };
57
58 /*!
59 * \brief Constructor
60 *
61 * Construct a NmeaGps.
62 * It will be child of the FrameworkManager.
63 *
64 * \param name name
65 * \param NMEAFlags NMEA sentances to enable
66 */
67 NmeaGps(std::string name,
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
166protected:
167 /*!
168 * \brief Parse a NMEA frame
169 *
170 * This function must be called by the reimplemented class. \n
171 * When a frame is parsed, GPS datas are filled.
172 *
173 * \param frame NMEA frame
174 * \param frame_size frame size
175 *
176 */
177 void parseFrame(const char *frame, int frame_size);
178
179 NMEAFlags_t NMEAFlags;
180
181 /*!
182 * \brief Get GPS datas
183 *
184 * \param gpsData GPS datas
185 */
186 void GetDatas(core::GpsData **gpsData) const;
187
188 /*!
189 * \brief Setup GroupBox
190 *
191 * \return setup GroupBox
192 */
193 gui::GroupBox *GetGroupBox(void) const;
194
195private:
196 gui::Tab *mainTab, *sensorTab;
197 gui::TabWidget *tab;
198 gui::GroupBox *setupGroupbox;
199 gui::PushButton *buttonRef;
200 gui::DataPlot1D *ePlot;
201 gui::DataPlot1D *nPlot;
202 gui::DataPlot1D *uPlot;
203 gui::DataPlot1D *vePlot;
204 gui::DataPlot1D *vnPlot;
205 gui::Tab *plotTab;
206 gui::Map *map;
207 gui::Label *nbSatLabel, *fixLabel;
208 core::GeoCoordinate *position;
209 bool takeRef;
210 nmeaINFO info;
211 nmeaPARSER parser;
212 nmeaGPGGA pack;
213 nmeaPOS pos;
214 double latRef, longRef, altRef;
215 core::GpsData* gpsData;
216};
217} // end namespace sensor
218} // end namespace flair
219#endif // NMEAGPS_H
Note: See TracBrowser for help on using the repository browser.