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::hwdrivers
19 {
20 /** This "virtual driver" encapsulates a NTRIP client (see CNTRIPClient) but
21  * adds the functionality of dumping the received datastream to a given serial
22  * port.
23  * Used within rawlog-grabber, along CGPSInterface, this class allows to build
24  * a powerful & simple RTK-capable GPS receiver system.
25  *
26  * Therefore, this sensor will never "collect" any observation via the
27  * CGenericSensor interface.
28  *
29  * See also the example configuration file for rawlog-grabber in
30  * "share/mrpt/config_files/rawlog-grabber".
31  *
32  * \code
33  * PARAMETERS IN THE ".INI"-LIKE CONFIGURATION STRINGS:
34  * -------------------------------------------------------
35  * [supplied_section_name]
36  * COM_port_WIN = COM1 // Serial port where the NTRIP stream will be
37  * dumped to.
38  * COM_port_LIN = ttyUSB0
39  * baudRate = 38400
40  * #transmit_to_server = true // (Default:true) Whether to send back to the
41  * TCP/IP caster all data received from the output serial port
42  * #raw_output_file_prefix = raw_ntrip_data // If provided, save raw data
43  * from the NTRIP to a file, useful for post-processing. In this case, not
44  * having a serial port configured (commented out) is a valid configuration.
45  *
46  * server = 143.123.9.129 // NTRIP caster IP
47  * port = 2101
48  * mountpoint = MYPOINT23
49  * //user = pepe // User & password optional.
50  * //password = loco
51  *
52  * \endcode
53  *
54  * The next picture summarizes existing MRPT classes related to GPS / GNSS
55  * devices (CGPSInterface, CNTRIPEmitter, CGPS_NTRIP):
56  *
57  * <div align=center> <img src="mrpt_gps_classes_usage.png"> </div>
58  *
59  * \ingroup mrpt_hwdrivers_grp
60  * \sa CGPSInterface, CGPS_NTRIP, CNTRIPClient
61  */
63 {
65 
66  private:
68 
69  /** The NTRIP comms object. */
71  /** The output serial port. */
73 
74  /** If set to non-empty, the serial port will be attempted to be opened
75  * automatically when this class is first used to request data from the
76  * laser. */
81  std::ofstream m_raw_output_file_stream;
83  size_t m_rate_count;
84 
85  protected:
86  /** See the class documentation at the top for expected parameters */
88  const mrpt::config::CConfigFileBase& configSource,
89  const std::string& iniSection);
90 
91  public:
92  /** Constructor */
93  CNTRIPEmitter();
94 
95  /** Destructor */
96  virtual ~CNTRIPEmitter();
97 
98  /** Changes the serial port to connect to (call prior to 'doProcess'), for
99  * example "COM1" or "ttyS0".
100  * This is not needed if the configuration is loaded with "loadConfig".
101  */
102  void setOutputSerialPort(const std::string& port) { m_com_port = port; }
105  {
107  }
109  {
111  }
112 
113  /** Set up the NTRIP communications, raising an exception on fatal errors.
114  * Called automatically by rawlog-grabber.
115  * If used manually, call after "loadConfig" and before "doProcess".
116  */
117  void initialize();
118 
119  /** The main loop, which must be called in a timely fashion in order to
120  * process the incomming NTRIP data stream and dump it to the serial port.
121  * This method is called automatically when used within rawlog-grabber.
122  */
123  void doProcess();
124 
125  /** Exposes the NTRIP client object */
127  /** Exposes the NTRIP client object */
128  const CNTRIPClient& getNTRIPClient() const { return m_client; }
129 }; // End of class
130 
131 }
132 #endif
133 
134 
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.
FILE * outfile
Definition: mrpt_jpeglib.h:908
A communications serial port built as an implementation of a utils::CStream.
Definition: CSerialPort.h:41
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:77
CNTRIPClient m_client
The NTRIP comms object.
Definition: CNTRIPEmitter.h:70
A high-performance stopwatch, with typical resolution of nanoseconds.
Contains classes for various device interfaces.
A client for NTRIP (HTTP) sources of differential GPS corrections from internet servers, or Global navigation satellite system (GNSS) internet radio.
Definition: CNTRIPClient.h:37
This class allows loading and storing values and vectors of different types from a configuration text...
GLsizei const GLchar ** string
Definition: glext.h:4101
void loadConfig_sensorSpecific(const mrpt::config::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:67
std::ofstream m_raw_output_file_stream
Definition: CNTRIPEmitter.h:81
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:72
void setRawOutputFilePrefix(const std::string &outfile)
mrpt::system::CTicTac m_rate_timer
Definition: CNTRIPEmitter.h:82
This "virtual driver" encapsulates a NTRIP client (see CNTRIPClient) but adds the functionality of du...
Definition: CNTRIPEmitter.h:62
The arguments for connecting to a NTRIP stream, used in CNTRIPClient::open.
Definition: CNTRIPClient.h:90
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: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020