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)
52 void CObservationGPS::writeToStream(
59 out << timestamp << originalReceivedTimestamp << sensorLabel
61 out << has_satellite_timestamp;
63 const uint32_t nMsgs = messages.size();
66 it != messages.end(); ++it)
67 it->second->writeToStream(out);
83 in >> timestamp >> originalReceivedTimestamp >> sensorLabel >>
86 in >> has_satellite_timestamp;
88 has_satellite_timestamp =
89 (this->timestamp != this->originalReceivedTimestamp);
93 for (
unsigned i = 0; i < nMsgs; i++)
96 gnss::gnss_message::readAndBuildFromStream(
in);
107 in >> has_GGA_datum_;
116 in >> has_RMC_datum_;
141 in >> has_GGA_datum_;
174 in >> has_RMC_datum_;
197 sensorPose.setFromValues(0, 0, 0, 0, 0, 0);
201 in >> has_PZS_datum_;
257 bool has_SATS_datum_;
258 in >> has_SATS_datum_;
273 originalReceivedTimestamp = timestamp;
279 void CObservationGPS::dumpToStream(
CStream& out)
const 282 "\n------------- [CObservationGPS] Dump of %u messages " 283 "-----------------------\n",
284 static_cast<unsigned int>(messages.size()));
286 it != messages.end(); ++it)
287 it->second->dumpToStream(out);
289 "-------------- [CObservationGPS] End of dump " 290 "------------------------------\n\n");
293 void CObservationGPS::dumpToConsole(std::ostream& o)
const 296 this->dumpToStream(memStr);
307 return originalReceivedTimestamp;
316 void CObservationGPS::getDescriptionAsText(std::ostream& o)
const 318 CObservation::getDescriptionAsText(o);
320 o <<
"Timestamp (UTC) of reception at the computer: " 322 o <<
" (as time_t): " << std::fixed << std::setprecision(5)
325 o <<
" (as TTimestamp): " << originalReceivedTimestamp << std::endl;
327 o <<
"Sensor position on the robot/vehicle: " << sensorPose << std::endl;
329 this->dumpToConsole(o);
334 return messages.find(type_id) != messages.end();
343 "[CObservationGPS::getMsgByType] Cannot find " 344 "any observation of type `%u`",
345 static_cast<unsigned int>(type_id)));
346 return it->second.get();
355 "[CObservationGPS::getMsgByType] Cannot find " 356 "any observation of type `%u`",
357 static_cast<unsigned int>(type_id)));
358 return it->second.get();
362 #define TIMECONV_JULIAN_DATE_START_OF_GPS_TIME (2444244.5) // [days] 364 const unsigned short gps_week,
const double gps_tow,
365 const unsigned int utc_offset,
double* julian_date)
367 if (gps_tow < 0.0 || gps_tow > 604800.0)
return false;
369 *julian_date = (gps_week + (gps_tow -
utc_offset) / 604800.0) * 7.0 +
376 bool is_a_leap_year =
false;
379 is_a_leap_year =
true;
380 if ((year % 100) == 0)
382 if ((year % 400) == 0)
383 is_a_leap_year =
true;
385 is_a_leap_year =
false;
388 return is_a_leap_year;
393 const unsigned short year,
395 const unsigned char month,
397 unsigned char* days_in_month)
399 unsigned char utmp = 0;
451 *days_in_month = utmp;
465 unsigned char minute;
466 unsigned char days_in_month = 0;
472 if (julian_date < 0.0)
return false;
474 a = (int)(julian_date + 0.5);
476 c = (int)(((
double)
b - 122.1) / 365.25);
477 d = (int)(365.25 *
c);
478 e = (int)(((
double)(
b - d)) / 30.6001);
480 td =
b - d - (int)(30.6001 * e) + fmod(julian_date + 0.5, 1.0);
481 day = (
unsigned char)td;
484 hour = (
unsigned char)td;
487 minute = (
unsigned char)td;
491 month = (
unsigned char)(e - 1 - 12 * (
int)(e / 14));
492 year = (
unsigned short)(
c - 4715 - (
int)((7.0 + (double)month) / 10.0));
507 year, month, &days_in_month);
508 if (result ==
false)
return false;
509 if (day > days_in_month)
532 bool CObservationGPS::GPS_time_to_UTC(
533 uint16_t gps_week,
double gps_sec,
const int leap_seconds_count,
537 if (!GPS_time_to_UTC(gps_week, gps_sec, leap_seconds_count, tim))
543 bool CObservationGPS::GPS_time_to_UTC(
544 uint16_t gps_week,
double gps_sec,
const int leap_seconds_count,
547 double julian_date = 0.0;
548 if (gps_sec < 0.0 || gps_sec > 604800.0)
return false;
550 gps_week, gps_sec, leap_seconds_count, &julian_date))
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 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.
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 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 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.
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)
double cartesian_x
Only if hasCartesianPosVel is true.
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)
Number of days since noon Universal Time Jan 1, 4713 BCE (Julian calendar) [days].
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
mrpt::system::TTimeStamp timestamp
The associated UTC time-stamp.
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 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)
#define MRPT_READ_POD(_STREAM, _VARIABLE)
content_t fields
Message content, accesible by individual fields.
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
double cartesian_vx
Only if hasCartesianPosVel is true.
uint64_t getTotalBytesCount() override
Returns the total size of the internal buffer.
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 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:-)