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

Defines a class that can deal with a buffer of size bytes_transferred that is handed over from async_read_some. More...

#include <cstddef>
#include <sstream>
#include <map>
#include <cmath>
#include <vector>
#include <boost/tokenizer.hpp>
#include <boost/call_traits.hpp>
#include <boost/format.hpp>
#include <boost/math/constants/constants.hpp>
#include <ros/ros.h>
#include <rosaic/Gpgga.h>
#include <rosaic/Gprmc.h>
#include <rosaic/Gpgsa.h>
#include <rosaic/Gpgsv.h>
#include <sensor_msgs/NavSatFix.h>
#include <sensor_msgs/TimeReference.h>
#include <geometry_msgs/PoseWithCovarianceStamped.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/parsers/nmea_sentence.hpp>
#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 <rosaic/packed_structs/sbf_structs.hpp>
Include dependency graph for mosaicMessage.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_mosaic::mosaicMessage
 Can search buffer for messages, read/parse them, and so on. More...
 

Namespaces

 io_comm_mosaic
 

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 mosaic More...
 
#define RESPONSE_SYNC_BYTE_2   0x52
 0x52 is ASCII for R (for "Response") - 2nd byte in each response from mosaic 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 mosaic 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 mosaic after initiating TCP connection More...
 
#define CONNECTION_DESCRIPTOR_BYTE_2   0x50
 0x50 is ASCII for P - 2nd character of connection descriptor sent by mosaic after initiating TCP connection More...
 
#define MOSAIC_MESSAGE_HPP
 

Enumerations

enum  NMEA_ID_Enum {
  evNavSatFix, evGPSFix, evPoseWithCovarianceStamped, evGPGGA,
  evGPRMC, evGPGSA, evGPGSV, evGLGSV,
  evGAGSV, evPVTCartesian, evPVTGeodetic, evPosCovCartesian,
  evPosCovGeodetic, evAttEuler, evAttCovEuler, evGPST,
  evChannelStatus, evMeasEpoch, evDOP, evVelCovGeodetic
}
 

Functions

static void StringValues_Initialize ()
 
ros::Time io_comm_mosaic::TimestampSBF (uint32_t TOW, bool use_GNSS)
 Calculates the timestamp, in the Unix Epoch time format, either using the TOW as transmitted with the SBF block, or using the current time. More...
 

Variables

bool use_GNSS_time
 
bool 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. More...
 
uint32_t cd_count
 Since after SSSSSSSSSSS we need to wait for second connection descriptor, we have to count the connection descriptors. More...
 
uint32_t leap_seconds
 The number of leap seconds that have been inserted into the UTC time. More...
 
std::vector< int32_t > svid_pvt
 
static std::map< std::string, NMEA_ID_EnumStringValues
 

Detailed Description

Defines a class that can deal with a buffer of size bytes_transferred that is handed over from async_read_some.

Date
20/08/20

Definition in file mosaicMessage.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 mosaicMessage.hpp.

Referenced by io_comm_mosaic::mosaicMessage::SegmentEnd().

◆ CONNECTION_DESCRIPTOR_BYTE_1

#define CONNECTION_DESCRIPTOR_BYTE_1   0x49

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

Definition at line 101 of file mosaicMessage.hpp.

Referenced by io_comm_mosaic::mosaicMessage::IsConnectionDescriptor().

◆ CONNECTION_DESCRIPTOR_BYTE_2

#define CONNECTION_DESCRIPTOR_BYTE_2   0x50

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

Definition at line 105 of file mosaicMessage.hpp.

Referenced by io_comm_mosaic::mosaicMessage::IsConnectionDescriptor().

◆ LINE_FEED

#define LINE_FEED   0x0A

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

Definition at line 93 of file mosaicMessage.hpp.

Referenced by io_comm_mosaic::mosaicMessage::SegmentEnd().

◆ MOSAIC_MESSAGE_HPP

#define MOSAIC_MESSAGE_HPP

Definition at line 148 of file mosaicMessage.hpp.

◆ 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 mosaicMessage.hpp.

Referenced by io_comm_mosaic::mosaicMessage::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 mosaicMessage.hpp.

Referenced by io_comm_mosaic::mosaicMessage::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 mosaicMessage.hpp.

Referenced by io_comm_mosaic::mosaicMessage::IsNMEA().

◆ RESPONSE_SYNC_BYTE_1

#define RESPONSE_SYNC_BYTE_1   0x24

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

Definition at line 81 of file mosaicMessage.hpp.

