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-2017, 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/utils/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::utils::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
A generic interface for a wide-variety of sensors designed to be used in the application RawLogGrabbe...
void initialize()
Set up the NTRIP communications, raising an exception on fatal errors.
mrpt::utils::CTicTac m_rate_timer
Definition: CNTRIPEmitter.h:84
FILE * outfile
Definition: mrpt_jpeglib.h:908
A communications serial port built as an implementation of a utils::CStream.
Definition: CSerialPort.h:47
void setOutputSerialPort(const std::string &port)
Changes the serial port to connect to (call prior to &#39;doProcess&#39;), for example "COM1" or "ttyS0"...
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
CNTRIPClient m_client
The NTRIP comms object.
Definition: CNTRIPEmitter.h:72
A client for NTRIP (HTTP) sources of differential GPS corrections from internet servers, or Global navigation satellite system (GNSS) internet radio.
Definition: CNTRIPClient.h:40
This class allows loading and storing values and vectors of different types from a configuration text...
This class implements a high-performance stopwatch.
Definition: CTicTac.h:23
GLsizei const GLchar ** string
Definition: glext.h:4101
void loadConfig_sensorSpecific(const mrpt::utils::CConfigFileBase &configSource, const std::string &iniSection)
See the class documentation at the top for expected parameters.
#define DEFINE_GENERIC_SENSOR(class_name)
This declaration must be inserted in all CGenericSensor classes definition, within the class declarat...
CNTRIPClient::NTRIPArgs m_ntrip_args
Definition: CNTRIPEmitter.h:69
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
std::ofstream m_raw_output_file_stream
Definition: CNTRIPEmitter.h:83
void doProcess()
The main loop, which must be called in a timely fashion in order to process the incomming NTRIP data ...
std::string getRawOutputFilePrefix() const
virtual ~CNTRIPEmitter()
Destructor.
std::string getOutputSerialPort() const
mrpt::comms::CSerialPort m_out_COM
The output serial port.
Definition: CNTRIPEmitter.h:74
void setRawOutputFilePrefix(const std::string &outfile)
This "virtual driver" encapsulates a NTRIP client (see CNTRIPClient) but adds the functionality of du...
Definition: CNTRIPEmitter.h:64
The arguments for connecting to a NTRIP stream, used in CNTRIPClient::open.
Definition: CNTRIPClient.h:93
CNTRIPClient & getNTRIPClient()
Exposes the NTRIP client object.
const CNTRIPClient & getNTRIPClient() const
Exposes the NTRIP client object.



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019