ROSaic
Data Structures | Namespaces | Macros | Enumerations | Functions | Variables
rx_message.hpp File Reference

Defines a class that reads messages handed over from the circular buffer. More...

#include <cstddef>
#include <sstream>
#include <map>
#include <cassert>
#include <boost/tokenizer.hpp>
#include <boost/call_traits.hpp>
#include <boost/format.hpp>
#include <boost/math/constants/constants.hpp>
#include <sensor_msgs/NavSatFix.h>
#include <sensor_msgs/TimeReference.h>
#include <geometry_msgs/PoseWithCovarianceStamped.h>
#include <diagnostic_msgs/DiagnosticArray.h>
#include <diagnostic_msgs/DiagnosticStatus.h>
#include <gps_common/GPSFix.h>
#include <rosaic/parsers/nmea_parsers/gpgga.hpp>
#include <rosaic/parsers/nmea_parsers/gprmc.hpp>
#include <rosaic/parsers/nmea_parsers/gpgsa.hpp>
#include <rosaic/parsers/nmea_parsers/gpgsv.hpp>
#include <rosaic/crc/crc.h>
#include <rosaic/parsers/string_utilities.h>
#include <rosaic/PVTCartesian.h>
#include <rosaic/PVTGeodetic.h>
#include <rosaic/PosCovCartesian.h>
#include <rosaic/PosCovGeodetic.h>
#include <rosaic/AttEuler.h>
#include <rosaic/AttCovEuler.h>
Include dependency graph for rx_message.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

class  io_comm_rx::RxMessage
 Can search buffer for messages, read/parse them, and so on. More...
 

Namespaces

 io_comm_rx
 

Macros

#define SBF_SYNC_BYTE_1   0x24
 0x24 is ASCII for $ - 1st byte in each message More...
 
#define SBF_SYNC_BYTE_2   0x40
 0x40 is ASCII for @ - 2nd byte to indicate SBF block More...
 
#define NMEA_SYNC_BYTE_1   0x24
 0x24 is ASCII for $ - 1st byte in each message More...
 
#define NMEA_SYNC_BYTE_2_1   0x47
 0x47 is ASCII for G - 2nd byte to indicate NMEA-type ASCII message More...
 
#define NMEA_SYNC_BYTE_2_2   0x50
 0x50 is ASCII for P - 2nd byte to indicate proprietary ASCII message More...
 
#define RESPONSE_SYNC_BYTE_1   0x24
 0x24 is ASCII for $ - 1st byte in each response from the Rx More...
 
#define RESPONSE_SYNC_BYTE_2   0x52
 0x52 is ASCII for R (for "Response") - 2nd byte in each response from the Rx More...
 
#define CARRIAGE_RETURN   0x0D
 0x0D is ASCII for "Carriage Return", i.e. "Enter" More...
 
#define LINE_FEED   0x0A
 0x0A is ASCII for "Line Feed", i.e. "New Line" More...
 
#define RESPONSE_SYNC_BYTE_3   0x3F
 0x3F is ASCII for ? - 3rd byte in the response message from the Rx in case the command was invalid More...
 
#define CONNECTION_DESCRIPTOR_BYTE_1   0x49
 0x49 is ASCII for I - 1st character of connection descriptor sent by the Rx after initiating TCP connection More...
 
#define CONNECTION_DESCRIPTOR_BYTE_2   0x50
 0x50 is ASCII for P - 2nd character of connection descriptor sent by the Rx after initiating TCP connection More...
 
#define RX_MESSAGE_HPP
 

Enumerations

enum  TypeOfPVT_Enum {
  evNoPVT, evStandAlone, evDGPS, evFixed,
  evRTKFixed, evRTKFloat, evSBAS, evMovingBaseRTKFixed,
  evMovingBaseRTKFloat, evPPP
}
 Enum for NavSatFix's status.status field, which is obtained from PVTGeodetic's Mode field. More...
 
enum  RxID_Enum {
  evNavSatFix, evGPSFix, evPoseWithCovarianceStamped, evGPGGA,
  evGPRMC, evGPGSA, evGPGSV, evGLGSV,
  evGAGSV, evPVTCartesian, evPVTGeodetic, evPosCovCartesian,
  evPosCovGeodetic, evAttEuler, evAttCovEuler, evGPST,
  evChannelStatus, evMeasEpoch, evDOP, evVelCovGeodetic,
  evDiagnosticArray, evReceiverStatus, evQualityInd, evReceiverSetup
}
 

