ROSaic
|
Functions | |
double | parseDouble (const uint8_t *buffer) |
Converts an 8-byte-buffer into a double. More... | |
bool | parseDouble (const std::string &string, double &value) |
Interprets the contents of "string" as a floating point number of type double. More... | |
float | parseFloat (const uint8_t *buffer) |
Converts a 4-byte-buffer into a float. More... | |
bool | parseFloat (const std::string &string, float &value) |
Interprets the contents of "string" as a floating point number of type float. More... | |
int16_t | parseInt16 (const uint8_t *buffer) |
Converts a 2-byte-buffer into a signed 16-bit integer. More... | |
bool | parseInt16 (const std::string &string, int16_t &value, int32_t base=10) |
Interprets the contents of "string" as a integer number of type int16_t. More... | |
int32_t | parseInt32 (const uint8_t *buffer) |
Converts a 4-byte-buffer into a signed 32-bit integer. More... | |
bool | parseInt32 (const std::string &string, int32_t &value, int32_t base=10) |
Interprets the contents of "string" as a integer number of type int32_t. More... | |
bool | parseUInt8 (const std::string &string, uint8_t &value, int32_t base=10) |
Interprets the contents of "string" as a unsigned integer number of type uint8_t. More... | |
uint16_t | parseUInt16 (const uint8_t *buffer) |
Converts a 2-byte-buffer into an unsigned 16-bit integer. More... | |
bool | parseUInt16 (const std::string &string, uint16_t &value, int32_t base=10) |
Interprets the contents of "string" as a unsigned integer number of type uint16_t. More... | |
uint32_t | parseUInt32 (const uint8_t *buffer) |
Converts a 4-byte-buffer into an unsigned 32-bit integer. More... | |
bool | parseUInt32 (const std::string &string, uint32_t &value, int32_t base=10) |
Interprets the contents of "string" as a unsigned integer number of type uint32_t. More... | |
double | convertUTCDoubleToSeconds (double utc_double) |
Converts UTC time from the without-colon-delimiter format to the number-of-seconds-since-midnight format. More... | |
double | convertDMSToDegrees (double dms) |
Converts latitude or longitude from the DMS notation (in the without-colon-delimiter format), to the pure degree notation. More... | |
time_t | convertUTCtoUnix (double utc_double) |
Converts UTC time from the without-colon-delimiter format to Unix Epoch time (a number-of-seconds-since-1970/01/01 format) More... | |
geometry_msgs::Quaternion | convertEulerToQuaternion (double yaw, double pitch, double roll) |
Transforms Euler angles to a quaternion. More... | |
uint32_t | convertUserPeriodToRxCommand (uint32_t period_user) |
Transforms the input polling period [milliseconds] into a uint32_t number that can be appended to either sec or msec for Rx commands. More... | |
double parsing_utilities::convertDMSToDegrees | ( | double | dms | ) |
Converts latitude or longitude from the DMS notation (in the without-colon-delimiter format), to the pure degree notation.
Recall: One degree is divided into 60 minutes (of arc), and in turn one minute into 60 seconds (of arc). Use of the degrees-minutes-seconds system is also called DMS notation.
Note that DMS stands for "Degrees, Minutes, Seconds".
[in] | dms | Represents latitude or longitude in the DMS notation (in the without-colon-delimiter format) |
Definition at line 239 of file parsing_utilities.cpp.
Referenced by GpggaParser::parseASCII(), and GprmcParser::parseASCII().
geometry_msgs::Quaternion parsing_utilities::convertEulerToQuaternion | ( | double | yaw, |
double | pitch, | ||
double | roll | ||
) |
Transforms Euler angles to a quaternion.
The rotational sequence convention we adopt here (and Septentrio receivers' pitch, roll, yaw definition too) is the yaw-pitch-roll sequence, i.e. the 3-2-1 sequence: The body first does yaw around the Z=Down-axis, then pitches around the new Y=East=right-axis and finally rolls around the new X=North=forward-axis.
[in] | yaw | Yaw, i.e. heading, about the Up-axis |
[in] | pitch | Pitch about the new North-axis |
[in] | roll | Roll about the new East-axis |
Definition at line 296 of file parsing_utilities.cpp.
Referenced by io_comm_rx::RxMessage::PoseWithCovarianceStampedCallback().
uint32_t parsing_utilities::convertUserPeriodToRxCommand | ( | uint32_t | period_user | ) |
Transforms the input polling period [milliseconds] into a uint32_t number that can be appended to either sec or msec for Rx commands.
[in] | period_user | Polling period in milliseconds as specified by the ROSaic user |
Definition at line 315 of file parsing_utilities.cpp.
Referenced by rosaic_node::ROSaicNode::configureRx().
double parsing_utilities::convertUTCDoubleToSeconds | ( | double | utc_double | ) |
Converts UTC time from the without-colon-delimiter format to the number-of-seconds-since-midnight format.
The UTC precision in NMEA messages is down to a tenth of a second, naturally in both the without-colon-delimiter and the number-of-seconds-since-midnight formats.
[in] | utc_double | Rrepresents UTC time in the without-colon-delimiter format |
Definition at line 226 of file parsing_utilities.cpp.
Referenced by GpggaParser::parseASCII(), and GprmcParser::parseASCII().
std::time_t parsing_utilities::convertUTCtoUnix | ( | double | utc_double | ) |
Converts UTC time from the without-colon-delimiter format to Unix Epoch time (a number-of-seconds-since-1970/01/01 format)
Time information (hours, minutes, seconds) is extracted from the given double and augmented with the date, which is taken from the current system time on the host computer (i.e. current UTC+some_shift time via time(0)). The date ambiguity is resolved by adding/subtracting a day to the current date if the host time is more than 12 hours behind/ahead the NMEA time (i.e. UTC time). Recall time(0), time(NULL): If argument is a null pointer, the parameter is not used (the function still returns the current calendar time of type time_t). Otherwise, the return value is the same as the one stored in the location pointed by the argument. Note that the function assumes that utc_double has two significant digits after the decimal point, i.e. hhmmss.ss, yet it does not round the number of seconds to the nearest unsigned integer, but instead disregards ss. This is since we use this function for the "header.stamp.sec" field of ROS messages, while "header.stamp.nsec" is taken care of separately.
Note that the type "std::time_t" is usually 32 bits, which also leads to the "Year 2038 Problem".
[in] | utc_double | Represents UTC time in the without-colon-delimiter format |
Definition at line 259 of file parsing_utilities.cpp.
Referenced by GpggaParser::parseASCII(), GprmcParser::parseASCII(), and io_comm_rx::timestampSBF().
double parsing_utilities::parseDouble | ( | const uint8_t * | buffer | ) |
Converts an 8-byte-buffer into a double.
The function assumes that the bytes in the buffer are already arranged with the same endianness as the local platform. It copies the elements in the range [buffer,buffer + sizeof(double)) into the range beginning at reinterpret_cast<uint8_t*>(&x). Recall: data_type *var_name = reinterpret_cast <data_type *>(pointer_variable) converts the pointer type, no return type
[in] | buffer | A pointer to a buffer containing 8 bytes of data |
Definition at line 51 of file parsing_utilities.cpp.
Referenced by GpggaParser::parseASCII(), and GprmcParser::parseASCII().
bool parsing_utilities::parseDouble | ( | const std::string & | string, |
double & | value | ||
) |
Interprets the contents of "string" as a floating point number of type double.
It checks whether an error occurred (via errno) and whether junk characters exist within "string", and returns true if the latter two tests are negative or when the string is empty, false otherwise.
It stores the "string"'s value in "value" and returns whether or not all went well.
[in] | string | The string whose content should be interpreted as a floating point number |
[out] | value | The double variable that should be overwritten by the floating point number found in "string" |
Definition at line 62 of file parsing_utilities.cpp.
References string_utilities::toDouble().
float parsing_utilities::parseFloat | ( | const uint8_t * | buffer | ) |
Converts a 4-byte-buffer into a float.
The function assumes that the bytes in the buffer are already arranged with the same endianness as the local platform. It copies the elements in the range [buffer,buffer + sizeof(double)) into the range beginning at reinterpret_cast<uint8_t*>(&x). Recall: data_type *var_name = reinterpret_cast <data_type *>(pointer_variable) converts the pointer type, no return type
[in] | buffer | A pointer to a buffer containing 4 bytes of data |
Definition at line 72 of file parsing_utilities.cpp.
Referenced by GpgsaParser::parseASCII(), GpgsvParser::parseASCII(), GprmcParser::parseASCII(), and GpggaParser::parseASCII().
bool parsing_utilities::parseFloat | ( | const std::string & | string, |
float & | value | ||
) |
Interprets the contents of "string" as a floating point number of type float.
It checks whether an error occurred (via errno) and whether junk characters exist within "string", and returns true if the latter two tests are negative or when the string is empty, false otherwise.
It stores the "string"'s value in "value" and returns whether or not all went well.
[in] | string | The string whose content should be interpreted as a floating point number |
[out] | value | The float variable that should be overwritten by the floating point number found in "string" |
Definition at line 83 of file parsing_utilities.cpp.
References string_utilities::toFloat().
int16_t parsing_utilities::parseInt16 | ( | const uint8_t * | buffer | ) |
Converts a 2-byte-buffer into a signed 16-bit integer.
The function assumes that the bytes in the buffer are already arranged with the same endianness as the local platform. It copies the elements in the range [buffer,buffer + 2) into the range beginning at reinterpret_cast<uint8_t*>(&x). Recall: data_type *var_name = reinterpret_cast <data_type *>(pointer_variable) converts the pointer type, no return type
[in] | buffer | A pointer to a buffer containing 2 bytes of data |
Definition at line 93 of file parsing_utilities.cpp.
bool parsing_utilities::parseInt16 | ( | const std::string & | string, |
int16_t & | value, | ||
int32_t | base | ||
) |
Interprets the contents of "string" as a integer number of type int16_t.
It checks whether an error occurred (via errno) and whether junk characters exist within "string", and returns true if the latter two tests are negative or when the string is empty, false otherwise.
It stores the "string"'s value in "value" and returns whether or not all went well.
[in] | string | The string whose content should be interpreted as an integer number |
[out] | value | The int16_t variable that should be overwritten by the integer number found in "string" |
[in] | base | The numerical base of the integer in the string, default being 10 |
Definition at line 104 of file parsing_utilities.cpp.
References string_utilities::toInt32().
int32_t parsing_utilities::parseInt32 | ( | const uint8_t * | buffer | ) |
Converts a 4-byte-buffer into a signed 32-bit integer.
The function assumes that the bytes in the buffer are already arranged with the same endianness as the local platform. It copies the elements in the range [buffer,buffer + 4) into the range beginning at reinterpret_cast<uint8_t*>(&x). Recall: data_type *var_name = reinterpret_cast <data_type *>(pointer_variable) converts the pointer type, no return type
[in] | buffer | A pointer to a buffer containing 4 bytes of data |
Definition at line 129 of file parsing_utilities.cpp.
bool parsing_utilities::parseInt32 | ( | const std::string & | string, |
int32_t & | value, | ||
int32_t | base | ||
) |
Interprets the contents of "string" as a integer number of type int32_t.
It checks whether an error occurred (via errno) and whether junk characters exist within "string", and returns true if the latter two tests are negative or when the string is empty, false otherwise.
It stores the "string"'s value in "value" and returns whether or not all went well.
[in] | string | The string whose content should be interpreted as an integer number |
[out] | value | The int32_t variable that should be overwritten by the integer number found in "string" |
[in] | base | The numerical base of the integer in the string, default being 10 |
Definition at line 140 of file parsing_utilities.cpp.
References string_utilities::toInt32().
uint16_t parsing_utilities::parseUInt16 | ( | const uint8_t * | buffer | ) |
Converts a 2-byte-buffer into an unsigned 16-bit integer.
The function assumes that the bytes in the buffer are already arranged with the same endianness as the local platform. It copies the elements in the range [buffer,buffer + 2) into the range beginning at reinterpret_cast<uint8_t*>(&x). Recall: data_type *var_name = reinterpret_cast <data_type *>(pointer_variable) converts the pointer type, no return type
[in] | buffer | A pointer to a buffer containing 2 bytes of data |
Definition at line 172 of file parsing_utilities.cpp.
bool parsing_utilities::parseUInt16 | ( | const std::string & | string, |
uint16_t & | value, | ||
int32_t | base | ||
) |
Interprets the contents of "string" as a unsigned integer number of type uint16_t.
It checks whether an error occurred (via errno) and whether junk characters exist within "string", and returns true if the latter two tests are negative or when the string is empty, false otherwise.
It stores the "string"'s value in "value" and returns whether or not all went well.
[in] | string | The string whose content should be interpreted as an integer number |
[out] | value | The uint16_t variable that should be overwritten by the integer number found in "string" |
[in] | base | The numerical base of the integer in the string, default being 10 |
Definition at line 183 of file parsing_utilities.cpp.
References string_utilities::toUInt32().
uint32_t parsing_utilities::parseUInt32 | ( | const uint8_t * | buffer | ) |
Converts a 4-byte-buffer into an unsigned 32-bit integer.
The function assumes that the bytes in the buffer are already arranged with the same endianness as the local platform. It copies the elements in the range [buffer,buffer + 4) into the range beginning at reinterpret_cast<uint8_t*>(&x). Recall: data_type *var_name = reinterpret_cast <data_type *>(pointer_variable) converts the pointer type, no return type
[in] | buffer | A pointer to a buffer containing 4 bytes of data |
Definition at line 206 of file parsing_utilities.cpp.
Referenced by GpggaParser::parseASCII().
bool parsing_utilities::parseUInt32 | ( | const std::string & | string, |
uint32_t & | value, | ||
int32_t | base | ||
) |
Interprets the contents of "string" as a unsigned integer number of type uint32_t.
It checks whether an error occurred (via errno) and whether junk characters exist within "string", and returns true if the latter two tests are negative or when the string is empty, false otherwise.
It stores the "string"'s value in "value" and returns whether or not all went well.
[in] | string | The string whose content should be interpreted as an integer number |
[out] | value | The uint32_t variable that should be overwritten by the integer number found in "string" |
[in] | base | The numerical base of the integer in the string, default being 10 |
Definition at line 217 of file parsing_utilities.cpp.
References string_utilities::toUInt32().
bool parsing_utilities::parseUInt8 | ( | const std::string & | string, |
uint8_t & | value, | ||
int32_t | base | ||
) |
Interprets the contents of "string" as a unsigned integer number of type uint8_t.
It checks whether an error occurred (via errno) and whether junk characters exist within "string", and returns true if the latter two tests are negative or when the string is empty, false otherwise.
It stores the "string"'s value in "value" and returns whether or not all went well.
[in] | string | The string whose content should be interpreted as an integer number |
[out] | value | The uint8_t variable that should be overwritten by the integer number found in "string" |
[in] | base | The numerical base of the integer in the string, default being 10 |
Definition at line 149 of file parsing_utilities.cpp.
References string_utilities::toUInt32().
Referenced by GpgsaParser::parseASCII(), and GpgsvParser::parseASCII().