source: flair-src/trunk/lib/FlairCore/src/GpsData.h@ 252

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

change io_data CopyDate to RawRead

File size: 5.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 GpsData.h
7 * \brief Class defining gps datas
8 * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
9 * \date 2016/07/01
10 * \version 4.0
11 */
12#ifndef GPSDATA_H
13#define GPSDATA_H
14
15#include <io_data.h>
16
17namespace flair {
18namespace core {
19
20 class IODataElement;
21
22/*! \class GpsData
23*
24* \brief Class defining gps datas
25*
26* GPS datas consist of
27*
28*
29*/
30class GpsData : public io_data {
31public:
32 class Type : public DataType {
33 public:
34 Type(void){}
35 std::string GetDescription() const { return "gps data"; }
36 size_t GetSize() const {
37 size_t size = 0;
38 size += 2*doubleType.GetSize(); // Latitude, Longitude
39 size += floatType.GetSize(); // Altitude
40 size += UInt8Type.GetSize(); // NumberOfSatellites
41 size += UInt8Type.GetSize(); // FixQuality_t
42 size += 5*floatType.GetSize();//e,n,u,ve,vn
43 size += 3*floatType.GetSize();//pdop,hdop,vdop
44 return size;
45 }
46
47 private:
48 };
49
50 /*!
51 \enum PlotableData_t
52 \brief Datas wich can be plotted in a DataPlot1D
53 */
54 typedef enum {
55 Latitude /*! latitude in degrees */,
56 Longitude /*! longitude in degrees */,
57 Altitude /*! altitude */,
58 NumberOfSatellites /*! number of satellites */,
59 FixQuality /*! fix quality */,
60 East /*! east */,
61 North /*! north */,
62 Up /*! up */,
63 EastVelocity /*! east velocity*/,
64 NorthVelocity /*! north velocity*/,
65 Pdop /* dilution of precision*/,
66 Hdop /* horizontal dilution of precision*/,
67 Vdop /* vertical dilution of precision*/,
68 } PlotableData_t;
69
70 /*!
71 \enum FixQuality_t
72 \brief Fix qualty indicators
73 */
74 enum class FixQuality_t : uint8_t {
75 Invalid = 0, /*!< invalid */
76 Gps = 1, /*!< Gps */
77 DGps = 2, /*!< Differential Gps */
78 Pps = 3, /*!< Pps */
79 Rtk = 4, /*!< RTK */
80 RtkFloat = 5, /*!< RTK float */
81 Estimated = 6, /*!< Estimated */
82 Manual = 7, /*!< Manual */
83 Simulation = 8, /*!< Simulation */
84 };
85
86 /*!
87 * \brief Constructor
88 *
89 * Construct an io_data representing GPS datas. \n
90 *
91 * \param parent parent
92 * \param name name
93 * \param n number of samples
94 */
95 GpsData(const Object *parent, std::string name = "", int n = 1);
96
97 /*!
98 * \brief Destructor
99 *
100 */
101 ~GpsData();
102
103 /*!
104 * \brief Element
105 *
106 * Get a pointer to a specific element. This pointer can be used for plotting.
107 *
108 * \param data_type data type
109 *
110 * \return pointer to the element
111 */
112 IODataElement *Element(PlotableData_t data_type) const;
113
114 /*!
115 * \brief Get latitude, longitude and altitude
116 *
117 * This method is mutex protected.
118 *
119 * \param latitude latitude
120 * \param longitude longitude
121 * \param altitude altitude
122 *
123 */
124 void GetLla(double &latitude, double &longitude,
125 float &altitude) const;
126
127 /*!
128 * \brief Set latitude, longitude and altitude
129 *
130 * This method is mutex protected.
131 *
132 * \param latitude latitude
133 * \param longitude longitude
134 * \param altitude altitude
135 *
136 */
137 void SetLla(double latitude,double longitude,
138 float altitude);
139
140
141 /*!
142 * \brief Get east, north and up
143 *
144 * This method is mutex protected.
145 *
146 * \param east east
147 * \param north north
148 * \param up up
149 *
150 */
151 void GetEnu(float &east, float &north,
152 float &up) const;
153
154 /*!
155 * \brief Set east, north and up
156 *
157 * This method is mutex protected.
158 *
159 * \param east east
160 * \param north north
161 * \param up up
162 *
163 */
164 void SetEnu(float east, float north,
165 float up);
166
167 /*!
168 * \brief Get east and north velocities
169 *
170 * This method is mutex protected.
171 *
172 * \param eastVelocity east velocity
173 * \param northVelocity north velocity
174 *
175 */
176 void GetVelocity(float &eastVelocity, float &northVelocity) const;
177
178 /*!
179 * \brief Set east and north velocities
180 *
181 * This method is mutex protected.
182 *
183 * \param eastVelocity east velocity
184 * \param northVelocity north velocity
185 *
186 */
187 void SetVelocity(float eastVelocity, float northVelocity);
188
189 /*!
190 * \brief Get number of satellites
191 *
192 * \return number of satellites
193 *
194 */
195 uint8_t GetNumberOfSatellites(void) const;
196
197 /*!
198 * \brief Set number of satellites
199 *
200 * \param numberOfSatellites number of satellites
201 *
202 */
203 void SetNumberOfSatellites(uint8_t numberOfSatellites);
204
205 /*!
206 * \brief Get fix quality
207 *
208 * \return fix quality
209 *
210 */
211 FixQuality_t GetFixQuality(void) const;
212
213 /*!
214 * \brief Set fix quality
215 *
216 * \param fixQuality fix quality
217 *
218 */
219 void SetFixQuality(FixQuality_t fixQuality);
220
221 /*!
222 * \brief Get dilution of precision
223 *
224 * This method is mutex protected.
225 *
226 * \param pDop dilution of precision
227 * \param hDop horizontal dilution of precision
228 * \param vDop vertical dilution of precision
229 *
230 */
231 void GetDop(float &pDop, float &hDop,float &vDop) const;
232
233 /*!
234 * \brief Set dilution of precision
235 *
236 * This method is mutex protected.
237 *
238 * \param pDop dilution of precision
239 * \param hDop horizontal dilution of precision
240 * \param vDop vertical dilution of precision
241 *
242 */
243 void SetDop(float pDop, float hDop,float vDop);
244
245 Type const &GetDataType() const { return dataType; }
246
247 /*!
248 * \brief Raw read datas
249 *
250 * Reimplemented from io_data. \n
251 * See io_data::RawRead.
252 *
253 * \param dst destination buffer
254 */
255 void RawRead(char *dst) const;
256
257private:
258 void Queue(char **dst, const void *src, size_t size) const;
259 Type dataType;
260 double latitude,longitude;
261 float altitude;
262 uint8_t numberOfSatellites;
263 FixQuality_t fixQuality;
264 float east,north,up,eastVelocity,northVelocity,pDop,hDop,vDop;
265};
266
267} // end namespace core
268} // end namespace flair
269
270#endif // GPSDATA_H
Note: See TracBrowser for help on using the repository browser.