Main MRPT website > C++ reference for MRPT 1.9.9
CNTRIPEmitter.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2018, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 #ifndef CNTRIPEmitter_H
10 #define CNTRIPEmitter_H
11 
13 #include <mrpt/comms/CSerialPort.h>
15 #include <mrpt/system/CTicTac.h>
16 #include <fstream>
17 
18 namespace mrpt
19 {
20 namespace hwdrivers
21 {
22 /** This "virtual driver" encapsulates a NTRIP client (see CNTRIPClient) but
23  * adds the functionality of dumping the received datastream to a given serial
24  * port.
25  * Used within rawlog-grabber, along CGPSInterface, this class allows to build
26  * a powerful & simple RTK-capable GPS receiver system.
27  *
28  * Therefore, this sensor will never "collect" any observation via the
29  * CGenericSensor interface.
30  *
31  * See also the example configuration file for rawlog-grabber in
32  * "share/mrpt/config_files/rawlog-grabber".
33  *
34  * \code
35  * PARAMETERS IN THE ".INI"-LIKE CONFIGURATION STRINGS:
36  * -------------------------------------------------------
37  * [supplied_section_name]
38  * COM_port_WIN = COM1 // Serial port where the NTRIP stream will be
39  * dumped to.
40  * COM_port_LIN = ttyUSB0
41  * baudRate = 38400
42  * #transmit_to_server = true // (Default:true) Whether to send back to the
43  * TCP/IP caster all data received from the output serial port
44  * #raw_output_file_prefix = raw_ntrip_data // If provided, save raw data
45  * from the NTRIP to a file, useful for post-processing. In this case, not
46  * having a serial port configured (commented out) is a valid configuration.
47  *
48  * server = 143.123.9.129 // NTRIP caster IP
49  * port = 2101
50  * mountpoint = MYPOINT23
51  * //user = pepe // User & password optional.
52  * //password = loco
53  *
54  * \endcode
55  *
56  * The next picture summarizes existing MRPT classes related to GPS / GNSS
57  * devices (CGPSInterface, CNTRIPEmitter, CGPS_NTRIP):
58  *
59  * <div align=center> <img src="mrpt_gps_classes_usage.png"> </div>
60  *
61  * \ingroup mrpt_hwdrivers_grp
62  * \sa CGPSInterface, CGPS_NTRIP, CNTRIPClient
63  */
65 {
67 
68  private:
70 
71  /** The NTRIP comms object. */
73  /** The output serial port. */
75 
76  /** If set to non-empty, the serial port will be attempted to be opened
77  * automatically when this class is first used to request data from the
78  * laser. */
83  std::ofstream m_raw_output_file_stream;
85  size_t m_rate_count;
86 
87  protected:
88  /** See the class documentation at the top for expected parameters */
90  const mrpt::config::CConfigFileBase& configSource,
91  const std::string& iniSection);
92 
93  public:
94  /** Constructor */
95  CNTRIPEmitter();
96 
97  /** Destructor */
98  virtual ~CNTRIPEmitter();
99 
100  /** Changes the serial port to connect to (call prior to 'doProcess'), for
101  * example "COM1" or "ttyS0".
102  * This is not needed if the configuration is loaded with "loadConfig".
103  */
104  void setOutputSerialPort(const std::string& port) { m_com_port = port; }
107  {
109  }
111  {
113  }
114 
115  /** Set up the NTRIP communications, raising an exception on fatal errors.
116  * Called automatically by rawlog-grabber.
117  * If used manually, call after "loadConfig" and before "doProcess".
118  */
119  void initialize();
120 
121  /** The main loop, which must be called in a timely fashion in order to
122  * process the incomming NTRIP data stream and dump it to the serial port.
123  * This method is called automatically when used within rawlog-grabber.
124  */
125  void doProcess();
126 
127  /** Exposes the NTRIP client object */
129  /** Exposes the NTRIP client object */
130  const CNTRIPClient& getNTRIPClient() const { return m_client; }
131 }; // End of class
132 
133 } // End of namespace
134 } // End of namespace
135 
136 #endif
outfile
FILE * outfile
Definition: mrpt_jpeglib.h:908
mrpt::hwdrivers::CNTRIPEmitter
This "virtual driver" encapsulates a NTRIP client (see CNTRIPClient) but adds the functionality of du...
Definition: CNTRIPEmitter.h:64
mrpt::hwdrivers::CNTRIPEmitter::getNTRIPClient
CNTRIPClient & getNTRIPClient()
Exposes the NTRIP client object.
Definition: CNTRIPEmitter.h:128
mrpt::hwdrivers::CNTRIPClient
A client for NTRIP (HTTP) sources of differential GPS corrections from internet servers,...
Definition: CNTRIPClient.h:39
mrpt::hwdrivers::CNTRIPEmitter::m_raw_output_file_prefix
std::string m_raw_output_file_prefix
Definition: CNTRIPEmitter.h:82
mrpt::system::CTicTac
A high-performance stopwatch, with typical resolution of nanoseconds.
Definition: system/CTicTac.h:19
CSerialPort.h
mrpt::comms::CSerialPort
A communications serial port built as an implementation of a utils::CStream.
Definition: CSerialPort.h:43
mrpt::hwdrivers::CNTRIPEmitter::m_com_bauds
int m_com_bauds
Definition: CNTRIPEmitter.h:80
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CKalmanFilterCapable.h:30
mrpt::hwdrivers::CNTRIPEmitter::loadConfig_sensorSpecific
void loadConfig_sensorSpecific(const mrpt::config::CConfigFileBase &configSource, const std::string &iniSection)
See the class documentation at the top for expected parameters.
Definition: CNTRIPEmitter.cpp:159
DEFINE_GENERIC_SENSOR
#define DEFINE_GENERIC_SENSOR(class_name)
This declaration must be inserted in all CGenericSensor classes definition, within the class declarat...
Definition: CGenericSensor.h:314
mrpt::hwdrivers::CNTRIPEmitter::m_client
CNTRIPClient m_client
The NTRIP comms object.
Definition: CNTRIPEmitter.h:72
mrpt::hwdrivers::CNTRIPClient::NTRIPArgs
The arguments for connecting to a NTRIP stream, used in CNTRIPClient::open.
Definition: CNTRIPClient.h:92
CNTRIPClient.h
mrpt::hwdrivers::CNTRIPEmitter::m_rate_count
size_t m_rate_count
Definition: CNTRIPEmitter.h:85
mrpt::hwdrivers::CNTRIPEmitter::m_ntrip_args
CNTRIPClient::NTRIPArgs m_ntrip_args
Definition: CNTRIPEmitter.h:69
mrpt::config::CConfigFileBase
This class allows loading and storing values and vectors of different types from a configuration text...
Definition: config/CConfigFileBase.h:44
mrpt::hwdrivers::CNTRIPEmitter::m_raw_output_file_stream
std::ofstream m_raw_output_file_stream
Definition: CNTRIPEmitter.h:83
mrpt::hwdrivers::CNTRIPEmitter::getOutputSerialPort
std::string getOutputSerialPort() const
Definition: CNTRIPEmitter.h:105
mrpt::hwdrivers::CNTRIPEmitter::getRawOutputFilePrefix
std::string getRawOutputFilePrefix() const
Definition: CNTRIPEmitter.h:110
CGenericSensor.h
mrpt::hwdrivers::CNTRIPEmitter::m_out_COM
mrpt::comms::CSerialPort m_out_COM
The output serial port.
Definition: CNTRIPEmitter.h:74
mrpt::hwdrivers::CGenericSensor
A generic interface for a wide-variety of sensors designed to be used in the application RawLogGrabbe...
Definition: CGenericSensor.h:70
mrpt::hwdrivers::CNTRIPEmitter::m_rate_timer
mrpt::system::CTicTac m_rate_timer
Definition: CNTRIPEmitter.h:84
mrpt::hwdrivers::CNTRIPEmitter::setRawOutputFilePrefix
void setRawOutputFilePrefix(const std::string &outfile)
Definition: CNTRIPEmitter.h:106
mrpt::hwdrivers::CNTRIPEmitter::CNTRIPEmitter
CNTRIPEmitter()
Constructor
Definition: CNTRIPEmitter.cpp:28
CTicTac.h
mrpt::hwdrivers::CNTRIPEmitter::getNTRIPClient
const CNTRIPClient & getNTRIPClient() const
Exposes the NTRIP client object.
Definition: CNTRIPEmitter.h:130
mrpt::hwdrivers::CNTRIPEmitter::initialize
void initialize()
Set up the NTRIP communications, raising an exception on fatal errors.
Definition: CNTRIPEmitter.cpp:118
string
GLsizei const GLchar ** string
Definition: glext.h:4101
mrpt::hwdrivers::CNTRIPEmitter::doProcess
void doProcess()
The main loop, which must be called in a timely fashion in order to process the incomming NTRIP data ...
Definition: CNTRIPEmitter.cpp:50
mrpt::hwdrivers::CNTRIPEmitter::~CNTRIPEmitter
virtual ~CNTRIPEmitter()
Destructor
Definition: CNTRIPEmitter.cpp:40
mrpt::hwdrivers::CNTRIPEmitter::m_com_port
std::string m_com_port
If set to non-empty, the serial port will be attempted to be opened automatically when this class is ...
Definition: CNTRIPEmitter.h:79
mrpt::hwdrivers::CNTRIPEmitter::m_transmit_to_server
bool m_transmit_to_server
Definition: CNTRIPEmitter.h:81
mrpt::hwdrivers::CNTRIPEmitter::setOutputSerialPort
void setOutputSerialPort(const std::string &port)
Changes the serial port to connect to (call prior to 'doProcess'), for example "COM1" or "ttyS0".
Definition: CNTRIPEmitter.h:104



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST