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

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

gps

File size: 5.0 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 class Vector3D;
22
23/*! \class GpsData
24*
25* \brief Class defining gps datas
26*
27* GPS datas consist of
28*
29*
30*/
31class GpsData : public io_data {
32public:
33 class Type : public DataType {
34 public:
35 Type(void){}
36 std::string GetDescription() const { return "gps data"; }
37 size_t GetSize() const {
38 size_t size = 0;
39 size += 2*doubleType.GetSize(); // Latitude, Longitude
40 size += floatType.GetSize(); // Altitude
41 size += UInt8Type.GetSize(); // NumberOfSatellites
42 size += UInt8Type.GetSize(); // FixQuality_t
43 size += 5*floatType.GetSize();//e,n,u,ve,vn
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 } PlotableData_t;
66
67 /*!
68 \enum FixQuality_t
69 \brief Fix qualty indicators
70 */
71 enum class FixQuality_t : uint8_t {
72 Invalid = 0, /*!< invalid */
73 Gps = 1, /*!< Gps */
74 DGps = 2, /*!< Differential Gps */
75 Pps = 3, /*!< Pps */
76 Rtk = 4, /*!< RTK */
77 RtkFloat = 5, /*!< RTK float */
78 Estimated = 6, /*!< Estimated */
79 Manual = 7, /*!< Manual */
80 Simulation = 8, /*!< Simulation */
81 };
82
83 /*!
84 * \brief Constructor
85 *
86 * Construct an io_data representing GPS datas. \n
87 *
88 * \param parent parent
89 * \param name name
90 * \param n number of samples
91 */
92 GpsData(const Object *parent, std::string name = "", int n = 1);
93
94 /*!
95 * \brief Destructor
96 *
97 */
98 ~GpsData();
99
100 /*!
101 * \brief Element
102 *
103 * Get a pointer to a specific element. This pointer can be used for plotting.
104 *
105 * \param data_type data type
106 *
107 * \return pointer to the element
108 */
109 IODataElement *Element(PlotableData_t data_type) const;
110
111 /*!
112 * \brief Get latitude, longitude and altitude
113 *
114 * This method is mutex protected.
115 *
116 * \param latitude latitude
117 * \param longitude longitude
118 * \param altitude altitude
119 *
120 */
121 void GetLla(double &latitude, double &longitude,
122 float &altitude) const;
123
124 /*!
125 * \brief Set latitude, longitude and altitude
126 *
127 * This method is mutex protected.
128 *
129 * \param latitude latitude
130 * \param longitude longitude
131 * \param altitude altitude
132 *
133 */
134 void SetLla(double latitude,double longitude,
135 float altitude);
136
137
138 /*!
139 * \brief Get east, north and up
140 *
141 * This method is mutex protected.
142 *
143 * \param east east
144 * \param north north
145 * \param up up
146 *
147 */
148 void GetEnu(float &east, float &north,
149 float &up) const;
150
151 /*!
152 * \brief Set east, north and up
153 *
154 * This method is mutex protected.
155 *
156 * \param east east
157 * \param north north
158 * \param up up
159 *
160 */
161 void SetEnu(float east, float north,
162 float up);
163
164 /*!
165 * \brief Get east and north velocities
166 *
167 * This method is mutex protected.
168 *
169 * \param eastVelocity east velocity
170 * \param northVelocity north velocity
171 *
172 */
173 void GetVelocity(float &eastVelocity, float &northVelocity) const;
174
175 /*!
176 * \brief Set east and north velocities
177 *
178 * This method is mutex protected.
179 *
180 * \param eastVelocity east velocity
181 * \param northVelocity north velocity
182 *
183 */
184 void SetVelocity(float eastVelocity, float northVelocity);
185
186 /*!
187 * \brief Get number of satellites
188 *
189 * \return number of satellites
190 *
191 */
192 uint8_t GetNumberOfSatellites(void) const;
193
194 /*!
195 * \brief Set number of satellites
196 *
197 * \param numberOfSatellites number of satellites
198 *
199 */
200 void SetNumberOfSatellites(uint8_t numberOfSatellites);
201
202 /*!
203 * \brief Get fix quality
204 *
205 * \return fix quality
206 *
207 */
208 FixQuality_t GetFixQuality(void) const;
209
210 /*!
211 * \brief Set fix quality
212 *
213 * \param fixQuality fix quality
214 *
215 */
216 void SetFixQuality(FixQuality_t fixQuality);
217
218 Type const &GetDataType() const { return dataType; }
219
220private:
221 /*!
222 * \brief Copy datas
223 *
224 * Reimplemented from io_data. \n
225 * See io_data::CopyDatas.
226 *
227 * \param dst destination buffer
228 */
229 void CopyDatas(char *dst) const;
230
231 void Queue(char **dst, const void *src, size_t size) const;
232 Type dataType;
233 double latitude,longitude;
234 float altitude;
235 uint8_t numberOfSatellites;
236 FixQuality_t fixQuality;
237 float east,north,up,eastVelocity,northVelocity;
238};
239
240} // end namespace core
241} // end namespace flair
242
243#endif // GPSDATA_H
Note: See TracBrowser for help on using the repository browser.