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

Last change on this file since 4 was 4, checked in by Sanahuja Guillaume, 9 years ago

sensoractuator

File size: 5.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 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
20{
21 namespace core
22 {
23 class cvmatrix;
24 class FrameworkManager;
25 class GeoCoordinate;
26 class Vector3D;
27 }
28 namespace gui
29 {
30 class Layout;
31 class DataPlot1D;
32 class Tab;
33 class TabWidget;
34 class PushButton;
35 class Map;
36 class Label;
37 }
38}
39
40namespace flair
41{
42namespace sensor
43{
44 /*! \class Gps
45 *
46 * \brief Base class for GPS
47 */
48 class Gps : public core::IODevice
49 {
50 public:
51 /*!
52 \enum FixQuality_t
53 \brief Fix qualty indicators
54 */
55 enum class FixQuality_t {
56 Invalid=0,/*!< invalid */
57 Gps=1,/*!< Gps */
58 DGps=2,/*!< Differential Gps */
59 Pps=3,/*!< Pps */
60 Rtk=4,/*!< RTK */
61 RtkFloat=5,/*!< RTK float */
62 Estimated=6,/*!< Estimated */
63 Manual=7,/*!< Manual */
64 Simulation=8,/*!< Simulation */
65 };
66
67 /*!
68 \enum NMEAFlags_t
69 \brief NMEA flags
70 */
71 enum NMEAFlags_t {
72 GGA=0x01,/*!< GGA */
73 VTG=0x02,/*!< VTG */
74 GST=0x04,/*!< GST */
75 };
76
77 /*!
78 * \brief Constructor
79 *
80 * Construct a Gps.
81 *
82 * \param parent parent
83 * \param name name
84 * \param NMEAFlags NMEA sentances to enable
85 */
86 Gps(const core::FrameworkManager* parent,std::string name,NMEAFlags_t NMEAFlags);
87
88 /*!
89 * \brief Destructor
90 *
91 */
92 ~Gps();
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 Number of used satellites
158 *
159 * \return number of used satellites
160 */
161 uint16_t NbSat(void) const;
162
163 /*!
164 * \brief Fix Quality
165 *
166 * \return fix quality
167 */
168 FixQuality_t FixQuality(void) const;
169
170 /*!
171 * \brief Set reference for ENU coordinates
172 *
173 * The actual position is used as reference to calculate
174 * ENU coordinates.
175 *
176 * \return fix quality
177 */
178 void SetRef(void);
179
180 /*!
181 * \brief Get ENU position
182 *
183 * \param point to store position
184 */
185 void GetENUPosition(core::Vector3D *point);
186
187 protected:
188 /*!
189 * \brief Parse a NMEA frame
190 *
191 * This function must be called by the reimplemented class. \n
192 * When a frame is parsed, GPS datas are filled.
193 *
194 * \param frame NMEA frame
195 * \param frame_size frame size
196 *
197 */
198 void parseFrame(const char *frame, int frame_size);
199
200 NMEAFlags_t NMEAFlags;
201
202 protected:
203 core::GeoCoordinate *position;
204
205 private:
206 /*!
207 * \brief Update using provided datas
208 *
209 * Reimplemented from IODevice.
210 *
211 * \param data data from the parent to process
212 */
213 void UpdateFrom(const core::io_data *data){};
214
215 gui::Tab *main_tab,*sensor_tab;
216 gui::TabWidget* tab;
217 gui::PushButton *button_ref;
218 gui::DataPlot1D* e_plot;
219 gui::DataPlot1D* n_plot;
220 gui::DataPlot1D* u_plot;
221 gui::DataPlot1D* ve_plot;
222 gui::DataPlot1D* vn_plot;
223 gui::Tab* plot_tab;
224 gui::Map *map;
225 gui::Label *nb_sat_label,*fix_label;
226 uint16_t nb_sat;
227 FixQuality_t fix;
228 bool take_ref;
229 nmeaINFO info;
230 nmeaPARSER parser;
231 nmeaGPGGA pack;
232 nmeaPOS pos;
233 double lat_ref,long_ref,alt_ref;
234
235 //matrix
236 core::cvmatrix *output;
237 };
238} // end namespace sensor
239} // end namespace framewor
240#endif // GPS_H
Note: See TracBrowser for help on using the repository browser.