MRPT  1.9.9
CGPS_NTRIP.cpp
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2020, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #include "hwdrivers-precomp.h" // Precompiled headers
11 
14 #include <iostream>
15 
16 using namespace mrpt::hwdrivers;
17 using namespace mrpt::obs;
18 using namespace mrpt::system;
19 using namespace std;
20 
22 
23 /** Constructor. See mrpt::hwdrivers::CGPSInterface for the meaning of params.
24  */
25 CGPS_NTRIP::CGPS_NTRIP() : gps(), ntrip() {}
26 /** Destructor */
27 CGPS_NTRIP::~CGPS_NTRIP() = default;
29 {
30  gps.initialize();
31  ntrip.initialize();
32 }
33 
34 // See docs in parent class
36 {
37  // Process GPS:
38  gps.doProcess();
39 
40  // Move sensed observations to this object:
41  {
43  gps.getObservations(lst);
44 
45  std::vector<mrpt::serialization::CSerializable::Ptr> vect;
46  vect.reserve(lst.size());
47  for (auto it = lst.begin(); it != lst.end(); ++it)
48  vect.push_back(it->second);
49  this->appendObservations(vect);
50  }
51 
52  // New GGA frames?
53  std::string sLastGGA = gps.getLastGGA();
54  if (!sLastGGA.empty())
55  {
56  if (m_verbose)
57  cout << "[CGPS_NTRIP] Redirecting GGA frame from GPS->NTRIP: '"
58  << sLastGGA << "'" << endl;
59 
60  ntrip.getNTRIPClient().sendBackToServer(sLastGGA + std::string("\r\n"));
61  }
62 
63  // Process NTRIP server comms:
64  ntrip.doProcess();
65 }
66 
68  const mrpt::config::CConfigFileBase& cfg, const std::string& section)
69 {
70  // Load GPS params:
71  gps.loadConfig(mrpt::config::CConfigFilePrefixer(cfg, "", "gps_"), section);
72  // NTRIP params:
73  ntrip.loadConfig(
74  mrpt::config::CConfigFilePrefixer(cfg, "", "ntrip_"), section);
75 
76  // Own params:
77  // (none yet)
78 }
~CGPS_NTRIP() override
Destructor.
void initialize() override
This method can or cannot be implemented in the derived class, depending on the need for it...
Definition: CGPS_NTRIP.cpp:28
void doProcess() override
This method will be invoked at a minimum rate of "process_rate" (Hz)
Definition: CGPS_NTRIP.cpp:35
Contains classes for various device interfaces.
STL namespace.
void loadConfig_sensorSpecific(const mrpt::config::CConfigFileBase &configSource, const std::string &iniSection) override
See the class documentation at the top for expected parameters.
Definition: CGPS_NTRIP.cpp:67
This class allows loading and storing values and vectors of different types from a configuration text...
This namespace contains representation of robot actions and observations.
A wrapper for other CConfigFileBase-based objects that prefixes a given token to every key and/or sec...
#define IMPLEMENTS_GENERIC_SENSOR(class_name, NameSpace)
This must be inserted in all CGenericSensor classes implementation files:
A combination of GPS receiver + NTRIP receiver capable of submitting GGA frames to enable RTCM 3...
Definition: CGPS_NTRIP.h:74
std::multimap< mrpt::system::TTimeStamp, mrpt::serialization::CSerializable::Ptr > TListObservations



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: c7a3bec24 Sun Mar 29 18:33:13 2020 +0200 at dom mar 29 18:50:38 CEST 2020