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

Last change on this file since 45 was 32, checked in by Sanahuja Guillaume, 6 years ago

m

File size: 3.9 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 <nmea/nmea.h>
18
19namespace flair {
20 namespace core {
21 class FrameworkManager;
22 class GeoCoordinate;
23 class Vector3D;
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 };
56
57 /*!
58 * \brief Constructor
59 *
60 * Construct a NmeaGps.
61 *
62 * \param parent parent
63 * \param name name
64 * \param NMEAFlags NMEA sentances to enable
65 */
66 NmeaGps(const core::FrameworkManager *parent, std::string name,
67 NMEAFlags_t NMEAFlags);
68
69 /*!
70 * \brief Constructor
71 *
72 * Construct a NmeaGps. \n
73 * This contructor must only be called for a simulated device.
74 *
75 * \param parent parent
76 * \param name name
77 */
78 NmeaGps(const core::IODevice *parent, std::string name);
79
80 /*!
81 * \brief Destructor
82 *
83 */
84 ~NmeaGps();
85
86 /*!
87 * \brief Get GPS datas
88 *
89 * \return GpsData
90 */
91 const core::GpsData *GetDatas(void) const;
92
93 /*!
94 * \brief Use default plot
95 *
96 */
97 void UseDefaultPlot(void);
98
99 /*!
100 * \brief East plot
101 *
102 * \return east plot
103 */
104 gui::DataPlot1D *EPlot(void) const;
105
106 /*!
107 * \brief North plot
108 *
109 * \return north plot
110 */
111 gui::DataPlot1D *NPlot(void) const;
112
113 /*!
114 * \brief Up plot
115 *
116 * \return up plot
117 */
118 gui::DataPlot1D *UPlot(void) const;
119
120 /*!
121 * \brief East velocity plot
122 *
123 * \return east velocity plot
124 */
125 gui::DataPlot1D *VEPlot(void) const;
126
127 /*!
128 * \brief North velocity plot
129 *
130 * \return north velocity plot
131 */
132 gui::DataPlot1D *VNPlot(void) const;
133
134 /*!
135 * \brief Main tab
136 *
137 * \return main tab
138 */
139 gui::TabWidget *GetTab(void) const;
140
141 /*!
142 * \brief Setup Layout
143 *
144 * \return setup Layout
145 */
146 gui::Layout *GetLayout(void) const;
147
148 /*!
149 * \brief Plot tab
150 *
151 * \return plot Tab
152 */
153 gui::Tab *GetPlotTab(void) const;
154
155 /*!
156 * \brief Set reference for ENU coordinates
157 *
158 * The actual position is used as reference to calculate
159 * ENU coordinates.
160 *
161 * \return fix quality
162 */
163 void SetRef(void);
164
165 /*!
166 * \brief Get ENU position
167 *
168 * \param point to store position
169 */
170 void GetEnu(core::Vector3D *point);
171
172protected:
173 /*!
174 * \brief Parse a NMEA frame
175 *
176 * This function must be called by the reimplemented class. \n
177 * When a frame is parsed, GPS datas are filled.
178 *
179 * \param frame NMEA frame
180 * \param frame_size frame size
181 *
182 */
183 void parseFrame(const char *frame, int frame_size);
184
185 NMEAFlags_t NMEAFlags;
186
187 /*!
188 * \brief Get GPS datas
189 *
190 * \param gpsData GPS datas
191 */
192 void GetDatas(core::GpsData **gpsData) const;
193
194 /*!
195 * \brief Setup GroupBox
196 *
197 * \return setup GroupBox
198 */
199 gui::GroupBox *GetGroupBox(void) const;
200
201private:
202 gui::Tab *mainTab, *sensorTab;
203 gui::TabWidget *tab;
204 gui::GroupBox *setupGroupbox;
205 gui::PushButton *buttonRef;
206 gui::DataPlot1D *ePlot;
207 gui::DataPlot1D *nPlot;
208 gui::DataPlot1D *uPlot;
209 gui::DataPlot1D *vePlot;
210 gui::DataPlot1D *vnPlot;
211 gui::Tab *plotTab;
212 gui::Map *map;
213 gui::Label *nbSatLabel, *fixLabel;
214 core::GeoCoordinate *position;
215 bool takeRef;
216 nmeaINFO info;
217 nmeaPARSER parser;
218 nmeaGPGGA pack;
219 nmeaPOS pos;
220 double latRef, longRef, altRef;
221 core::GpsData* gpsData;
222};
223} // end namespace sensor
224} // end namespace framewor
225#endif // NMEAGPS_H
Note: See TracBrowser for help on using the repository browser.