Main MRPT website > C++ reference
MRPT logo
CObservationGPS.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-2014, 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 #ifndef CObservationGPS_H
10 #define CObservationGPS_H
11 
13 #include <mrpt/slam/CObservation.h>
14 #include <mrpt/poses/CPose3D.h>
15 #include <mrpt/poses/CPose2D.h>
16 
17 namespace mrpt
18 {
19 namespace slam
20 {
21  using namespace mrpt::utils;
22 
23  DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE( CObservationGPS , CObservation, OBS_IMPEXP)
24 
25  /** Declares a class derived from "CObservation" that represents a Global Positioning System (GPS) reading.
26  *
27  * \sa CObservation
28  * \ingroup mrpt_obs_grp
29  */
31  {
32  // This must be added to any CSerializable derived class:
34 
35  public:
36  /** Constructor.
37  */
38  CObservationGPS( );
39 
40  /** Dumps the contents of the observation in a human-readable form to a given output stream
41  */
42  void dumpToStream( CStream &out );
43 
44  /** Dumps the contents of the observation in a human-readable form to the console
45  */
46  void dumpToConsole( );
47 
48 
49  /** The sensor pose on the robot.
50  */
51  CPose3D sensorPose;
52 
53  /** A UTC time-stamp structure for GPS messages
54  */
56  {
57  TUTCTime();
58 
59  uint8_t hour;
60  uint8_t minute;
61  double sec;
62 
63  mrpt::system::TTimeStamp getAsTimestamp(const mrpt::system::TTimeStamp &date) const; //!< Build an MRPT timestamp with the hour/minute/sec of this structure and the date from the given timestamp.
64  bool operator == (const TUTCTime& o) const { return hour==o.hour && minute==o.minute && sec==o.sec; }
65  bool operator != (const TUTCTime& o) const { return hour!=o.hour || minute!=o.minute || sec!=o.sec; }
66  inline TUTCTime& operator = (const TUTCTime& o)
67  {
68  this->hour = o.hour;
69  this->minute = o.minute;
70  this->sec = o.sec;
71  return *this;
72  }
73  };
74 
75  /** The GPS datum for GGA commands
76  */
78  {
79  TGPSDatum_GGA();
80 
81  /** Return the geodetic coords as a mrpt::topography::TGeodeticCoords structure (requires linking against mrpt-topography)
82  * Call as: getAsStruct<TGeodeticCoords>();
83  */
84  template <class TGEODETICCOORDS>
85  inline TGEODETICCOORDS getOrthoAsStruct() const {
86  return TGEODETICCOORDS(latitude_degrees,longitude_degrees,orthometric_altitude);
87  }
88 
89  /** Return the corrected geodetic coords as a mrpt::topography::TGeodeticCoords structure (requires linking against mrpt-topography)
90  * Call as: getAsStruct<TGeodeticCoords>();
91  */
92  template <class TGEODETICCOORDS>
93  inline TGEODETICCOORDS getCorrectedOrthoAsStruct() const {
94  return TGEODETICCOORDS(latitude_degrees,longitude_degrees,corrected_orthometric_altitude);
95  }
96  /** Return the geodetic coords as a mrpt::topography::TGeodeticCoords structure (requires linking against mrpt-topography)
97  * Call as: getAsStruct<TGeodeticCoords>();
98  */
99  template <class TGEODETICCOORDS>
100  inline TGEODETICCOORDS getAsStruct() const {
101  return TGEODETICCOORDS(latitude_degrees,longitude_degrees,altitude_meters);
102  }
103 
104  /** The GPS sensor measured timestamp (in UTC time)
105  */
107 
108  /** The measured latitude, in degrees (North:+ , South:-)
109  */
111 
112  /** The measured longitude, in degrees (East:+ , West:-)
113  */
115 
116  /** The values defined in the NMEA standard are the following:
117  *
118  * 0 = invalid
119  * 1 = GPS fix (SPS)
120  * 2 = DGPS fix
121  * 3 = PPS fix
122  * 4 = Real Time Kinematic
123  * 5 = Float RTK
124  * 6 = estimated (dead reckoning) (2.3 feature)
125  * 7 = Manual input mode
126  * 8 = Simulation mode
127  */
128  uint8_t fix_quality;
129 
130  /** The measured altitude, in meters (A).
131  */
133 
134  /** Difference between the measured altitude and the geoid, in meters (B).
135  */
137 
138  /** The measured orthometric altitude, in meters (A)+(B).
139  */
141 
142  /** The corrected (mmGPS) orthometric altitude, in meters mmGPS(A+B).
143  */
145 
146  /** The number of satelites used to compute this estimation.
147  */
148  uint32_t satellitesUsed;
149 
150  /** This states whether to take into account the value in the HDOP field.
151  */
153 
154  /** The HDOP (Horizontal Dilution of Precision) as returned by the sensor.
155  */
156  float HDOP;
157  };
158 
159  /** The GPS datum for RMC commands
160  */
162  {
163  TGPSDatum_RMC();
164 
165  /** The GPS sensor measured timestamp (in UTC time)
166  */
168 
169  /** This will be: 'A'=OK or 'V'=void
170  */
172 
173  /** The measured latitude, in degrees (North:+ , South:-)
174  */
176 
177  /** The measured longitude, in degrees (East:+ , West:-)
178  */
180 
181  /** The measured speed (in knots)
182  */
183  double speed_knots;
184 
185  /** The measured speed direction (in degrees)
186  */
188  };
189 
190  /** The GPS datum for TopCon's mmGPS devices
191  */
193  {
194  TGPSDatum_PZS();
195 
196  /** Return the geodetic coords as a mrpt::topography::TGeodeticCoords structure (requires linking against mrpt-topography)
197  * Call as: getAsStruct<TGeodeticCoords>();
198  */
199  template <class TGEODETICCOORDS>
200  inline TGEODETICCOORDS getAsStruct() const {
201  return TGEODETICCOORDS(latitude_degrees,longitude_degrees,height_meters);
202  }
203 
204  double latitude_degrees; //!< The measured latitude, in degrees (North:+ , South:-)
205  double longitude_degrees; //!< The measured longitude, in degrees (East:+ , West:-)
206  double height_meters; //!< ellipsoidal height from N-beam [m] perhaps weighted with regular gps
207  double RTK_height_meters; //!< ellipsoidal height [m] without N-beam correction
208  float PSigma; //!< position SEP [m]
209  double angle_transmitter; //!< Vertical angle of N-beam
210  uint8_t nId; //!< ID of the transmitter [1-4], 0 if none.
211  uint8_t Fix; //!< 1: GPS, 2: mmGPS
212  uint8_t TXBattery; //!< battery level on transmitter
213  uint8_t RXBattery; //!< battery level on receiver
214  uint8_t error; //! system error indicator
215 
217  double cartesian_x,cartesian_y,cartesian_z; //!< Only if hasCartesianPosVel is true
218  double cartesian_vx,cartesian_vy,cartesian_vz; //!< Only if hasCartesianPosVel is true
219 
220  bool hasPosCov;
221  mrpt::math::CMatrixFloat44 pos_covariance; //!< Only if hasPosCov is true
222 
223  bool hasVelCov;
224  mrpt::math::CMatrixFloat44 vel_covariance; //!< Only if hasPosCov is true
225 
226  bool hasStats;
227  uint8_t stats_GPS_sats_used, stats_GLONASS_sats_used; //<! Only if hasStats is true
228  uint8_t stats_rtk_fix_progress; //!< [0,100] %, only in modes other than RTK FIXED.
229 
230  };
231 
232 
233  /** A generic structure for statistics about tracked satelites and their positions.
234  */
236  {
237  TGPSDatum_SATS();
238  vector_byte USIs; //!< The list of USI (Universal Sat ID) for the detected sats (See GRIL Manual, pag 4-31).
239  vector_signed_byte ELs; //!< Elevation (in degrees, 0-90) for each satellite in USIs.
240  vector_signed_word AZs; //!< Azimuth (in degrees, 0-360) for each satellite in USIs.
241  };
242 
243 
244  /** Will be true if the corresponding field contains data read from the sensor, or false if it is not available.
245  * \sa GGA_datum
246  */
248 
249  /** Will be true if the corresponding field contains data read from the sensor, or false if it is not available.
250  * \sa RMC_datum
251  */
253 
254  /** Will be true if the corresponding field contains data read from the sensor, or false if it is not available.
255  * \sa PZS_datum
256  */
258 
259  /** Will be true if the corresponding field contains data read from the sensor, or false if it is not available.
260  * \sa SATS_datum
261  */
263 
264  TGPSDatum_GGA GGA_datum; //!< If "has_GGA_datum" is true, this contains the read GGA datum.
265  TGPSDatum_RMC RMC_datum; //!< If "has_RMC_datum" is true, this contains the read RMC datum.
266  TGPSDatum_PZS PZS_datum; //!< If "has_PZS_datum" is true, this contains the read PZS datum (TopCon's mmGPS devices only)
267  TGPSDatum_SATS SATS_datum; //!< If "has_SATS_datum" is true, this contains the read PZS datum (TopCon's mmGPS devices only)
268 
269  /** Empties this observation, setting all "has_*_datum" to "false" */
270  void clear();
271 
272  /** A general method to retrieve the sensor pose on the robot.
273  * Note that most sensors will return a full (6D) CPose3D, but see the derived classes for more details or special cases.
274  * \sa setSensorPose
275  */
276  void getSensorPose( CPose3D &out_sensorPose ) const { out_sensorPose = sensorPose; }
277 
278 
279  /** A general method to change the sensor pose on the robot.
280  * Note that most sensors will use the full (6D) CPose3D, but see the derived classes for more details or special cases.
281  * \sa getSensorPose
282  */
283  void setSensorPose( const CPose3D &newSensorPose ) { sensorPose = newSensorPose; }
284 
285 
286  }; // End of class def.
287  DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE( CObservationGPS , CObservation, OBS_IMPEXP)
288 
289 
290  } // End of namespace
291 } // End of namespace
292 
293 #endif
bool operator!=(const CArray< T, N > &x, const CArray< T, N > &y)
Definition: CArray.h:287
uint64_t TTimeStamp
A system independent time type, it holds the the number of 100-nanosecond intervals since January 1...
Definition: datetime.h:30
std::vector< uint8_t > vector_byte
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
Definition: zip.h:16
uint8_t RXBattery
battery level on receiver
double longitude_degrees
The measured longitude, in degrees (East:+ , West:-)
bool has_GGA_datum
Will be true if the corresponding field contains data read from the sensor, or false if it is not ava...
double orthometric_altitude
The measured orthometric altitude, in meters (A)+(B).
bool thereis_HDOP
This states whether to take into account the value in the HDOP field.
double longitude_degrees
The measured longitude, in degrees (East:+ , West:-)
bool has_RMC_datum
Will be true if the corresponding field contains data read from the sensor, or false if it is not ava...
TGPSDatum_SATS SATS_datum
If "has_SATS_datum" is true, this contains the read PZS datum (TopCon's mmGPS devices only) ...
double cartesian_z
Only if hasCartesianPosVel is true.
double RTK_height_meters
ellipsoidal height [m] without N-beam correction
TGEODETICCOORDS getCorrectedOrthoAsStruct() const
Return the corrected geodetic coords as a mrpt::topography::TGeodeticCoords structure (requires linki...
vector_signed_word AZs
Azimuth (in degrees, 0-360) for each satellite in USIs.
uint32_t satellitesUsed
The number of satelites used to compute this estimation.
mrpt::math::CMatrixFloat44 vel_covariance
Only if hasPosCov is true.
TGEODETICCOORDS getOrthoAsStruct() const
Return the geodetic coords as a mrpt::topography::TGeodeticCoords structure (requires linking against...
vector_byte USIs
The list of USI (Universal Sat ID) for the detected sats (See GRIL Manual, pag 4-31).
double geoidal_distance
Difference between the measured altitude and the geoid, in meters (B).
A generic structure for statistics about tracked satelites and their positions.
float HDOP
The HDOP (Horizontal Dilution of Precision) as returned by the sensor.
uint8_t stats_rtk_fix_progress
[0,100] %, only in modes other than RTK FIXED.
double altitude_meters
The measured altitude, in meters (A).
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition: CStream.h:38
A numeric matrix of compile-time fixed size.
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
TUTCTime UTCTime
The GPS sensor measured timestamp (in UTC time)
std::vector< int16_t > vector_signed_word
double corrected_orthometric_altitude
The corrected (mmGPS) orthometric altitude, in meters mmGPS(A+B).
Declares a class that represents any robot's observation.
Definition: CObservation.h:52
bool operator==(const CArray< T, N > &x, const CArray< T, N > &y)
Definition: CArray.h:279
bool hasCartesianPosVel
system error indicator
double longitude_degrees
The measured longitude, in degrees (East:+ , West:-)
double angle_transmitter
Vertical angle of N-beam.
int8_t validity_char
This will be: 'A'=OK or 'V'=void.
bool has_SATS_datum
Will be true if the corresponding field contains data read from the sensor, or false if it is not ava...
Declares a class derived from "CObservation" that represents a Global Positioning System (GPS) readin...
uint8_t TXBattery
battery level on transmitter
double latitude_degrees
The measured latitude, in degrees (North:+ , South:-)
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
bool has_PZS_datum
Will be true if the corresponding field contains data read from the sensor, or false if it is not ava...
double latitude_degrees
The measured latitude, in degrees (North:+ , South:-)
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:69
void getSensorPose(CPose3D &out_sensorPose) const
A general method to retrieve the sensor pose on the robot.
The GPS datum for RMC commands.
The GPS datum for TopCon's mmGPS devices.
The GPS datum for GGA commands.
uint8_t fix_quality
The values defined in the NMEA standard are the following:
double height_meters
ellipsoidal height from N-beam [m] perhaps weighted with regular gps
std::vector< int8_t > vector_signed_byte
TGPSDatum_GGA GGA_datum
If "has_GGA_datum" is true, this contains the read GGA datum.
TUTCTime UTCTime
The GPS sensor measured timestamp (in UTC time)
double speed_knots
The measured speed (in knots)
uint8_t nId
ID of the transmitter [1-4], 0 if none.
void setSensorPose(const CPose3D &newSensorPose)
A general method to change the sensor pose on the robot.
double direction_degrees
The measured speed direction (in degrees)
TGEODETICCOORDS getAsStruct() const
Return the geodetic coords as a mrpt::topography::TGeodeticCoords structure (requires linking against...
vector_signed_byte ELs
Elevation (in degrees, 0-90) for each satellite in USIs.
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
TGPSDatum_RMC RMC_datum
If "has_RMC_datum" is true, this contains the read RMC datum.
TGEODETICCOORDS getAsStruct() const
Return the geodetic coords as a mrpt::topography::TGeodeticCoords structure (requires linking against...
TGPSDatum_PZS PZS_datum
If "has_PZS_datum" is true, this contains the read PZS datum (TopCon's mmGPS devices only) ...
mrpt::math::CMatrixFloat44 pos_covariance
Only if hasPosCov is true.
A UTC time-stamp structure for GPS messages.
double latitude_degrees
The measured latitude, in degrees (North:+ , South:-)
double cartesian_vz
Only if hasCartesianPosVel is true.



Page generated by Doxygen 1.8.8 for MRPT 1.2.2 SVN:Unversioned directory at Tue Oct 14 02:14:08 UTC 2014