Main MRPT website > C++ reference for MRPT 1.4.0
gnss_messages_ascii_nmea.h
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2016, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +---------------------------------------------------------------------------+ */
9 #pragma once
10 
11 #include "gnss_messages_common.h"
12 
13 namespace mrpt {
14 namespace obs {
15 namespace gnss {
16 
17 // Pragma to ensure we can safely serialize some of these structures
18 #pragma pack(push,1)
19 
20 /** NMEA datum: GGA. \sa mrpt::obs::CObservationGPS */
22 {
23  GNSS_MESSAGE_BINARY_BLOCK(&fields,sizeof(fields))
24  enum { msg_type = NMEA_GGA }; //!< Static msg type (member expected by templates)
26  {}
27 
29  {
30  UTC_time UTCTime; //!< The GPS sensor measured timestamp (in UTC time)
31  double latitude_degrees; //!< The measured latitude, in degrees (North:+ , South:-)
32  double longitude_degrees; //!< The measured longitude, in degrees (East:+ , West:-)
33  uint8_t fix_quality; //!< NMEA standard values: 0 = invalid, 1 = GPS fix (SPS), 2 = DGPS fix, 3 = PPS fix, 4 = Real Time Kinematic, 5 = Float RTK, 6 = estimated (dead reckoning) (2.3 feature), 7 = Manual input mode, 8 = Simulation mode */
34  double altitude_meters; //!< The measured altitude, in meters (A).
35  double geoidal_distance; //!< Undulation: Difference between the measured altitude and the geoid, in meters (B).
36  double orthometric_altitude; //!< The measured orthometric altitude, in meters (A)+(B).
37  double corrected_orthometric_altitude; //!< The corrected (only for TopCon mmGPS) orthometric altitude, in meters mmGPS(A+B).
38  uint32_t satellitesUsed; //!< The number of satelites used to compute this estimation.
39  bool thereis_HDOP; //!< This states whether to take into account the value in the HDOP field.
40  float HDOP; //!< The HDOP (Horizontal Dilution of Precision) as returned by the sensor.
41 
42  content_t();
43  };
44  content_t fields; //!< Message content, accesible by individual fields
45 
46  void dumpToStream( mrpt::utils::CStream &out ) const MRPT_OVERRIDE; // See docs in base
47 
48  /** Return the geodetic coords as a mrpt::topography::TGeodeticCoords structure (requires linking against mrpt-topography)
49  * Call as: getAsStruct<TGeodeticCoords>(); */
50  template <class TGEODETICCOORDS>
51  inline TGEODETICCOORDS getOrthoAsStruct() const {
52  return TGEODETICCOORDS(fields.latitude_degrees,fields.longitude_degrees,fields.orthometric_altitude);
53  }
54  /** Return the corrected geodetic coords as a mrpt::topography::TGeodeticCoords structure (requires linking against mrpt-topography)
55  * Call as: getAsStruct<TGeodeticCoords>(); */
56  template <class TGEODETICCOORDS>
57  inline TGEODETICCOORDS getCorrectedOrthoAsStruct() const {
58  return TGEODETICCOORDS(fields.latitude_degrees,fields.longitude_degrees,fields.corrected_orthometric_altitude);
59  }
60  /** Return the geodetic coords as a mrpt::topography::TGeodeticCoords structure (requires linking against mrpt-topography)
61  * Call as: getAsStruct<TGeodeticCoords>(); */
62  template <class TGEODETICCOORDS>
63  inline TGEODETICCOORDS getAsStruct() const {
64  return TGEODETICCOORDS(fields.latitude_degrees,fields.longitude_degrees,fields.altitude_meters);
65  }
66 
67  bool getAllFieldDescriptions( std::ostream &o ) const MRPT_OVERRIDE;
68  bool getAllFieldValues( std::ostream &o ) const MRPT_OVERRIDE;
69 };
70 
71 /** NMEA datum: GLL. \sa mrpt::obs::CObservationGPS */
73 {
74  GNSS_MESSAGE_BINARY_BLOCK(&fields,sizeof(fields))
75  enum { msg_type = NMEA_GLL }; //!< Static msg type (member expected by templates)
77  {}
79  {
80  UTC_time UTCTime; //!< The GPS sensor measured timestamp (in UTC time)
81  double latitude_degrees; //!< The measured latitude, in degrees (North:+ , South:-)
82  double longitude_degrees; //!< The measured longitude, in degrees (East:+ , West:-)
83  int8_t validity_char; //!< This will be: 'A'=OK or 'V'=void
84  content_t();
85  };
86  content_t fields; //!< Message content, accesible by individual fields
87  void dumpToStream( mrpt::utils::CStream &out ) const MRPT_OVERRIDE; // See docs in base
88  bool getAllFieldDescriptions( std::ostream &o ) const MRPT_OVERRIDE;
89  bool getAllFieldValues( std::ostream &o ) const MRPT_OVERRIDE;
90 };
91 
92 /** NMEA datum: RMC. \sa mrpt::obs::CObservationGPS */
94 {
95  GNSS_MESSAGE_BINARY_BLOCK(&fields,sizeof(fields))
96  enum { msg_type = NMEA_RMC }; //!< Static msg type (member expected by templates)
98  {}
99 
101  {
102  UTC_time UTCTime; //!< The GPS sensor measured timestamp (in UTC time)
103  int8_t validity_char; //!< This will be: 'A'=OK or 'V'=void
104  double latitude_degrees; //!< The measured latitude, in degrees (North:+ , South:-)
105  double longitude_degrees; //!< The measured longitude, in degrees (East:+ , West:-)
106  double speed_knots; //!< Measured speed (in knots)
107  double direction_degrees; //!< Measured speed direction (in degrees)
108  uint8_t date_day, date_month,date_year; //!< Date: day (1-31), month (1-12), two-digits year (00-99)
109  double magnetic_dir; //!< Magnetic variation direction (East:+, West:-)
110  char positioning_mode; //!< 'A': Autonomous, 'D': Differential, 'N': Not valid, 'E': Estimated, 'M': Manual
111  content_t();
112  };
113  content_t fields; //!< Message content, accesible by individual fields
114 
115  mrpt::system::TTimeStamp getDateAsTimestamp() const; //!< Build an MRPT timestamp with the year/month/day of this observation.
116 
117  void dumpToStream( mrpt::utils::CStream &out ) const MRPT_OVERRIDE; // See docs in base
118  bool getAllFieldDescriptions( std::ostream &o ) const MRPT_OVERRIDE;
119  bool getAllFieldValues( std::ostream &o ) const MRPT_OVERRIDE;
120 };
121 
122 /** NMEA datum: VTG. \sa mrpt::obs::CObservationGPS */
124 {
125  GNSS_MESSAGE_BINARY_BLOCK(&fields,sizeof(fields))
126  enum { msg_type = NMEA_VTG }; //!< Static msg type (member expected by templates)
128  {}
130  {
131  double true_track, magnetic_track; //!< Degrees
132  double ground_speed_knots, ground_speed_kmh;
133  content_t();
134  };
135  content_t fields; //!< Message content, accesible by individual fields
136  void dumpToStream( mrpt::utils::CStream &out ) const MRPT_OVERRIDE; // See docs in base
137  bool getAllFieldDescriptions( std::ostream &o ) const MRPT_OVERRIDE;
138  bool getAllFieldValues( std::ostream &o ) const MRPT_OVERRIDE;
139 };
140 
141 /** NMEA datum: ZDA. \sa mrpt::obs::CObservationGPS */
143 {
144  GNSS_MESSAGE_BINARY_BLOCK(&fields,sizeof(fields))
145  enum { msg_type = NMEA_ZDA }; //!< Static msg type (member expected by templates)
147  {}
148 
150  {
151  UTC_time UTCTime; //!< The GPS sensor measured timestamp (in UTC time)
152  uint8_t date_day; //!< 1-31
153  uint8_t date_month; //!< 1-12
154  uint16_t date_year; //!< 2000-...
155  content_t();
156  };
157  content_t fields; //!< Message content, accesible by individual fields
158 
159  mrpt::system::TTimeStamp getDateTimeAsTimestamp() const; //!< Build an MRPT UTC timestamp with the year/month/day + hour/minute/sec of this observation.
160  mrpt::system::TTimeStamp getDateAsTimestamp() const; //!< Build an MRPT timestamp with the year/month/day of this observation.
161 
162  void dumpToStream( mrpt::utils::CStream &out ) const MRPT_OVERRIDE; // See docs in base
163  bool getAllFieldDescriptions( std::ostream &o ) const MRPT_OVERRIDE;
164  bool getAllFieldValues( std::ostream &o ) const MRPT_OVERRIDE;
165 };
166 #pragma pack(pop) // End of pack = 1
167 } } } // End of namespaces
168 
mrpt::obs::gnss::Message_NMEA_GGA::Message_NMEA_GGA
Message_NMEA_GGA()
Definition: gnss_messages_ascii_nmea.h:25
mrpt::obs::gnss::Message_NMEA_RMC::content_t::validity_char
int8_t validity_char
This will be: 'A'=OK or 'V'=void.
Definition: gnss_messages_ascii_nmea.h:103
mrpt::obs::gnss::NMEA_RMC
@ NMEA_RMC
Definition: gnss_messages_type_list.h:29
mrpt::obs::gnss::Message_NMEA_GLL::Message_NMEA_GLL
Message_NMEA_GLL()
Definition: gnss_messages_ascii_nmea.h:76
mrpt::obs::gnss::getAllFieldDescriptions
bool getAllFieldDescriptions(std::ostream &o) const MRPT_OVERRIDE
mrpt::obs::gnss::Message_NMEA_VTG::fields
content_t fields
Message content, accesible by individual fields.
Definition: gnss_messages_ascii_nmea.h:135
mrpt::obs::gnss::Message_NMEA_GGA::content_t::longitude_degrees
double longitude_degrees
The measured longitude, in degrees (East:+ , West:-)
Definition: gnss_messages_ascii_nmea.h:32
mrpt::obs::gnss::gnss_message_type_t
gnss_message_type_t
List of all known GNSS message types.
Definition: gnss_messages_type_list.h:21
mrpt::obs::gnss::Message_NMEA_VTG::content_t
Definition: gnss_messages_ascii_nmea.h:129
mrpt::obs::gnss::Message_NMEA_VTG::Message_NMEA_VTG
Message_NMEA_VTG()
Definition: gnss_messages_ascii_nmea.h:127
mrpt::obs::gnss::Message_NMEA_RMC::content_t::speed_knots
double speed_knots
Measured speed (in knots)
Definition: gnss_messages_ascii_nmea.h:106
mrpt::obs::gnss::NMEA_GLL
@ NMEA_GLL
Definition: gnss_messages_type_list.h:25
mrpt::obs::gnss::Message_NMEA_VTG::content_t::ground_speed_knots
double ground_speed_knots
Definition: gnss_messages_ascii_nmea.h:132
mrpt::obs::gnss::Message_NMEA_GGA
NMEA datum: GGA.
Definition: gnss_messages_ascii_nmea.h:21
mrpt::obs::gnss::Message_NMEA_GGA::fields
content_t fields
Message content, accesible by individual fields.
Definition: gnss_messages_ascii_nmea.h:44
mrpt::obs::gnss::Message_NMEA_GLL::fields
content_t fields
Message content, accesible by individual fields.
Definition: gnss_messages_ascii_nmea.h:86
mrpt::obs::gnss::Message_NMEA_GGA::getOrthoAsStruct
TGEODETICCOORDS getOrthoAsStruct() const
Return the geodetic coords as a mrpt::topography::TGeodeticCoords structure (requires linking against...
Definition: gnss_messages_ascii_nmea.h:51
mrpt::obs::gnss::Message_NMEA_ZDA::fields
content_t fields
Message content, accesible by individual fields.
Definition: gnss_messages_ascii_nmea.h:157
mrpt::obs::gnss::Message_NMEA_ZDA
NMEA datum: ZDA.
Definition: gnss_messages_ascii_nmea.h:142
mrpt::obs::gnss::Message_NMEA_ZDA::Message_NMEA_ZDA
Message_NMEA_ZDA()
Definition: gnss_messages_ascii_nmea.h:146
mrpt::obs::gnss::Message_NMEA_GGA::content_t::HDOP
float HDOP
The HDOP (Horizontal Dilution of Precision) as returned by the sensor.
Definition: gnss_messages_ascii_nmea.h:40
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CParticleFilter.h:16
mrpt::obs::gnss::Message_NMEA_GGA::getAsStruct
TGEODETICCOORDS getAsStruct() const
Return the geodetic coords as a mrpt::topography::TGeodeticCoords structure (requires linking against...
Definition: gnss_messages_ascii_nmea.h:63
mrpt::obs::gnss::Message_NMEA_ZDA::content_t::date_year
uint16_t date_year
2000-...
Definition: gnss_messages_ascii_nmea.h:154
mrpt::obs::gnss::Message_NMEA_GLL::content_t::validity_char
int8_t validity_char
This will be: 'A'=OK or 'V'=void.
Definition: gnss_messages_ascii_nmea.h:83
mrpt::obs::gnss::Message_NMEA_RMC::content_t
Definition: gnss_messages_ascii_nmea.h:100
mrpt::obs::gnss::Message_NMEA_GGA::getCorrectedOrthoAsStruct
TGEODETICCOORDS getCorrectedOrthoAsStruct() const
Return the corrected geodetic coords as a mrpt::topography::TGeodeticCoords structure (requires linki...
Definition: gnss_messages_ascii_nmea.h:57
mrpt::obs::gnss::Message_NMEA_RMC::Message_NMEA_RMC
Message_NMEA_RMC()
Definition: gnss_messages_ascii_nmea.h:97
mrpt::system::TTimeStamp
uint64_t TTimeStamp
A system independent time type, it holds the the number of 100-nanosecond intervals since January 1,...
Definition: datetime.h:30
mrpt::obs::gnss::Message_NMEA_RMC::content_t::magnetic_dir
double magnetic_dir
Magnetic variation direction (East:+, West:-)
Definition: gnss_messages_ascii_nmea.h:109
mrpt::obs::gnss::UTC_time
UTC (Coordinated Universal Time) time-stamp structure for GPS messages.
Definition: gnss_messages_common.h:109
mrpt::obs::gnss::Message_NMEA_ZDA::content_t::date_day
uint8_t date_day
1-31
Definition: gnss_messages_ascii_nmea.h:152
mrpt::obs::gnss::Message_NMEA_GGA::content_t::latitude_degrees
double latitude_degrees
The measured latitude, in degrees (North:+ , South:-)
Definition: gnss_messages_ascii_nmea.h:31
mrpt::obs::gnss::Message_NMEA_RMC::content_t::direction_degrees
double direction_degrees
Measured speed direction (in degrees)
Definition: gnss_messages_ascii_nmea.h:107
mrpt::obs::gnss::Message_NMEA_RMC::content_t::latitude_degrees
double latitude_degrees
The measured latitude, in degrees (North:+ , South:-)
Definition: gnss_messages_ascii_nmea.h:104
mrpt::obs::gnss::Message_NMEA_GLL::content_t::longitude_degrees
double longitude_degrees
The measured longitude, in degrees (East:+ , West:-)
Definition: gnss_messages_ascii_nmea.h:82
mrpt::obs::gnss::Message_NMEA_GGA::content_t::satellitesUsed
uint32_t satellitesUsed
The number of satelites used to compute this estimation.
Definition: gnss_messages_ascii_nmea.h:38
mrpt::obs::gnss::Message_NMEA_GLL::content_t
Definition: gnss_messages_ascii_nmea.h:78
mrpt::obs::gnss::Message_NMEA_RMC::content_t::positioning_mode
char positioning_mode
'A': Autonomous, 'D': Differential, 'N': Not valid, 'E': Estimated, 'M': Manual
Definition: gnss_messages_ascii_nmea.h:110
mrpt::obs::gnss::Message_NMEA_RMC::content_t::longitude_degrees
double longitude_degrees
The measured longitude, in degrees (East:+ , West:-)
Definition: gnss_messages_ascii_nmea.h:105
mrpt::utils::CStream
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition: CStream.h:38
mrpt::obs::gnss::Message_NMEA_RMC::fields
content_t fields
Message content, accesible by individual fields.
Definition: gnss_messages_ascii_nmea.h:113
mrpt::obs::gnss::Message_NMEA_GLL::content_t::latitude_degrees
double latitude_degrees
The measured latitude, in degrees (North:+ , South:-)
Definition: gnss_messages_ascii_nmea.h:81
mrpt::obs::gnss::Message_NMEA_GGA::content_t::corrected_orthometric_altitude
double corrected_orthometric_altitude
The corrected (only for TopCon mmGPS) orthometric altitude, in meters mmGPS(A+B).
Definition: gnss_messages_ascii_nmea.h:37
mrpt::obs::gnss::Message_NMEA_GGA::content_t::altitude_meters
double altitude_meters
The measured altitude, in meters (A).
Definition: gnss_messages_ascii_nmea.h:34
mrpt::obs::gnss::Message_NMEA_GGA::content_t::UTCTime
UTC_time UTCTime
The GPS sensor measured timestamp (in UTC time)
Definition: gnss_messages_ascii_nmea.h:30
mrpt::obs::gnss::Message_NMEA_GGA::content_t::thereis_HDOP
bool thereis_HDOP
This states whether to take into account the value in the HDOP field.
Definition: gnss_messages_ascii_nmea.h:39
mrpt::obs::gnss::Message_NMEA_VTG::content_t::true_track
double true_track
Definition: gnss_messages_ascii_nmea.h:131
mrpt::obs::gnss::Message_NMEA_GGA::content_t::orthometric_altitude
double orthometric_altitude
The measured orthometric altitude, in meters (A)+(B).
Definition: gnss_messages_ascii_nmea.h:36
mrpt::obs::gnss::NMEA_ZDA
@ NMEA_ZDA
Definition: gnss_messages_type_list.h:31
mrpt::obs::gnss::Message_NMEA_GLL
NMEA datum: GLL.
Definition: gnss_messages_ascii_nmea.h:72
mrpt::obs::gnss::Message_NMEA_ZDA::content_t::UTCTime
UTC_time UTCTime
The GPS sensor measured timestamp (in UTC time)
Definition: gnss_messages_ascii_nmea.h:151
mrpt::obs::gnss::Message_NMEA_ZDA::content_t
Definition: gnss_messages_ascii_nmea.h:149
mrpt::obs::gnss::getAllFieldValues
bool getAllFieldValues(std::ostream &o) const MRPT_OVERRIDE
mrpt::obs::gnss::NMEA_VTG
@ NMEA_VTG
Definition: gnss_messages_type_list.h:30
mrpt::obs::gnss::Message_NMEA_GGA::content_t::geoidal_distance
double geoidal_distance
Undulation: Difference between the measured altitude and the geoid, in meters (B).
Definition: gnss_messages_ascii_nmea.h:35
mrpt::obs::gnss::Message_NMEA_RMC::content_t::date_year
uint8_t date_year
Date: day (1-31), month (1-12), two-digits year (00-99)
Definition: gnss_messages_ascii_nmea.h:108
gnss_messages_common.h
GNSS_MESSAGE_BINARY_BLOCK
#define GNSS_MESSAGE_BINARY_BLOCK(DATA_PTR, DATA_LEN)
Definition: gnss_messages_common.h:73
mrpt::obs::gnss::gnss_message
Pure virtual base for all message types.
Definition: gnss_messages_common.h:24
mrpt::obs::gnss::Message_NMEA_RMC::content_t::UTCTime
UTC_time UTCTime
The GPS sensor measured timestamp (in UTC time)
Definition: gnss_messages_ascii_nmea.h:102
mrpt::obs::gnss::Message_NMEA_RMC
NMEA datum: RMC.
Definition: gnss_messages_ascii_nmea.h:93
mrpt::obs::gnss::Message_NMEA_ZDA::content_t::date_month
uint8_t date_month
1-12
Definition: gnss_messages_ascii_nmea.h:153
mrpt::obs::gnss::Message_NMEA_GGA::content_t::fix_quality
uint8_t fix_quality
NMEA standard values: 0 = invalid, 1 = GPS fix (SPS), 2 = DGPS fix, 3 = PPS fix, 4 = Real Time Kinema...
Definition: gnss_messages_ascii_nmea.h:33
mrpt::obs::gnss::Message_NMEA_GGA::content_t
Definition: gnss_messages_ascii_nmea.h:28
mrpt::obs::gnss::NMEA_GGA
@ NMEA_GGA
Definition: gnss_messages_type_list.h:24
mrpt::obs::gnss::Message_NMEA_GLL::content_t::UTCTime
UTC_time UTCTime
The GPS sensor measured timestamp (in UTC time)
Definition: gnss_messages_ascii_nmea.h:80
mrpt::obs::gnss::Message_NMEA_VTG
NMEA datum: VTG.
Definition: gnss_messages_ascii_nmea.h:123
MRPT_OVERRIDE
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
Definition: mrpt_macros.h:28



Page generated by Doxygen 1.8.17 for MRPT 1.4.0 SVN: at Sat Jan 18 22:37:07 UTC 2020