Main MRPT website > C++ reference for MRPT 1.5.7
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 
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 adds the functionality of dumping the received datastream to a given serial port.
23  * Used within rawlog-grabber, along CGPSInterface, this class allows to build a powerful & simple RTK-capable GPS receiver system.
24  *
25  * Therefore, this sensor will never "collect" any observation via the CGenericSensor interface.
26  *
27  * See also the example configuration file for rawlog-grabber in "share/mrpt/config_files/rawlog-grabber".
28  *
29  * \code
30  * PARAMETERS IN THE ".INI"-LIKE CONFIGURATION STRINGS:
31  * -------------------------------------------------------
32  * [supplied_section_name]
33  * COM_port_WIN = COM1 // Serial port where the NTRIP stream will be dumped to.
34  * COM_port_LIN = ttyUSB0
35  * baudRate = 38400
36  * #transmit_to_server = true // (Default:true) Whether to send back to the TCP/IP caster all data received from the output serial port
37  * #raw_output_file_prefix = raw_ntrip_data // If provided, save raw data from the NTRIP to a file, useful for post-processing. In this case, not having a serial port configured (commented out) is a valid configuration.
38  *
39  * server = 143.123.9.129 // NTRIP caster IP
40  * port = 2101
41  * mountpoint = MYPOINT23
42  * //user = pepe // User & password optional.
43  * //password = loco
44  *
45  * \endcode
46  *
47  * The next picture summarizes existing MRPT classes related to GPS / GNSS devices (CGPSInterface, CNTRIPEmitter, CGPS_NTRIP):
48  *
49  * <div align=center> <img src="mrpt_gps_classes_usage.png"> </div>
50  *
51  * \ingroup mrpt_hwdrivers_grp
52  * \sa CGPSInterface, CGPS_NTRIP, CNTRIPClient
53  */
55  {
57 
58  private:
60 
61  CNTRIPClient m_client; //!< The NTRIP comms object.
62  CSerialPort m_out_COM; //!< The output serial port.
63 
64  std::string m_com_port; //!< If set to non-empty, the serial port will be attempted to be opened automatically when this class is first used to request data from the laser.
68  std::ofstream m_raw_output_file_stream;
70  size_t m_rate_count;
71 
72  protected:
73  /** See the class documentation at the top for expected parameters */
74  void loadConfig_sensorSpecific(
75  const mrpt::utils::CConfigFileBase &configSource,
76  const std::string &iniSection );
77 
78  public:
79  /** Constructor */
80  CNTRIPEmitter();
81 
82  /** Destructor */
83  virtual ~CNTRIPEmitter();
84 
85  /** Changes the serial port to connect to (call prior to 'doProcess'), for example "COM1" or "ttyS0".
86  * This is not needed if the configuration is loaded with "loadConfig".
87  */
88  void setOutputSerialPort(const std::string &port) { m_com_port = port; }
89  std::string getOutputSerialPort() const { return m_com_port; }
90 
91  void setRawOutputFilePrefix(const std::string &outfile) { m_raw_output_file_prefix = outfile; }
92  std::string getRawOutputFilePrefix() const { return m_raw_output_file_prefix; }
93 
94  /** Set up the NTRIP communications, raising an exception on fatal errors.
95  * Called automatically by rawlog-grabber.
96  * If used manually, call after "loadConfig" and before "doProcess".
97  */
98  void initialize();
99 
100  /** The main loop, which must be called in a timely fashion in order to process the incomming NTRIP data stream and dump it to the serial port.
101  * This method is called automatically when used within rawlog-grabber.
102  */
103  void doProcess();
104 
105  /** Exposes the NTRIP client object */
106  CNTRIPClient & getNTRIPClient() { return m_client; }
107  /** Exposes the NTRIP client object */
108  const CNTRIPClient & getNTRIPClient() const { return m_client; }
109 
110  }; // End of class
111 
112  } // End of namespace
113 } // End of namespace
114 
115 #endif
A generic interface for a wide-variety of sensors designed to be used in the application RawLogGrabbe...
mrpt::utils::CTicTac m_rate_timer
Definition: CNTRIPEmitter.h:69
FILE * outfile
Definition: mrpt_jpeglib.h:907
A communications serial port built as an implementation of a utils::CStream.
Definition: CSerialPort.h:43
void setOutputSerialPort(const std::string &port)
Changes the serial port to connect to (call prior to &#39;doProcess&#39;), for example "COM1" or "ttyS0"...
Definition: CNTRIPEmitter.h:88
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:64
CNTRIPClient m_client
The NTRIP comms object.
Definition: CNTRIPEmitter.h:61
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...
This class implements a high-performance stopwatch.
Definition: CTicTac.h:24
GLsizei const GLchar ** string
Definition: glext.h:3919
#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:59
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
std::ofstream m_raw_output_file_stream
Definition: CNTRIPEmitter.h:68
std::string getRawOutputFilePrefix() const
Definition: CNTRIPEmitter.h:92
std::string getOutputSerialPort() const
Definition: CNTRIPEmitter.h:89
void setRawOutputFilePrefix(const std::string &outfile)
Definition: CNTRIPEmitter.h:91
This "virtual driver" encapsulates a NTRIP client (see CNTRIPClient) but adds the functionality of du...
Definition: CNTRIPEmitter.h:54
The arguments for connecting to a NTRIP stream, used in CNTRIPClient::open.
Definition: CNTRIPClient.h:80
CNTRIPClient & getNTRIPClient()
Exposes the NTRIP client object.
CSerialPort m_out_COM
The output serial port.
Definition: CNTRIPEmitter.h:62
const CNTRIPClient & getNTRIPClient() const
Exposes the NTRIP client object.



Page generated by Doxygen 1.8.14 for MRPT 1.5.7 Git: 5902e14cc Wed Apr 24 15:04:01 2019 +0200 at lun oct 28 01:39:17 CET 2019