Functions

ros::Time io_comm_rx::timestampSBF (uint32_t tow, bool use_gnss)
 Calculates the timestamp, in the Unix Epoch time format This is either done using the TOW as transmitted with the SBF block (if "use_gnss" is true), or using the current time. More...
 

Variables

bool g_use_gnss_time
 
bool g_read_cd
 
uint32_t g_cd_count
 Since after SSSSSSSSSSS we need to wait for second connection descriptor, we have to count the connection descriptors. More...
 
uint32_t g_leap_seconds
 The number of leap seconds that have been inserted into the UTC time. More...
 
bool g_channelstatus_has_arrived_gpsfix
 For GPSFix: Whether the ChannelStatus block of the current epoch has arrived or not. More...
 
bool g_measepoch_has_arrived_gpsfix
 For GPSFix: Whether the MeasEpoch block of the current epoch has arrived or not. More...
 
bool g_dop_has_arrived_gpsfix
 For GPSFix: Whether the DOP block of the current epoch has arrived or not. More...
 
bool g_pvtgeodetic_has_arrived_gpsfix
 For GPSFix: Whether the PVTGeodetic block of the current epoch has arrived or not. More...
 
bool g_pvtgeodetic_has_arrived_navsatfix
 For NavSatFix: Whether the PVTGeodetic block of the current epoch has arrived or not. More...
 
bool g_pvtgeodetic_has_arrived_pose
 For PoseWithCovarianceStamped: Whether the PVTGeodetic block of the current epoch has arrived or not. More...
 
bool g_poscovgeodetic_has_arrived_gpsfix
 For GPSFix: Whether the PosCovGeodetic block of the current epoch has arrived or not. More...
 
bool g_poscovgeodetic_has_arrived_navsatfix
 For NavSatFix: Whether the PosCovGeodetic block of the current epoch has arrived or not. More...
 
bool g_poscovgeodetic_has_arrived_pose
 For PoseWithCovarianceStamped: Whether the PosCovGeodetic block of the current epoch has arrived or not. More...
 
bool g_velcovgeodetic_has_arrived_gpsfix
 For GPSFix: Whether the VelCovGeodetic block of the current epoch has arrived or not. More...
 
bool g_atteuler_has_arrived_gpsfix
 For GPSFix: Whether the AttEuler block of the current epoch has arrived or not. More...
 
bool g_atteuler_has_arrived_pose
 For PoseWithCovarianceStamped: Whether the AttEuler block of the current epoch has arrived or not. More...
 
bool g_attcoveuler_has_arrived_gpsfix
 For GPSFix: Whether the AttCovEuler block of the current epoch has arrived or not. More...
 
bool g_attcoveuler_has_arrived_pose
 For PoseWithCovarianceStamped: Whether the AttCovEuler block of the current epoch has arrived or not. More...
 
bool g_receiverstatus_has_arrived_diagnostics
 For DiagnosticArray: Whether the ReceiverStatus block of the current epoch has arrived or not. More...
 
bool g_qualityind_has_arrived_diagnostics
 For DiagnosticArray: Whether the QualityInd block of the current epoch has arrived or not. More...
 
boost::shared_ptr< ros::NodeHandle > g_nh
 
const uint32_t g_ROS_QUEUE_SIZE
 Queue size for ROS publishers. More...
 

Detailed Description

Defines a class that reads messages handed over from the circular buffer.

Date
20/08/20

Definition in file rx_message.hpp.

Macro Definition Documentation

◆ CARRIAGE_RETURN

#define CARRIAGE_RETURN   0x0D

0x0D is ASCII for "Carriage Return", i.e. "Enter"

Definition at line 89 of file rx_message.hpp.

Referenced by io_comm_rx::RxMessage::messageSize().

◆ CONNECTION_DESCRIPTOR_BYTE_1

#define CONNECTION_DESCRIPTOR_BYTE_1   0x49

0x49 is ASCII for I - 1st character of connection descriptor sent by the Rx after initiating TCP connection

Definition at line 101 of file rx_message.hpp.