Referenced by io_comm_mosaic::mosaicMessage::IsErrorMessage(), and io_comm_mosaic::mosaicMessage::IsResponse().

◆ RESPONSE_SYNC_BYTE_2

#define RESPONSE_SYNC_BYTE_2   0x52

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

Definition at line 85 of file mosaicMessage.hpp.

Referenced by io_comm_mosaic::mosaicMessage::IsErrorMessage(), and io_comm_mosaic::mosaicMessage::IsResponse().

◆ RESPONSE_SYNC_BYTE_3

#define RESPONSE_SYNC_BYTE_3   0x3F

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

Definition at line 97 of file mosaicMessage.hpp.

Referenced by io_comm_mosaic::mosaicMessage::IsErrorMessage().

◆ 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 mosaicMessage.hpp.

Referenced by io_comm_mosaic::mosaicMessage::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 mosaicMessage.hpp.

Referenced by io_comm_mosaic::mosaicMessage::IsSBF().

Enumeration Type Documentation

◆ NMEA_ID_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 

Definition at line 163 of file mosaicMessage.hpp.

Function Documentation

◆ StringValues_Initialize()

static void StringValues_Initialize ( )
static

Definition at line 167 of file mosaicMessage.hpp.

References evAttCovEuler, evAttEuler, evChannelStatus, evDOP, evGAGSV, evGLGSV, evGPGGA, evGPGSA, evGPGSV, evGPRMC, evGPSFix, evGPST, evMeasEpoch, evNavSatFix, evPosCovCartesian, evPosCovGeodetic, evPoseWithCovarianceStamped, evPVTCartesian, evPVTGeodetic, evVelCovGeodetic, and io_comm_mosaic::TimestampSBF().

Referenced by rosaic_node::ROSaicNode::ROSaicNode().

168 {
169  StringValues.insert(std::make_pair("NavSatFix", evNavSatFix));
170  StringValues.insert(std::make_pair("GPSFix", evGPSFix));
171  StringValues.insert(std::make_pair("PoseWithCovarianceStamped", evPoseWithCovarianceStamped));
172  StringValues.insert(std::make_pair("$GPGGA", evGPGGA));
173  StringValues.insert(std::make_pair("$GPRMC", evGPRMC));
174  StringValues.insert(std::make_pair("$GPGSA", evGPGSA));
175  StringValues.insert(std::make_pair("$GPGSV", evGPGSV));
176  StringValues.insert(std::make_pair("$GLGSV", evGLGSV));
177  StringValues.insert(std::make_pair("$GAGSV", evGAGSV));
178  StringValues.insert(std::make_pair("4006", evPVTCartesian));
179  StringValues.insert(std::make_pair("4007", evPVTGeodetic));
180  StringValues.insert(std::make_pair("5905", evPosCovCartesian));
181  StringValues.insert(std::make_pair("5906", evPosCovGeodetic));
182  StringValues.insert(std::make_pair("5938", evAttEuler));
183  StringValues.insert(std::make_pair("5939", evAttCovEuler));
184  StringValues.insert(std::make_pair("GPST", evGPST));
185  StringValues.insert(std::make_pair("4013", evChannelStatus));
186  StringValues.insert(std::make_pair("4027", evMeasEpoch));
187  StringValues.insert(std::make_pair("4001", evDOP));
188  StringValues.insert(std::make_pair("5908", evVelCovGeodetic));
189 }
static std::map< std::string, NMEA_ID_Enum > StringValues
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ cd_count

uint32_t cd_count

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

Definition at line 640 of file rosaic_node.cpp.

Referenced by main(), and io_comm_mosaic::mosaicMessage::Next().

◆ leap_seconds

uint32_t leap_seconds

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

Definition at line 619 of file rosaic_node.cpp.

Referenced by main(), and io_comm_mosaic::TimestampSBF().

◆ read_cd

bool 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 636 of file rosaic_node.cpp.

Referenced by io_comm_mosaic::mosaicMessage::Found(), main(), io_comm_mosaic::mosaicMessage::Next(), and io_comm_mosaic::mosaicMessage::Search().

◆ StringValues

std::map<std::string, NMEA_ID_Enum> StringValues
static

Static keyword makes them visible only to the code of this particular .cpp file (and those that import it), which helps to avoid global namespace pollution. One also receives "multiple definition of 'StringValues'" error without the static keyword.

Definition at line 166 of file mosaicMessage.hpp.

◆ svid_pvt

std::vector<int32_t> svid_pvt

◆ use_GNSS_time

bool 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 607 of file rosaic_node.cpp.

Referenced by io_comm_mosaic::mosaicMessage::Read().