Main MRPT website > C++ reference
MRPT logo
CObservationGPS.h
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | The Mobile Robot Programming Toolkit (MRPT) C++ library |
3  | |
4  | http://www.mrpt.org/ |
5  | |
6  | Copyright (C) 2005-2012 University of Malaga |
7  | |
8  | This software was written by the Machine Perception and Intelligent |
9  | Robotics Lab, University of Malaga (Spain). |
10  | Contact: Jose-Luis Blanco <jlblanco@ctima.uma.es> |
11  | |
12  | This file is part of the MRPT project. |
13  | |
14  | MRPT is free software: you can redistribute it and/or modify |
15  | it under the terms of the GNU General Public License as published by |
16  | the Free Software Foundation, either version 3 of the License, or |
17  | (at your option) any later version. |
18  | |
19  | MRPT is distributed in the hope that it will be useful, |
20  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
21  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
22  | GNU General Public License for more details. |
23  | |
24  | You should have received a copy of the GNU General Public License |
25  | along with MRPT. If not, see <http://www.gnu.org/licenses/>. |
26  | |
27  +---------------------------------------------------------------------------+ */
28 #ifndef CObservationGPS_H
29 #define CObservationGPS_H
30 
32 #include <mrpt/slam/CObservation.h>
33 #include <mrpt/poses/CPose3D.h>
34 #include <mrpt/poses/CPose2D.h>
35 
36 namespace mrpt
37 {
38 namespace slam
39 {
40  using namespace mrpt::utils;
41 
43 
44  /** Declares a class derived from "CObservation" that represents a Global Positioning System (GPS) reading.
45  *
46  * \sa CObservation
47  * \ingroup mrpt_obs_grp
48  */
50  {
51  // This must be added to any CSerializable derived class:
53 
54  public:
55  /** Constructor.
56  */
57  CObservationGPS( );
58 
59  /** Dumps the contents of the observation in a human-readable form to a given output stream
60  */
61  void dumpToStream( CStream &out );
62 
63  /** Dumps the contents of the observation in a human-readable form to the console
64  */
65  void dumpToConsole( );
66 
67 
68  /** The sensor pose on the robot.
69  */
70  CPose3D sensorPose;
71 
72  /** A UTC time-stamp structure for GPS messages
73  */
75  {
76  TUTCTime();
77 
78  uint8_t hour;
79  uint8_t minute;
80  double sec;
81 
82  bool operator == (const TUTCTime& o) const { return hour==o.hour && minute==o.minute && sec==o.sec; }
83  bool operator != (const TUTCTime& o) const { return hour!=o.hour || minute!=o.minute || sec!=o.sec; }
84  inline TUTCTime& operator = (const TUTCTime& o)
85  {
86  this->hour = o.hour;
87  this->minute = o.minute;
88  this->sec = o.sec;
89  return *this;
90  }
91  };
92 
93  /** The GPS datum for GGA commands
94  */
96  {
97  TGPSDatum_GGA();
98 
99  /** Return the geodetic coords as a mrpt::topography::TGeodeticCoords structure (requires linking against mrpt-topography)
100  * Call as: getAsStruct<TGeodeticCoords>();
101  */
102  template <class TGEODETICCOORDS>
103  inline TGEODETICCOORDS getOrthoAsStruct() const {
104  return TGEODETICCOORDS(latitude_degrees,longitude_degrees,corrected_orthometric_altitude);
105  }
106 
107  /** Return the geodetic coords as a mrpt::topography::TGeodeticCoords structure (requires linking against mrpt-topography)
108  * Call as: getAsStruct<TGeodeticCoords>();
109  */
110  template <class TGEODETICCOORDS>
111  inline TGEODETICCOORDS getAsStruct() const {
112  return TGEODETICCOORDS(latitude_degrees,longitude_degrees,altitude_meters);
113  }
114 
115  /** The GPS sensor measured timestamp (in UTC time)
116  */
118 
119  /** The measured latitude, in degrees (North:+ , South:-)
120  */
122 
123  /** The measured longitude, in degrees (East:+ , West:-)
124  */
126 
127  /** The values defined in the NMEA standard are the following:
128  *
129  * 0 = invalid
130  * 1 = GPS fix (SPS)
131  * 2 = DGPS fix
132  * 3 = PPS fix
133  * 4 = Real Time Kinematic
134  * 5 = Float RTK
135  * 6 = estimated (dead reckoning) (2.3 feature)
136  * 7 = Manual input mode
137  * 8 = Simulation mode
138  */
139  uint8_t fix_quality;
140 
141  /** The measured altitude, in meters (A).
142  */
144 
145  /** Difference between the measured altitude and the geoid, in meters (B).
146  */
148 
149  /** The measured orthometric altitude, in meters (A)+(B).
150  */
152 
153  /** The corrected (mmGPS) orthometric altitude, in meters mmGPS(A+B).
154  */
156 
157  /** The number of satelites used to compute this estimation.
158  */
159  uint32_t satellitesUsed;
160 
161  /** This states whether to take into account the value in the HDOP field.
162  */
164 
165  /** The HDOP (Horizontal Dilution of Precision) as returned by the sensor.
166  */
167  float HDOP;
168  };
169 
170  /** The GPS datum for RMC commands
171  */
173  {
174  TGPSDatum_RMC();
175 
176  /** The GPS sensor measured timestamp (in UTC time)
177  */
179 
180  /** This will be: 'A'=OK or 'V'=void
181  */
183 
184  /** The measured latitude, in degrees (North:+ , South:-)
185  */
187 
188  /** The measured longitude, in degrees (East:+ , West:-)
189  */
191 
192  /** The measured speed (in knots)
193  */
194  double speed_knots;
195 
196  /** The measured speed direction (in degrees)
197  */
199  };
200 
201  /** The GPS datum for TopCon's mmGPS devices
202  */
204  {
205  TGPSDatum_PZS();
206 
207  /** Return the geodetic coords as a mrpt::topography::TGeodeticCoords structure (requires linking against mrpt-topography)
208  * Call as: getAsStruct<TGeodeticCoords>();
209  */
210  template <class TGEODETICCOORDS>
211  inline TGEODETICCOORDS getAsStruct() const {
212  return TGEODETICCOORDS(latitude_degrees,longitude_degrees,height_meters);
213  }
214 
215  double latitude_degrees; //!< The measured latitude, in degrees (North:+ , South:-)
216  double longitude_degrees; //!< The measured longitude, in degrees (East:+ , West:-)
217  double height_meters; //!< ellipsoidal height from N-beam [m] perhaps weighted with regular gps
218  double RTK_height_meters; //!< ellipsoidal height [m] without N-beam correction
219  float PSigma; //!< position SEP [m]
220  double angle_transmitter; //!< Vertical angle of N-beam
221  uint8_t nId; //!< ID of the transmitter [1-4], 0 if none.
222  uint8_t Fix; //!< 1: GPS, 2: mmGPS
223  uint8_t TXBattery; //!< battery level on transmitter
224  uint8_t RXBattery; //!< battery level on receiver
225  uint8_t error; //! system error indicator
226 
228  double cartesian_x,cartesian_y,cartesian_z; //!< Only if hasCartesianPosVel is true
229  double cartesian_vx,cartesian_vy,cartesian_vz; //!< Only if hasCartesianPosVel is true
230 
231  bool hasPosCov;
232  mrpt::math::CMatrixFloat44 pos_covariance; //!< Only if hasPosCov is true
233 
234  bool hasVelCov;
235  mrpt::math::CMatrixFloat44 vel_covariance; //!< Only if hasPosCov is true
236 
237  bool hasStats;
238  uint8_t stats_GPS_sats_used, stats_GLONASS_sats_used; //<! Only if hasStats is true
239  uint8_t stats_rtk_fix_progress; //!< [0,100] %, only in modes other than RTK FIXED.
240 
241  };
242 
243 
244  /** A generic structure for statistics about tracked satelites and their positions.
245  */
247  {
248  TGPSDatum_SATS();
249  vector_byte USIs; //!< The list of USI (Universal Sat ID) for the detected sats (See GRIL Manual, pag 4-31).
250  vector_signed_byte ELs; //!< Elevation (in degrees, 0-90) for each satellite in USIs.
251  vector_signed_word AZs; //!< Azimuth (in degrees, 0-360) for each satellite in USIs.
252  };
253 
254 
255  /** Will be true if the corresponding field contains data read from the sensor, or false if it is not available.
256  * \sa GGA_datum
257  */
259 
260  /** Will be true if the corresponding field contains data read from the sensor, or false if it is not available.
261  * \sa RMC_datum
262  */
264 
265  /** Will be true if the corresponding field contains data read from the sensor, or false if it is not available.
266  * \sa PZS_datum
267  */
269 
270  /** Will be true if the corresponding field contains data read from the sensor, or false if it is not available.
271  * \sa SATS_datum
272  */
274 
275  TGPSDatum_GGA GGA_datum; //!< If "has_GGA_datum" is true, this contains the read GGA datum.
276  TGPSDatum_RMC RMC_datum; //!< If "has_RMC_datum" is true, this contains the read RMC datum.
277  TGPSDatum_PZS PZS_datum; //!< If "has_PZS_datum" is true, this contains the read PZS datum (TopCon's mmGPS devices only)
278  TGPSDatum_SATS SATS_datum; //!< If "has_SATS_datum" is true, this contains the read PZS datum (TopCon's mmGPS devices only)
279 
280  /** A general method to retrieve the sensor pose on the robot.
281  * Note that most sensors will return a full (6D) CPose3D, but see the derived classes for more details or special cases.
282  * \sa setSensorPose
283  */
284  void getSensorPose( CPose3D &out_sensorPose ) const { out_sensorPose = sensorPose; }
285 
286 
287  /** A general method to change the sensor pose on the robot.
288  * Note that most sensors will use the full (6D) CPose3D, but see the derived classes for more details or special cases.
289  * \sa getSensorPose
290  */
291  void setSensorPose( const CPose3D &newSensorPose ) { sensorPose = newSensorPose; }
292 
293 
294  }; // End of class def.
295 
296 
297  } // End of namespace
298 } // End of namespace
299 
300 #endif



Page generated by Doxygen 1.8.3 for MRPT 0.9.6 SVN: at Fri Feb 15 22:05:02 EST 2013