Referenced by io_comm_rx::RxMessage::isConnectionDescriptor().

◆ CONNECTION_DESCRIPTOR_BYTE_2

#define CONNECTION_DESCRIPTOR_BYTE_2   0x50

0x50 is ASCII for P - 2nd character of connection descriptor sent by the Rx after initiating TCP connection

Definition at line 105 of file rx_message.hpp.

Referenced by io_comm_rx::RxMessage::isConnectionDescriptor().

◆ LINE_FEED

#define LINE_FEED   0x0A

0x0A is ASCII for "Line Feed", i.e. "New Line"

Definition at line 93 of file rx_message.hpp.

Referenced by io_comm_rx::RxMessage::messageSize().

◆ NMEA_SYNC_BYTE_1

#define NMEA_SYNC_BYTE_1   0x24

0x24 is ASCII for $ - 1st byte in each message

Definition at line 69 of file rx_message.hpp.

Referenced by io_comm_rx::RxMessage::isNMEA().

◆ NMEA_SYNC_BYTE_2_1

#define NMEA_SYNC_BYTE_2_1   0x47

0x47 is ASCII for G - 2nd byte to indicate NMEA-type ASCII message

Definition at line 73 of file rx_message.hpp.

Referenced by io_comm_rx::RxMessage::isNMEA().

◆ NMEA_SYNC_BYTE_2_2

#define NMEA_SYNC_BYTE_2_2   0x50

0x50 is ASCII for P - 2nd byte to indicate proprietary ASCII message

Definition at line 77 of file rx_message.hpp.

Referenced by io_comm_rx::RxMessage::isNMEA().

◆ RESPONSE_SYNC_BYTE_1

#define RESPONSE_SYNC_BYTE_1   0x24

0x24 is ASCII for $ - 1st byte in each response from the Rx

Definition at line 81 of file rx_message.hpp.

Referenced by io_comm_rx::RxMessage::isErrorMessage(), and io_comm_rx::RxMessage::isResponse().

◆ RESPONSE_SYNC_BYTE_2

#define RESPONSE_SYNC_BYTE_2   0x52

0x52 is ASCII for R (for "Response") - 2nd byte in each response from the Rx

Definition at line 85 of file rx_message.hpp.

Referenced by io_comm_rx::RxMessage::isErrorMessage(), and io_comm_rx::RxMessage::isResponse().

◆ RESPONSE_SYNC_BYTE_3

#define RESPONSE_SYNC_BYTE_3   0x3F

0x3F is ASCII for ? - 3rd byte in the response message from the Rx in case the command was invalid

Definition at line 97 of file rx_message.hpp.

Referenced by io_comm_rx::RxMessage::isErrorMessage().

◆ RX_MESSAGE_HPP

#define RX_MESSAGE_HPP

Definition at line 141 of file rx_message.hpp.

◆ SBF_SYNC_BYTE_1

#define SBF_SYNC_BYTE_1   0x24

0x24 is ASCII for $ - 1st byte in each message

Definition at line 61 of file rx_message.hpp.

Referenced by io_comm_rx::RxMessage::isSBF().

◆ SBF_SYNC_BYTE_2

#define SBF_SYNC_BYTE_2   0x40

0x40 is ASCII for @ - 2nd byte to indicate SBF block

Definition at line 65 of file rx_message.hpp.

Referenced by io_comm_rx::RxMessage::isSBF().

Enumeration Type Documentation

◆ RxID_Enum

enum RxID_Enum

Since switch only works with int (yet NMEA message IDs are strings), we need enum. Note drawbacks: No variable can have a name which is already in some enumeration, enums are not type safe etc..

Enumerator
evNavSatFix 
evGPSFix 
evPoseWithCovarianceStamped 
evGPGGA 
evGPRMC 
evGPGSA 
evGPGSV 
evGLGSV 
evGAGSV 
evPVTCartesian 
evPVTGeodetic 
evPosCovCartesian 
evPosCovGeodetic 
evAttEuler 
evAttCovEuler 
evGPST 
evChannelStatus 
evMeasEpoch 
evDOP 
evVelCovGeodetic 
evDiagnosticArray 
evReceiverStatus 
evQualityInd 
evReceiverSetup 

Definition at line 178 of file rx_message.hpp.

◆ TypeOfPVT_Enum

