source: flair-src/trunk/lib/FlairSensorActuator/src/NmeaGps.h@ 51

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

gps

File size: 3.7 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 }
35}
36
37namespace flair {
38namespace sensor {
39
40/*! \class NmeaGps
41*
42* \brief Base class for GPS using NMEA sentances
43*/
44class NmeaGps : public core::IODevice {
45public:
46 /*!
47 \enum NMEAFlags_t
48 \brief NMEA flags
49 */
50 enum NMEAFlags_t {
51 GGA = 0x01, /*!< GGA */
52 VTG = 0x02, /*!< VTG */
53 GST = 0x04, /*!< GST */
54 };
55
56 /*!
57 * \brief Constructor
58 *
59 * Construct a NmeaGps.
60 *
61 * \param parent parent
62 * \param name name
63 * \param NMEAFlags NMEA sentances to enable
64 */
65 NmeaGps(const core::FrameworkManager *parent, std::string name,
66 NMEAFlags_t NMEAFlags);
67
68 /*!
69 * \brief Destructor
70 *
71 */
72 ~NmeaGps();
73
74 /*!
75 * \brief Get GPS datas
76 *
77 * \return GpsData
78 */
79 const core::GpsData *GetDatas(void) const;
80
81 /*!
82 * \brief Use default plot
83 *
84 */
85 void UseDefaultPlot(void);
86
87 /*!
88 * \brief East plot
89 *
90 * \return east plot
91 */
92 gui::DataPlot1D *EPlot(void) const;
93
94 /*!
95 * \brief North plot
96 *
97 * \return north plot
98 */
99 gui::DataPlot1D *NPlot(void) const;
100
101 /*!
102 * \brief Up plot
103 *
104 * \return up plot
105 */
106 gui::DataPlot1D *UPlot(void) const;
107
108 /*!
109 * \brief East velocity plot
110 *
111 * \return east velocity plot
112 */
113 gui::DataPlot1D *VEPlot(void) const;
114
115 /*!
116 * \brief North velocity plot
117 *
118 * \return north velocity plot
119 */
120 gui::DataPlot1D *VNPlot(void) const;
121
122 /*!
123 * \brief Main tab
124 *
125 * \return main tab
126 */
127 gui::TabWidget *GetTab(void) const;
128
129 /*!
130 * \brief Setup Layout
131 *
132 * \return setup Layout
133 */
134 gui::Layout *GetLayout(void) const;
135
136 /*!
137 * \brief Plot tab
138 *
139 * \return plot Tab
140 */
141 gui::Tab *GetPlotTab(void) const;
142
143 /*!
144 * \brief Set reference for ENU coordinates
145 *
146 * The actual position is used as reference to calculate
147 * ENU coordinates.
148 *
149 * \return fix quality
150 */
151 void SetRef(void);
152
153 /*!
154 * \brief Get ENU position
155 *
156 * \param point to store position
157 */
158 void GetEnu(core::Vector3D *point);
159
160protected:
161 /*!
162 * \brief Parse a NMEA frame
163 *
164 * This function must be called by the reimplemented class. \n
165 * When a frame is parsed, GPS datas are filled.
166 *
167 * \param frame NMEA frame
168 * \param frame_size frame size
169 *
170 */
171 void parseFrame(const char *frame, int frame_size);
172
173 NMEAFlags_t NMEAFlags;
174
175protected:
176 core::GeoCoordinate *position;
177
178 /*!
179 * \brief Get GPS datas
180 *
181 * \param gpsData GPS datas
182 */
183 void GetDatas(core::GpsData **gpsData) const;
184
185private:
186 /*!
187 * \brief Update using provided datas
188 *
189 * Reimplemented from IODevice.
190 *
191 * \param data data from the parent to process
192 */
193 void UpdateFrom(const core::io_data *data){};
194
195 gui::Tab *main_tab, *sensor_tab;
196 gui::TabWidget *tab;
197 gui::PushButton *button_ref;
198 gui::DataPlot1D *e_plot;
199 gui::DataPlot1D *n_plot;
200 gui::DataPlot1D *u_plot;
201 gui::DataPlot1D *ve_plot;
202 gui::DataPlot1D *vn_plot;
203 gui::Tab *plot_tab;
204 gui::Map *map;
205 gui::Label *nb_sat_label, *fix_label;
206 bool take_ref;
207 nmeaINFO info;
208 nmeaPARSER parser;
209 nmeaGPGGA pack;
210 nmeaPOS pos;
211 double lat_ref, long_ref, alt_ref;
212 core::GpsData* gpsData;
213};
214} // end namespace sensor
215} // end namespace framewor
216#endif // NMEAGPS_H
Note: See TracBrowser for help on using the repository browser.