30 has_satellite_timestamp(false),
32 has_GGA_datum (messages),
33 has_RMC_datum (messages),
34 has_PZS_datum (messages),
35 has_SATS_datum(messages)
58 out << timestamp << originalReceivedTimestamp << sensorLabel << sensorPose;
59 out << has_satellite_timestamp;
61 const uint32_t nMsgs = messages.size();
64 it->second->writeToStream(out);
80 in >> timestamp >> originalReceivedTimestamp >> sensorLabel >>sensorPose;
82 in >> has_satellite_timestamp;
83 else has_satellite_timestamp = (this->timestamp!=this->originalReceivedTimestamp);
87 for (
unsigned i=0;i<nMsgs;i++) {
106 in >> has_RMC_datum_;
107 if (has_RMC_datum_) {
128 in >> has_GGA_datum_;
152 in >> has_RMC_datum_;
165 else sensorLabel =
"";
168 else sensorPose.setFromValues(0,0,0,0,0,0);
172 in >> has_PZS_datum_;
206 bool has_SATS_datum_;
207 in >> has_SATS_datum_;
210 in >> SATS_datum.
USIs >> SATS_datum.
ELs >> SATS_datum.
AZs;
219 originalReceivedTimestamp = timestamp;
225 void CObservationGPS::dumpToStream(
CStream &out )
const 227 out.
printf(
"\n------------- [CObservationGPS] Dump of %u messages -----------------------\n",static_cast<unsigned int>(messages.size()));
229 it->second->dumpToStream(out);
230 out.
printf(
"-------------- [CObservationGPS] End of dump ------------------------------\n\n");
233 void CObservationGPS::dumpToConsole(std::ostream &o)
const 236 this->dumpToStream( memStr );
243 return originalReceivedTimestamp;
252 void CObservationGPS::getDescriptionAsText(std::ostream &o)
const 254 CObservation::getDescriptionAsText(o);
258 o <<
" (as TTimestamp): " << originalReceivedTimestamp << std::endl;
260 o <<
"Sensor position on the robot/vehicle: " << sensorPose << std::endl;
262 this->dumpToConsole(o);
267 return messages.find(type_id)!=messages.end();
273 ASSERTMSG_(it!=messages.end(),
mrpt::format(
"[CObservationGPS::getMsgByType] Cannot find any observation of type `%u`",static_cast<unsigned int>(type_id) ));
274 return it->second.get();
280 ASSERTMSG_(it!=messages.end(),
mrpt::format(
"[CObservationGPS::getMsgByType] Cannot find any observation of type `%u`",static_cast<unsigned int>(type_id) ));
281 return it->second.get();
286 #define TIMECONV_JULIAN_DATE_START_OF_GPS_TIME (2444244.5) // [days] 289 if( gps_tow < 0.0 || gps_tow > 604800.0 )
298 bool is_a_leap_year =
false;
301 is_a_leap_year =
true;
302 if( (year%100) == 0 )
304 if( (year%400) == 0 )
305 is_a_leap_year =
true;
306 else is_a_leap_year =
false;
309 return is_a_leap_year;
313 const unsigned short year,
314 const unsigned char month,
315 unsigned char* days_in_month
318 unsigned char utmp = 0;
323 case 1: utmp = 31;
break;
324 case 2:
if( is_a_leapyear ){ utmp = 29; }
else{ utmp = 28; }
break;
325 case 3: utmp = 31;
break;
326 case 4: utmp = 30;
break;
327 case 5: utmp = 31;
break;
328 case 6: utmp = 30;
break;
329 case 7: utmp = 31;
break;
330 case 8: utmp = 31;
break;
331 case 9: utmp = 30;
break;
332 case 10: utmp = 31;
break;
333 case 11: utmp = 30;
break;
334 case 12: utmp = 31;
break;
335 default:
return false;
break;
337 *days_in_month = utmp;
350 unsigned char minute;
351 unsigned char days_in_month = 0;
357 if( julian_date < 0.0 )
360 a = (int)(julian_date+0.5);
362 c = (int)( ((
double)
b-122.1)/365.25 );
364 e = (int)( ((
double)(
b-d))/30.6001 );
366 td =
b - d - (int)(30.6001*e) + fmod( julian_date+0.5, 1.0 );
367 day = (
unsigned char)td;
370 hour = (
unsigned char)td;
373 minute = (
unsigned char)td;
377 month = (
unsigned char)(e - 1 - 12*(
int)(e/14));
378 year = (
unsigned short)(
c - 4715 - (
int)( (7.0+(double)month) / 10.0 ));
380 if( seconds >= 60.0 )
393 if( result ==
false )
395 if( day > days_in_month )
421 if (!GPS_time_to_UTC(gps_week,gps_sec,leap_seconds_count,tim))
return false;
428 double julian_date = 0.0;
429 if( gps_sec < 0.0 || gps_sec > 604800.0 )
uint64_t TTimeStamp
A system independent time type, it holds the the number of 100-nanosecond intervals since January 1...
double angle_transmitter
Vertical angle of N-beam.
uint8_t stats_rtk_fix_progress
[0,100] %, only in modes other than RTK FIXED.
uint8_t fix_quality
NMEA standard values: 0 = invalid, 1 = GPS fix (SPS), 2 = DGPS fix, 3 = PPS fix, 4 = Real Time Kinema...
double cartesian_z
Only if hasCartesianPosVel is true.
double height_meters
ellipsoidal height from N-beam [m] perhaps weighted with regular gps
content_t fields
Message content, accesible by individual fields.
double longitude_degrees
The measured longitude, in degrees (East:+ , West:-)
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
float PSigma
position SEP [m]
mrpt::vector_byte USIs
The list of USI (Universal Sat ID) for the detected sats (See GRIL Manual, pag 4-31).
unsigned __int16 uint16_t
double latitude_degrees
The measured latitude, in degrees (North:+ , South:-)
TopCon mmGPS devices: SATS, a generic structure for statistics about tracked satelites and their posi...
mrpt::math::CMatrixFloat44 vel_covariance
Only if hasPosCov is true.
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
mrpt::system::TTimeStamp originalReceivedTimestamp
The local computer-based timestamp based on the reception of the message in the computer.
double cartesian_vz
Only if hasCartesianPosVel is true.
gnss_message_type_t
List of all known GNSS message types.
message_list_t messages
The main piece of data in this class: a list of GNNS messages.
mrpt::system::TTimeStamp BASE_IMPEXP buildTimestampFromParts(const mrpt::system::TTimeParts &p)
Builds a timestamp from the parts (Parts are in UTC)
uint32_t satellitesUsed
The number of satelites used to compute this estimation.
bool TIMECONV_GetJulianDateFromGPSTime(const unsigned short gps_week, const double gps_tow, const unsigned int utc_offset, double *julian_date)
bool TIMECONV_IsALeapYear(const unsigned short year)
const Scalar * const_iterator
GPS datum for TopCon's mmGPS devices: PZS.
int8_t validity_char
This will be: 'A'=OK or 'V'=void.
UTC_time UTCTime
The GPS sensor measured timestamp (in UTC time)
void clear()
Clear the contents of this container.
double latitude_degrees
The measured latitude, in degrees (North:+ , South:-)
uint8_t nId
ID of the transmitter [1-4], 0 if none.
double orthometric_altitude
The measured orthometric altitude, in meters (A)+(B).
bool hasCartesianPosVel
system error indicator
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...
bool thereis_HDOP
This states whether to take into account the value in the HDOP field.
This base provides a set of functions for maths stuff.
double corrected_orthometric_altitude
The corrected (only for TopCon mmGPS) orthometric altitude, in meters mmGPS(A+B). ...
mrpt::math::CMatrixFloat44 pos_covariance
Only if hasPosCov is true.
bool TIMECONV_GetNumberOfDaysInMonth(const unsigned short year, const unsigned char month, unsigned char *days_in_month)
This CStream derived class allow using a memory buffer as a CStream.
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
uint8_t stats_GPS_sats_used
The parts of a date/time (it's like the standard 'tm' but with fractions of seconds).
uint8_t stats_GLONASS_sats_used
float HDOP
The HDOP (Horizontal Dilution of Precision) as returned by the sensor.
double longitude_degrees
The measured longitude, in degrees (East:+ , West:-)
This namespace contains representation of robot actions and observations.
std::string BASE_IMPEXP format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
bool has_satellite_timestamp
If true, CObservation::timestamp has been generated from accurate satellite clock. Otherwise, no GPS data is available and timestamps are based on the local computer clock.
gnss_message_type_t message_type
Type of GNSS message.
uint8_t RXBattery
battery level on receiver
#define INVALID_TIMESTAMP
Represents an invalid timestamp, where applicable.
mrpt::vector_signed_byte ELs
Elevation (in degrees, 0-90) for each satellite in USIs.
double second
Minute (0-59)
void * getRawBufferData()
Method for getting a pointer to the raw stored data.
mrpt::vector_signed_word AZs
Azimuth (in degrees, 0-360) for each satellite in USIs.
double geoidal_distance
Undulation: Difference between the measured altitude and the geoid, in meters (B).
std::string sensorLabel
An arbitrary label that can be used to identify the sensor.
bool TIMECONV_GetUTCTimeFromJulianDate(const double julian_date, mrpt::system::TTimeParts &utc)
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
mrpt::system::TTimeStamp timestamp
The associated UTC time-stamp. Where available, this should contain the accurate satellite-based time...
double speed_knots
Measured speed (in knots)
uint8_t minute
Hour (0-23)
mrpt::poses::CPose3D sensorPose
The sensor pose on the robot/vehicle.
Declares a class that represents any robot's observation.
Pure virtual base for all message types.
std::string BASE_IMPEXP dateTimeToString(const mrpt::system::TTimeStamp t)
Convert a timestamp into this textual form (UTC time): YEAR/MONTH/DAY,HH:MM:SS.MMM.
This file implements matrix/vector text and binary serialization.
double direction_degrees
Measured speed direction (in degrees)
content_t fields
Message content, accesible by individual fields.
uint64_t getTotalBytesCount() MRPT_OVERRIDE
Returns the total size of the internal buffer.
double latitude_degrees
The measured latitude, in degrees (North:+ , South:-)
uint8_t Fix
1: GPS, 2: mmGPS
#define TIMECONV_JULIAN_DATE_START_OF_GPS_TIME
uint8_t TXBattery
battery level on transmitter
This class stores messages from GNSS or GNSS+IMU devices, from consumer-grade inexpensive GPS receive...
unsigned __int32 uint32_t
double RTK_height_meters
ellipsoidal height [m] without N-beam correction
#define ASSERTMSG_(f, __ERROR_MSG)
GLubyte GLubyte GLubyte a
double BASE_IMPEXP timestampTotime_t(const mrpt::system::TTimeStamp t)
Transform from TTimeStamp to standard "time_t" (actually a double number, it can contain fractions of...
virtual int printf(const char *fmt,...) MRPT_printf_format_check(2
Writes a string to the stream in a textual form.
UTC_time UTCTime
The GPS sensor measured timestamp (in UTC time)
A smart pointer to a GNSS message.
double longitude_degrees
The measured longitude, in degrees (East:+ , West:-)