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



Page generated by Doxygen 1.8.12 for MRPT 1.3.2 SVN: at Thu Nov 10 13:22:34 UTC 2016