Enum for NavSatFix's status.status field, which is obtained from PVTGeodetic's Mode field.

Enumerator
evNoPVT 
evStandAlone 
evDGPS 
evFixed 
evRTKFixed 
evRTKFloat 
evSBAS 
evMovingBaseRTKFixed 
evMovingBaseRTKFloat 
evPPP 

Definition at line 173 of file rx_message.hpp.

Variable Documentation

◆ g_attcoveuler_has_arrived_gpsfix

bool g_attcoveuler_has_arrived_gpsfix

For GPSFix: Whether the AttCovEuler block of the current epoch has arrived or not.

Definition at line 714 of file rosaic_node.cpp.

Referenced by main(), io_comm_rx::RxMessage::read(), and io_comm_rx::CallbackHandlers::readCallback().

◆ g_attcoveuler_has_arrived_pose

bool g_attcoveuler_has_arrived_pose

For PoseWithCovarianceStamped: Whether the AttCovEuler block of the current epoch has arrived or not.

Definition at line 726 of file rosaic_node.cpp.

Referenced by main(), io_comm_rx::RxMessage::read(), and io_comm_rx::CallbackHandlers::readCallback().

◆ g_atteuler_has_arrived_gpsfix

bool g_atteuler_has_arrived_gpsfix

For GPSFix: Whether the AttEuler block of the current epoch has arrived or not.

Definition at line 712 of file rosaic_node.cpp.

Referenced by main(), io_comm_rx::RxMessage::read(), and io_comm_rx::CallbackHandlers::readCallback().

◆ g_atteuler_has_arrived_pose

bool g_atteuler_has_arrived_pose

For PoseWithCovarianceStamped: Whether the AttEuler block of the current epoch has arrived or not.

Definition at line 724 of file rosaic_node.cpp.

Referenced by main(), io_comm_rx::RxMessage::read(), and io_comm_rx::CallbackHandlers::readCallback().

◆ g_cd_count

uint32_t g_cd_count

Since after SSSSSSSSSSS we need to wait for second connection descriptor, we have to count the connection descriptors.

Definition at line 698 of file rosaic_node.cpp.

Referenced by main(), io_comm_rx::RxMessage::next(), and io_comm_rx::CallbackHandlers::readCallback().

◆ g_channelstatus_has_arrived_gpsfix

bool g_channelstatus_has_arrived_gpsfix

For GPSFix: Whether the ChannelStatus block of the current epoch has arrived or not.

Definition at line 700 of file rosaic_node.cpp.

Referenced by main(), io_comm_rx::RxMessage::read(), and io_comm_rx::CallbackHandlers::readCallback().

◆ g_dop_has_arrived_gpsfix

bool g_dop_has_arrived_gpsfix

For GPSFix: Whether the DOP block of the current epoch has arrived or not.

Definition at line 704 of file rosaic_node.cpp.

Referenced by main(), io_comm_rx::RxMessage::read(), and io_comm_rx::CallbackHandlers::readCallback().

◆ g_leap_seconds

uint32_t g_leap_seconds

The number of leap seconds that have been inserted into the UTC time.

Definition at line 679 of file rosaic_node.cpp.

Referenced by main(), and io_comm_rx::timestampSBF().

◆ g_measepoch_has_arrived_gpsfix

bool g_measepoch_has_arrived_gpsfix

For GPSFix: Whether the MeasEpoch block of the current epoch has arrived or not.

Definition at line 702 of file rosaic_node.cpp.

Referenced by main(), io_comm_rx::RxMessage::read(), and io_comm_rx::CallbackHandlers::readCallback().

◆ g_nh

boost::shared_ptr<ros::NodeHandle> g_nh

Node Handle for the ROSaic node You must initialize the NodeHandle in the "main" function (or in any method called indirectly or directly by the main function). One can declare a pointer to the NodeHandle to be a global variable and then initialize it afterwards only...

Definition at line 743 of file rosaic_node.cpp.

Referenced by io_comm_rx::RxMessage::read().

◆ g_poscovgeodetic_has_arrived_gpsfix

bool g_poscovgeodetic_has_arrived_gpsfix

For GPSFix: Whether the PosCovGeodetic block of the current epoch has arrived or not.

Definition at line 708 of file rosaic_node.cpp.

