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

Last change on this file since 167 was 167, checked in by Sanahuja Guillaume, 5 years ago

modifs pour template vectors

File size: 3.9 KB
RevLine 
[3]1// %flair:license{
[15]2// This file is part of the Flair framework distributed under the
3// CECILL-C License, Version 1.0.
[3]4// %flair:license}
5/*!
[51]6 * \file NmeaGps.h
7 * \brief Base class for GPS using NMEA sentances
[3]8 * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
9 * \date 2013/08/23
10 * \version 4.0
11 */
12
[51]13#ifndef NMEAGPS_H
14#define NMEAGPS_H
[3]15
16#include <IODevice.h>
[167]17#include <Vector3D.h>
[3]18#include <nmea/nmea.h>
19
[15]20namespace flair {
[51]21  namespace core {
22    class FrameworkManager;
23    class GeoCoordinate;
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;
[55]34    class GroupBox;
[51]35  }
[3]36}
37
[15]38namespace flair {
39namespace sensor {
[51]40
41/*! \class NmeaGps
[15]42*
[51]43* \brief Base class for GPS using NMEA sentances
[15]44*/
[51]45class NmeaGps : public core::IODevice {
[15]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  };
[3]56
[15]57  /*!
58  * \brief Constructor
59  *
[51]60  * Construct a NmeaGps.
[137]61  *     It will be child of the FrameworkManager.
62        *
[15]63  * \param name name
64  * \param NMEAFlags NMEA sentances to enable
65  */
[137]66  NmeaGps(std::string name,
[15]67      NMEAFlags_t NMEAFlags);
[3]68
[15]69  /*!
[55]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  /*!
[15]81  * \brief Destructor
82  *
83  */
[51]84  ~NmeaGps();
[3]85
[15]86  /*!
[51]87  * \brief Get GPS datas
88  *
89  * \return GpsData
90  */
91  const core::GpsData *GetDatas(void) const;
92
93  /*!
[15]94  * \brief Use default plot
95  *
96  */
97  void UseDefaultPlot(void);
[3]98
[15]99  /*!
100  * \brief East plot
101  *
102  * \return east plot
103  */
104  gui::DataPlot1D *EPlot(void) const;
[3]105
[15]106  /*!
107  * \brief North plot
108  *
109  * \return north plot
110  */
111  gui::DataPlot1D *NPlot(void) const;
[3]112
[15]113  /*!
114  * \brief Up plot
115  *
116  * \return up plot
117  */
118  gui::DataPlot1D *UPlot(void) const;
[3]119
[15]120  /*!
121  * \brief East velocity plot
122  *
123  * \return east velocity plot
124  */
125  gui::DataPlot1D *VEPlot(void) const;
[3]126
[15]127  /*!
128  * \brief North velocity plot
129  *
130  * \return north velocity plot
131  */
132  gui::DataPlot1D *VNPlot(void) const;
[3]133
[15]134  /*!
135  * \brief Main tab
136  *
137  * \return main tab
138  */
139  gui::TabWidget *GetTab(void) const;
[3]140
[15]141  /*!
142  * \brief Setup Layout
143  *
144  * \return setup Layout
145  */
146  gui::Layout *GetLayout(void) const;
[3]147
[15]148  /*!
149  * \brief Plot tab
150  *
151  * \return plot Tab
152  */
153  gui::Tab *GetPlotTab(void) const;
[3]154
[15]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);
[3]164
[15]165  /*!
166  * \brief Get ENU position
167  *
168  * \param point to store position
169  */
[167]170  void GetEnu(core::Vector3Df *point);
[3]171
[15]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);
[3]184
[15]185  NMEAFlags_t NMEAFlags;
[3]186
[51]187  /*!
188  * \brief Get GPS datas
189  *
190  * \param gpsData GPS datas
191  */
192  void GetDatas(core::GpsData **gpsData) const;
193
[15]194  /*!
[55]195  * \brief Setup GroupBox
[15]196  *
[55]197  * \return setup GroupBox
[15]198  */
[55]199  gui::GroupBox *GetGroupBox(void) const;
[3]200
[55]201private:
202  gui::Tab *mainTab, *sensorTab;
[15]203  gui::TabWidget *tab;
[55]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;
[15]212  gui::Map *map;
[55]213  gui::Label *nbSatLabel, *fixLabel;
214  core::GeoCoordinate *position;
215  bool takeRef;
[15]216  nmeaINFO info;
217  nmeaPARSER parser;
218  nmeaGPGGA pack;
219  nmeaPOS pos;
[55]220  double latRef, longRef, altRef;
[51]221  core::GpsData* gpsData;
[15]222};
[3]223} // end namespace sensor
224} // end namespace framewor
[51]225#endif // NMEAGPS_H
Note: See TracBrowser for help on using the repository browser.