class mrpt::hwdrivers::CNTRIPEmitter

Overview

This “virtual driver” encapsulates a NTRIP client (see CNTRIPClient) but adds the functionality of dumping the received datastream to a given serial port.

Used within rawlog-grabber, along CGPSInterface, this class allows one to build a powerful & simple RTK-capable GPS receiver system.

Therefore, this sensor will never “collect” any observation via the CGenericSensor interface.

See also the example configuration file for rawlog-grabber in “share/mrpt/config_files/rawlog-grabber”.

 PARAMETERS IN THE ".INI"-LIKE CONFIGURATION STRINGS:
-------------------------------------------------------
  [supplied_section_name]
  COM_port_WIN = COM1         // Serial port where the NTRIP stream will be
dumped to.
  COM_port_LIN = ttyUSB0
  baudRate     = 38400
  #transmit_to_server = true   // (Default:true) Whether to send back to the
TCP/IP caster all data received from the output serial port
  #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.

  server   = 143.123.9.129    // NTRIP caster IP
  port     = 2101
  mountpoint = MYPOINT23
  //user = pepe            // User & password optional.
  //password = loco

The next picture summarizes existing MRPT classes related to GPS / GNSS devices (CGPSInterface, CNTRIPEmitter, CGPS_NTRIP):

_images/mrpt_gps_classes_usage.png

See also:

CGPSInterface, CGPS_NTRIP, CNTRIPClient

#include <mrpt/hwdrivers/CNTRIPEmitter.h>

class CNTRIPEmitter: public mrpt::hwdrivers::CGenericSensor
{
public:
    // construction

    CNTRIPEmitter();

    // methods

    void setOutputSerialPort(const std::string& port);
    std::string getOutputSerialPort() const;
    void setRawOutputFilePrefix(const std::string& outfile);
    std::string getRawOutputFilePrefix() const;
    virtual void initialize();
    virtual void doProcess();
    CNTRIPClient& getNTRIPClient();
    const CNTRIPClient& getNTRIPClient() const;
};

Inherited Members

public:
    // typedefs

    typedef std::shared_ptr<CGenericSensor> Ptr;
    typedef std::multimap<mrpt::system::TTimeStamp, mrpt::serialization::CSerializable::Ptr> TListObservations;
    typedef std::pair<mrpt::system::TTimeStamp, mrpt::serialization::CSerializable::Ptr> TListObsPair;

    // enums

    enum TSensorState;

    // methods

    virtual const mrpt::hwdrivers::TSensorClassId* GetRuntimeClass() const = 0;
    TSensorState getState() const;
    double getProcessRate() const;
    std::string getSensorLabel() const;
    void setSensorLabel(const std::string& sensorLabel);
    void enableVerbose(bool enabled = true);
    bool isVerboseEnabled() const;
    CGenericSensor& operator = (const CGenericSensor&);
    virtual void loadConfig(const mrpt::config::CConfigFileBase& configSource, const std::string& section);
    virtual void initialize();
    virtual void doProcess() = 0;
    virtual TListObservations getObservations();
    virtual void setPathForExternalImages(] const std::string& directory);
    virtual void setExternalImageFormat(const std::string& ext);
    virtual void setExternalImageJPEGQuality(const unsigned int quality);
    virtual unsigned int getExternalImageJPEGQuality() const;
    static void registerClass(const TSensorClassId* pNewClass);
    static CGenericSensor* createSensor(const std::string& className);
    static Ptr createSensorPtr(const std::string& className);

Construction

CNTRIPEmitter()

Constructor

Methods

void setOutputSerialPort(const std::string& port)

Changes the serial port to connect to (call prior to ‘doProcess’), for example “COM1” or “ttyS0”.

This is not needed if the configuration is loaded with “loadConfig”.

virtual void initialize()

Set up the NTRIP communications, raising an exception on fatal errors.

Called automatically by rawlog-grabber. If used manually, call after “loadConfig” and before “doProcess”.

virtual void doProcess()

The main loop, which must be called in a timely fashion in order to process the incoming NTRIP data stream and dump it to the serial port.

This method is called automatically when used within rawlog-grabber.

CNTRIPClient& getNTRIPClient()

Exposes the NTRIP client object.

const CNTRIPClient& getNTRIPClient() const

Exposes the NTRIP client object.