Referenced by main(), io_comm_rx::RxMessage::read(), and io_comm_rx::CallbackHandlers::readCallback().

◆ g_poscovgeodetic_has_arrived_navsatfix

bool g_poscovgeodetic_has_arrived_navsatfix

For NavSatFix: Whether the PosCovGeodetic block of the current epoch has arrived or not.

Definition at line 718 of file rosaic_node.cpp.

Referenced by main(), io_comm_rx::RxMessage::read(), and io_comm_rx::CallbackHandlers::readCallback().

◆ g_poscovgeodetic_has_arrived_pose

bool g_poscovgeodetic_has_arrived_pose

For PoseWithCovarianceStamped: Whether the PosCovGeodetic block of the current epoch has arrived or not.

Definition at line 722 of file rosaic_node.cpp.

Referenced by main(), io_comm_rx::RxMessage::read(), and io_comm_rx::CallbackHandlers::readCallback().

◆ g_pvtgeodetic_has_arrived_gpsfix

bool g_pvtgeodetic_has_arrived_gpsfix

For GPSFix: Whether the PVTGeodetic block of the current epoch has arrived or not.

Definition at line 706 of file rosaic_node.cpp.

Referenced by main(), io_comm_rx::RxMessage::read(), and io_comm_rx::CallbackHandlers::readCallback().

◆ g_pvtgeodetic_has_arrived_navsatfix

bool g_pvtgeodetic_has_arrived_navsatfix

For NavSatFix: Whether the PVTGeodetic block of the current epoch has arrived or not.

Definition at line 716 of file rosaic_node.cpp.

Referenced by main(), io_comm_rx::RxMessage::read(), and io_comm_rx::CallbackHandlers::readCallback().

◆ g_pvtgeodetic_has_arrived_pose

bool g_pvtgeodetic_has_arrived_pose

For PoseWithCovarianceStamped: Whether the PVTGeodetic block of the current epoch has arrived or not.

Definition at line 720 of file rosaic_node.cpp.

Referenced by main(), io_comm_rx::RxMessage::read(), and io_comm_rx::CallbackHandlers::readCallback().

◆ g_qualityind_has_arrived_diagnostics

bool g_qualityind_has_arrived_diagnostics

For DiagnosticArray: Whether the QualityInd block of the current epoch has arrived or not.

Definition at line 730 of file rosaic_node.cpp.

Referenced by main(), io_comm_rx::RxMessage::read(), and io_comm_rx::CallbackHandlers::readCallback().

◆ g_read_cd

bool g_read_cd

Whether or not we still want to read the connection descriptor, which we only want in the very beginning to know whether it is IP10, IP11 etc.

Definition at line 694 of file rosaic_node.cpp.

Referenced by io_comm_rx::RxMessage::found(), main(), io_comm_rx::RxMessage::next(), and io_comm_rx::RxMessage::search().

◆ g_receiverstatus_has_arrived_diagnostics

bool g_receiverstatus_has_arrived_diagnostics

For DiagnosticArray: Whether the ReceiverStatus block of the current epoch has arrived or not.

Definition at line 728 of file rosaic_node.cpp.

Referenced by main(), io_comm_rx::RxMessage::read(), and io_comm_rx::CallbackHandlers::readCallback().

◆ g_ROS_QUEUE_SIZE

const uint32_t g_ROS_QUEUE_SIZE

Queue size for ROS publishers.

Definition at line 745 of file rosaic_node.cpp.

Referenced by io_comm_rx::RxMessage::read().

◆ g_use_gnss_time

bool g_use_gnss_time

If true, the ROS message headers' unix time field is constructed from the TOW (in the SBF case) and UTC (in the NMEA case) data. If false, times are constructed within the driver via time(NULL) of the <ctime> library.

Definition at line 665 of file rosaic_node.cpp.

Referenced by io_comm_rx::RxMessage::read().

◆ g_velcovgeodetic_has_arrived_gpsfix

bool g_velcovgeodetic_has_arrived_gpsfix

For GPSFix: Whether the VelCovGeodetic block of the current epoch has arrived or not.

Definition at line 710 of file rosaic_node.cpp.

Referenced by main(), io_comm_rx::RxMessage::read(), and io_comm_rx::CallbackHandlers::readCallback().