Main MRPT website > C++ reference for MRPT 1.4.0
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Static Private Attributes
mrpt::hwdrivers::CGPSInterface Class Referenceabstract

Detailed Description

A class capable of reading GPS/GNSS/GNSS+IMU receiver data, from a serial port or from any input stream, and parsing the ASCII/binary stream into indivual messages stored in mrpt::obs::CObservationGPS objects.

Typical input streams are serial ports or raw GPS log files. By default, the serial port selected by CGPSInterface::setSerialPortName() or as set in the configuration file will be open upon call to CGenericSensor::initialize(). Alternatively, an external stream can be bound with CGPSInterface::bindStream() before calling CGenericSensor::initialize(). This feature can be used to parse commands from a file, a TCP/IP stream, a memory block, etc.

The parsers in the enum type CGPSInterface::PARSERS are supported as parameter parser in the configuration file below or in method CGPSInterface::setParser():

See available parameters below, and an example config file for rawlog-grabber here

PARAMETERS IN THE ".INI"-LIKE CONFIGURATION STRINGS:
-------------------------------------------------------
[supplied_section_name]
# Serial port configuration:
COM_port_WIN = COM3
COM_port_LIN = ttyUSB0
baudRate = 4800 // The baudrate of the communications (typ. 4800 or 9600 bauds)
# (Default:true) Whether to append the GNNS message type to CObservation `sensorLabel` field
sensor_label_append_msg_type = true
# Select a parser for GNSS data:
# Up-to-date list of supported parsers available in http://reference.mrpt.org/devel/classmrpt_1_1hwdrivers_1_1_c_g_p_s_interface.html
parser = AUTO
# If uncommented and non-empty, raw binary/ascii data received from the serial port will be also dumped
# into a file named after this prefix, plus date/time and extension `.gps`.
#raw_dump_file_prefix = RAWGPS
# 3D position (and orientation, for GNSS+IMUs) of the sensed point (antenna phase center) relative to the vehicle/robot frame:
pose_x = 0 // (meters)
pose_y = 0
pose_z = 0
pose_yaw = 0 // (deg)
pose_pitch = 0
pose_roll = 0
# Optional: list of custom commands to be sent to the GNSS receiver to set it up.
# An arbitrary number of commands can be defined, but their names must be "setup_cmd%d" starting at "1".
# Commands will be sent by index order. Binary commands instead of ASCII strings can be set programatically, not from a config file.
# custom_cmds_delay = 0.1 // (Default=0.1) Delay in seconds between consecutive set-up commands
# custom_cmds_append_CRLF = true // (Default:true) Append "\r\n" to each command
# setup_cmd1 = XXXXX
# setup_cmd2 = XXXXX
# setup_cmd3 = XXXXX
# Optional: list of commands to be sent upon disconnection (e.g. object destructor)
# shutdown_cmd1 = XXXX
# shutdown_cmd2 = XXXX

Note that the customInit field, supported in MRPT <1.4.0 will be still parsed and obeyed, but since it has been superseded by the new mechanism to establish set-up commands, it is no further documented here.

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

VERSIONS HISTORY:

Definition at line 110 of file CGPSInterface.h.

#include <mrpt/hwdrivers/CGPSInterface.h>

Inheritance diagram for mrpt::hwdrivers::CGPSInterface:
Inheritance graph

Public Types

enum  PARSERS { NONE = -2 , AUTO = -1 , NMEA = 0 , NOVATEL_OEM6 }
 Read about parser selection in the documentation for CGPSInterface. More...
 
typedef bool(CGPSInterface::* ptr_parser_t) (size_t &out_minimum_rx_buf_to_decide)
 
enum  TSensorState { ssInitializing = 0 , ssWorking , ssError }
 The current state of the sensor. More...
 
typedef std::multimap< mrpt::system::TTimeStamp, mrpt::utils::CSerializablePtr > TListObservations
 
typedef std::pair< mrpt::system::TTimeStamp, mrpt::utils::CSerializablePtr > TListObsPair
 

Public Member Functions

 CGPSInterface ()
 Default ctor. More...
 
virtual ~CGPSInterface ()
 Dtor. More...
 
void doProcess ()
 This method will be invoked at a minimum rate of "process_rate" (Hz) More...
 
bool isGPS_connected ()
 Returns true if communications work, i.e. if some message has been received. More...
 
bool isGPS_signalAcquired ()
 Returns true if the last message from the GPS indicates that the signal from sats has been acquired. More...
 
bool isAIMConfigured ()
 
std::string getLastGGA (bool reset=true)
 Gets the latest GGA command or an empty string if no newer GGA command was received since the last call to this method. More...
 
virtual const mrpt::hwdrivers::TSensorClassIdGetRuntimeClass () const =0
 
TSensorState getState () const
 The current state of the sensor
More...
 
double getProcessRate () const
 
std::string getSensorLabel () const
 
void setSensorLabel (const std::string &sensorLabel)
 
void enableVerbose (bool enabled=true)
 Enable or disable extra debug info dumped to std::cout during sensor operation. More...
 
bool isVerboseEnabled () const
 
void loadConfig (const mrpt::utils::CConfigFileBase &configSource, const std::string &section)
 Loads the generic settings common to any sensor (See CGenericSensor), then call to "loadConfig_sensorSpecific". More...
 
virtual void initialize ()
 This method can or cannot be implemented in the derived class, depending on the need for it. More...
 
void getObservations (TListObservations &lstObjects)
 Returns a list of enqueued objects, emptying it (thread-safe). More...
 
virtual void setPathForExternalImages (const std::string &directory)
 Set the path where to save off-rawlog image files (will be ignored in those sensors where this is not applicable). More...
 
void setExternalImageFormat (const std::string &ext)
 Set the extension ("jpg","gif","png",...) that determines the format of images saved externally The default is "jpg". More...
 
void setExternalImageJPEGQuality (const unsigned int quality)
 The quality of JPEG compression, when external images is enabled and the format is "jpg". More...
 
unsigned int getExternalImageJPEGQuality () const
 
Set-up and configuration
void setSerialPortName (const std::string &COM_port)
 Set the serial port to use (COM1, ttyUSB0, etc). More...
 
std::string getSerialPortName () const
 Get the serial port to use (COM1, ttyUSB0, etc). More...
 
void setParser (PARSERS parser)
 Select the parser for incomming data, among the options enumerated in CGPSInterface. More...
 
PARSERS getParser () const
 
void bindStream (mrpt::utils::CStream *external_stream, mrpt::synch::CCriticalSection *csOptionalExternalStream=NULL)
 This enforces the use of a given user stream, instead of trying to open the serial port set in this class parameters. More...
 
bool useExternCOM () const
 
bool useExternalStream () const
 
void setSetupCommandsDelay (const double delay_secs)
 
double getSetupCommandsDelay () const
 
void setSetupCommands (const std::vector< std::string > &cmds)
 
const std::vector< std::string > & getSetupCommands () const
 
void setShutdownCommands (const std::vector< std::string > &cmds)
 
const std::vector< std::string > & getShutdownCommands () const
 
void enableSetupCommandsAppendCRLF (const bool enable)
 
bool isEnabledSetupCommandsAppendCRLF () const
 
void enableAppendMsgTypeToSensorLabel (bool enable)
 
bool sendCustomCommand (const void *data, const size_t datalen)
 Send a custom data block to the GNSS device right now. More...
 
Parser implementations: each method must try to parse the first bytes in the

incoming buffer, and return false if the available data does not match the expected format, so we must skip 1 byte and try again.

bool implement_parser_NMEA (size_t &out_minimum_rx_buf_to_decide)
 
bool implement_parser_NOVATEL_OEM6 (size_t &out_minimum_rx_buf_to_decide)
 

Static Public Member Functions

static bool parse_NMEA (const std::string &cmd_line, mrpt::obs::CObservationGPS &out_obs, const bool verbose=false)
 Parses one line of NMEA data from a GPS receiver, and writes the recognized fields (if any) into an observation object. More...
 
static void printf_debug (const char *frmt,...)
 Sends a formated text to "debugOut" if not NULL, or to cout otherwise. More...
 
static void registerClass (const TSensorClassId *pNewClass)
 Register a class into the internal list of "CGenericSensor" descendents. More...
 
static CGenericSensorcreateSensor (const std::string &className)
 Creates a sensor by a name of the class. More...
 
static CGenericSensorPtr createSensorPtr (const std::string &className)
 Just like createSensor, but returning a smart pointer to the newly created sensor object. More...
 

Protected Member Functions

bool OnConnectionEstablished ()
 Implements custom messages to be sent to the GPS unit just after connection and before normal use. More...
 
bool OnConnectionShutdown ()
 Like OnConnectionEstablished() for sending optional shutdown commands. More...
 
bool legacy_topcon_setup_commands ()
 
void loadConfig_sensorSpecific (const mrpt::utils::CConfigFileBase &configSource, const std::string &iniSection)
 See the class documentation at the top for expected parameters. More...
 
void setJAVAD_rtk_src_port (const std::string &s)
 If not empty, will send a cmd "set,/par/pos/pd/port,...". More...
 
void setJAVAD_rtk_src_baud (unsigned int baud)
 Only used when "m_JAVAD_rtk_src_port" is not empty. More...
 
void setJAVAD_rtk_format (const std::string &s)
 Only used when "m_JAVAD_rtk_src_port" is not empty: format of RTK corrections: "cmr", "rtcm", "rtcm3", etc. More...
 
bool setJAVAD_AIM_mode ()
 Set Advanced Input Mode for the primary port. More...
 
bool unsetJAVAD_AIM_mode ()
 Unset Advanced Input Mode for the primary port and use it only as a command port. More...
 
void appendObservations (const std::vector< mrpt::utils::CSerializablePtr > &obj)
 This method must be called by derived classes to enqueue a new observation in the list to be returned by getObservations. More...
 
void appendObservation (const mrpt::utils::CSerializablePtr &obj)
 Like appendObservations() but for just one observation. More...
 

Protected Attributes

mrpt::utils::CStreamm_data_stream
 Typically a CSerialPort created by this class, but may be set externally. More...
 
mrpt::synch::CCriticalSectionm_data_stream_cs
 
bool m_data_stream_is_external
 
poses::CPose3D m_sensorPose
 
std::string m_customInit
 
size_t m_grab_decimation_counter
 Used when "m_grab_decimation" is enabled. More...
 
TSensorState m_state
 
bool m_verbose
 
std::string m_path_for_external_images
 The path where to save off-rawlog images: empty means save images embedded in the rawlog. More...
 
std::string m_external_images_format
 The extension ("jpg","gif","png",...) that determines the format of images saved externally. More...
 
unsigned int m_external_images_jpeg_quality
 For JPEG images, the quality (default=95%). More...
 
Common settings to any sensor, loaded in "loadConfig"
double m_process_rate
 See CGenericSensor. More...
 
size_t m_max_queue_len
 See CGenericSensor. More...
 
size_t m_grab_decimation
 If set to N>=2, only 1 out of N observations will be saved to m_objList. More...
 
std::string m_sensorLabel
 See CGenericSensor. More...
 

Private Member Functions

bool tryToOpenTheCOM ()
 Returns true if the COM port is already open, or try to open it in other case. More...
 
void parseBuffer ()
 Process data in "m_buffer" to extract GPS messages, and remove them from the buffer. More...
 
void flushParsedMessagesNow ()
 Queue out now the messages in m_just_parsed_messages, leaving it empty. More...
 

Private Attributes

mrpt::utils::circular_buffer< uint8_tm_rx_buffer
 Auxiliary buffer for readings. More...
 
PARSERS m_parser
 
std::string m_raw_dump_file_prefix
 
std::string m_COMname
 
int m_COMbauds
 
bool m_sensorLabelAppendMsgType
 
bool m_GPS_comsWork
 
mrpt::system::TTimeStamp m_last_timestamp
 
mrpt::utils::CFileOutputStream m_raw_output_file
 
double m_custom_cmds_delay
 
bool m_custom_cmds_append_CRLF
 
std::vector< std::string > m_setup_cmds
 
std::vector< std::string > m_shutdown_cmds
 
mrpt::obs::CObservationGPS m_just_parsed_messages
 A private copy of the last received gps datum. More...
 
std::string m_last_GGA
 Used in getLastGGA() More...
 
synch::CCriticalSection m_csObjList
 The critical section for m_objList. More...
 
TListObservations m_objList
 The queue of objects to be returned by getObservations. More...
 

Static Private Attributes

static std::map< std::string, const TSensorClassId * > m_knownClasses
 Used in registerClass. More...
 

Legacy support for TopCon RTK configuration

std::string m_JAVAD_rtk_src_port
 If not empty, will send a cmd "set,/par/pos/pd/port,...". Example value: "/dev/ser/b". More...
 
unsigned int m_JAVAD_rtk_src_baud
 Only used when "m_JAVAD_rtk_src_port" is not empty. More...
 
std::string m_JAVAD_rtk_format
 Only used when "m_JAVAD_rtk_src_port" is not empty: format of RTK corrections: "cmr", "rtcm", "rtcm3", etc. More...
 
bool m_topcon_useAIMMode
 Use this mode for receive RTK corrections from a external source through the primary port. More...
 
bool m_topcon_AIMConfigured
 Indicates if the AIM has been properly set up. More...
 
double m_topcon_data_period
 The period in seconds which the data should be provided by the GPS. More...
 
void JAVAD_sendMessage (const char *str, bool waitForAnswer=true)
 Private auxiliary method. Raises exception on error. More...
 

Member Typedef Documentation

◆ ptr_parser_t

typedef bool(CGPSInterface::* mrpt::hwdrivers::CGPSInterface::ptr_parser_t) (size_t &out_minimum_rx_buf_to_decide)

Definition at line 184 of file CGPSInterface.h.

◆ TListObservations

typedef std::multimap< mrpt::system::TTimeStamp, mrpt::utils::CSerializablePtr > mrpt::hwdrivers::CGenericSensor::TListObservations
inherited

Definition at line 68 of file CGenericSensor.h.

◆ TListObsPair

typedef std::pair< mrpt::system::TTimeStamp, mrpt::utils::CSerializablePtr > mrpt::hwdrivers::CGenericSensor::TListObsPair
inherited

Definition at line 69 of file CGenericSensor.h.

Member Enumeration Documentation

◆ PARSERS

Read about parser selection in the documentation for CGPSInterface.

Enumerator
NONE 
AUTO 
NMEA 
NOVATEL_OEM6 

Definition at line 116 of file CGPSInterface.h.

◆ TSensorState

The current state of the sensor.

See also
CGenericSensor::getState
Enumerator
ssInitializing 
ssWorking 
ssError 

Definition at line 74 of file CGenericSensor.h.

Constructor & Destructor Documentation

◆ CGPSInterface()

mrpt::hwdrivers::CGPSInterface::CGPSInterface ( )

Default ctor.

◆ ~CGPSInterface()

virtual mrpt::hwdrivers::CGPSInterface::~CGPSInterface ( )
virtual

Dtor.

Member Function Documentation

◆ appendObservation()

void mrpt::hwdrivers::CGenericSensor::appendObservation ( const mrpt::utils::CSerializablePtr &  obj)
inlineprotectedinherited

Like appendObservations() but for just one observation.

Definition at line 146 of file CGenericSensor.h.

◆ appendObservations()

void mrpt::hwdrivers::CGenericSensor::appendObservations ( const std::vector< mrpt::utils::CSerializablePtr > &  obj)
protectedinherited

This method must be called by derived classes to enqueue a new observation in the list to be returned by getObservations.

Passed objects must be created in dynamic memory and a smart pointer passed. Example of creation:

mrpt::obs::CObservationGPSPtr o = CObservationGPSPtr( new CObservationGPS() );
o-> .... // Set data
void appendObservation(const mrpt::utils::CSerializablePtr &obj)
Like appendObservations() but for just one observation.
struct OBS_IMPEXP CObservationGPSPtr

If several observations are passed at once in the vector, they'll be considered as a block regarding the grabbing decimation factor.

◆ bindStream()

void mrpt::hwdrivers::CGPSInterface::bindStream ( mrpt::utils::CStream external_stream,
mrpt::synch::CCriticalSection csOptionalExternalStream = NULL 
)

This enforces the use of a given user stream, instead of trying to open the serial port set in this class parameters.

Parameters
[in]csExternalStreamIf not NULL, read/write operations to the stream will be guarded by this critical section. The stream object is not deleted. It is the user responsibility to keep that object allocated during the entire life of this object.
Note
Call before CGenericSensor::initialize()

◆ createSensor()

static CGenericSensor * mrpt::hwdrivers::CGenericSensor::createSensor ( const std::string &  className)
staticinherited

Creates a sensor by a name of the class.

Typically the user may want to create a smart pointer around the returned pointer, whis is made with:

static CGenericSensor * createSensor(const std::string &className)
Creates a sensor by a name of the class.
stlplus::smart_ptr< CGenericSensor > CGenericSensorPtr
Returns
A pointer to a new class, or NULL if class name is unknown.

◆ createSensorPtr()

static CGenericSensorPtr mrpt::hwdrivers::CGenericSensor::createSensorPtr ( const std::string &  className)
inlinestaticinherited

Just like createSensor, but returning a smart pointer to the newly created sensor object.

Definition at line 179 of file CGenericSensor.h.

◆ doProcess()

void mrpt::hwdrivers::CGPSInterface::doProcess ( )
virtual

This method will be invoked at a minimum rate of "process_rate" (Hz)

Exceptions
Thismethod must throw an exception with a descriptive message if some critical error is found.

Implements mrpt::hwdrivers::CGenericSensor.

◆ enableAppendMsgTypeToSensorLabel()

void mrpt::hwdrivers::CGPSInterface::enableAppendMsgTypeToSensorLabel ( bool  enable)
inline

Definition at line 164 of file CGPSInterface.h.

◆ enableSetupCommandsAppendCRLF()

void mrpt::hwdrivers::CGPSInterface::enableSetupCommandsAppendCRLF ( const bool  enable)

◆ enableVerbose()

void mrpt::hwdrivers::CGenericSensor::enableVerbose ( bool  enabled = true)
inlineinherited

Enable or disable extra debug info dumped to std::cout during sensor operation.

Default: disabled unless the environment variable "MRPT_HWDRIVERS_VERBOSE" is set to "1" during object creation.

Definition at line 92 of file CGenericSensor.h.

◆ flushParsedMessagesNow()

void mrpt::hwdrivers::CGPSInterface::flushParsedMessagesNow ( )
private

Queue out now the messages in m_just_parsed_messages, leaving it empty.

◆ getExternalImageJPEGQuality()

unsigned int mrpt::hwdrivers::CGenericSensor::getExternalImageJPEGQuality ( ) const
inlineinherited

Definition at line 233 of file CGenericSensor.h.

◆ getLastGGA()

std::string mrpt::hwdrivers::CGPSInterface::getLastGGA ( bool  reset = true)

Gets the latest GGA command or an empty string if no newer GGA command was received since the last call to this method.

Parameters
[in]resetIf set to true, will empty the GGA cache so next calls will return an empty string if no new frame is received.

◆ getObservations()

void mrpt::hwdrivers::CGenericSensor::getObservations ( TListObservations lstObjects)
inherited

Returns a list of enqueued objects, emptying it (thread-safe).

The objects must be freed by the invoker.

◆ getParser()

PARSERS mrpt::hwdrivers::CGPSInterface::getParser ( ) const

◆ getProcessRate()

double mrpt::hwdrivers::CGenericSensor::getProcessRate ( ) const
inlineinherited

Definition at line 84 of file CGenericSensor.h.

◆ GetRuntimeClass()

virtual const mrpt::hwdrivers::TSensorClassId * mrpt::hwdrivers::CGenericSensor::GetRuntimeClass ( ) const
pure virtualinherited

◆ getSensorLabel()

std::string mrpt::hwdrivers::CGenericSensor::getSensorLabel ( ) const
inlineinherited

Definition at line 86 of file CGenericSensor.h.

◆ getSerialPortName()

std::string mrpt::hwdrivers::CGPSInterface::getSerialPortName ( ) const

Get the serial port to use (COM1, ttyUSB0, etc).

◆ getSetupCommands()

const std::vector< std::string > & mrpt::hwdrivers::CGPSInterface::getSetupCommands ( ) const

◆ getSetupCommandsDelay()

double mrpt::hwdrivers::CGPSInterface::getSetupCommandsDelay ( ) const

◆ getShutdownCommands()

const std::vector< std::string > & mrpt::hwdrivers::CGPSInterface::getShutdownCommands ( ) const

◆ getState()

TSensorState mrpt::hwdrivers::CGenericSensor::getState ( ) const
inlineinherited

The current state of the sensor

Definition at line 82 of file CGenericSensor.h.

◆ implement_parser_NMEA()

bool mrpt::hwdrivers::CGPSInterface::implement_parser_NMEA ( size_t &  out_minimum_rx_buf_to_decide)

◆ implement_parser_NOVATEL_OEM6()

bool mrpt::hwdrivers::CGPSInterface::implement_parser_NOVATEL_OEM6 ( size_t &  out_minimum_rx_buf_to_decide)

◆ initialize()

virtual void mrpt::hwdrivers::CGenericSensor::initialize ( )
inlinevirtualinherited

◆ isAIMConfigured()

bool mrpt::hwdrivers::CGPSInterface::isAIMConfigured ( )
inline

Definition at line 171 of file CGPSInterface.h.

◆ isEnabledSetupCommandsAppendCRLF()

bool mrpt::hwdrivers::CGPSInterface::isEnabledSetupCommandsAppendCRLF ( ) const

◆ isGPS_connected()

bool mrpt::hwdrivers::CGPSInterface::isGPS_connected ( )

Returns true if communications work, i.e. if some message has been received.

◆ isGPS_signalAcquired()

bool mrpt::hwdrivers::CGPSInterface::isGPS_signalAcquired ( )

Returns true if the last message from the GPS indicates that the signal from sats has been acquired.

◆ isVerboseEnabled()

bool mrpt::hwdrivers::CGenericSensor::isVerboseEnabled ( ) const
inlineinherited

Definition at line 93 of file CGenericSensor.h.

◆ JAVAD_sendMessage()

void mrpt::hwdrivers::CGPSInterface::JAVAD_sendMessage ( const char *  str,
bool  waitForAnswer = true 
)
private

Private auxiliary method. Raises exception on error.

◆ legacy_topcon_setup_commands()

bool mrpt::hwdrivers::CGPSInterface::legacy_topcon_setup_commands ( )
protected

◆ loadConfig()

void mrpt::hwdrivers::CGenericSensor::loadConfig ( const mrpt::utils::CConfigFileBase configSource,
const std::string &  section 
)
inherited

Loads the generic settings common to any sensor (See CGenericSensor), then call to "loadConfig_sensorSpecific".

Exceptions
Thismethod throws an exception with a descriptive message if some critical parameter is missing or has an invalid value.

◆ loadConfig_sensorSpecific()

void mrpt::hwdrivers::CGPSInterface::loadConfig_sensorSpecific ( const mrpt::utils::CConfigFileBase configSource,
const std::string &  iniSection 
)
protectedvirtual

See the class documentation at the top for expected parameters.

Implements mrpt::hwdrivers::CGenericSensor.

◆ OnConnectionEstablished()

bool mrpt::hwdrivers::CGPSInterface::OnConnectionEstablished ( )
protected

Implements custom messages to be sent to the GPS unit just after connection and before normal use.

Returns false or raise an exception if something goes wrong.

◆ OnConnectionShutdown()

bool mrpt::hwdrivers::CGPSInterface::OnConnectionShutdown ( )
protected

Like OnConnectionEstablished() for sending optional shutdown commands.

◆ parse_NMEA()

static bool mrpt::hwdrivers::CGPSInterface::parse_NMEA ( const std::string &  cmd_line,
mrpt::obs::CObservationGPS out_obs,
const bool  verbose = false 
)
static

Parses one line of NMEA data from a GPS receiver, and writes the recognized fields (if any) into an observation object.

Recognized frame types are those listed for the NMEA parser in the documentation of CGPSInterface

Returns
true if some new data field has been correctly parsed and inserted into out_obs

◆ parseBuffer()

void mrpt::hwdrivers::CGPSInterface::parseBuffer ( )
private

Process data in "m_buffer" to extract GPS messages, and remove them from the buffer.

◆ printf_debug()

static void mrpt::utils::CDebugOutputCapable::printf_debug ( const char *  frmt,
  ... 
)
staticinherited

Sends a formated text to "debugOut" if not NULL, or to cout otherwise.

Referenced by mrpt::math::CLevenbergMarquardtTempl< VECTORTYPE, USERPARAM >::execute().

◆ registerClass()

static void mrpt::hwdrivers::CGenericSensor::registerClass ( const TSensorClassId pNewClass)
staticinherited

Register a class into the internal list of "CGenericSensor" descendents.

Used internally in the macros DEFINE_GENERIC_SENSOR, etc...

Can be used as "CGenericSensor::registerClass( SENSOR_CLASS_ID(CMySensor) );" if building custom sensors outside mrpt libraries in user code.

◆ sendCustomCommand()

bool mrpt::hwdrivers::CGPSInterface::sendCustomCommand ( const void *  data,
const size_t  datalen 
)

Send a custom data block to the GNSS device right now.

Can be used to change its behavior online as needed.

Returns
false on communication error

◆ setExternalImageFormat()

void mrpt::hwdrivers::CGenericSensor::setExternalImageFormat ( const std::string &  ext)
inlineinherited

Set the extension ("jpg","gif","png",...) that determines the format of images saved externally The default is "jpg".

See also
setPathForExternalImages, setExternalImageJPEGQuality

Definition at line 225 of file CGenericSensor.h.

◆ setExternalImageJPEGQuality()

void mrpt::hwdrivers::CGenericSensor::setExternalImageJPEGQuality ( const unsigned int  quality)
inlineinherited

The quality of JPEG compression, when external images is enabled and the format is "jpg".

See also
setExternalImageFormat

Definition at line 230 of file CGenericSensor.h.

◆ setJAVAD_AIM_mode()

bool mrpt::hwdrivers::CGPSInterface::setJAVAD_AIM_mode ( )
protected

Set Advanced Input Mode for the primary port.

This can be used to send RTK corrections to the device using the same port that it's used for the commands. The RTK correction stream must be re-packaged into a special frame with prefix ">>"

◆ setJAVAD_rtk_format()

void mrpt::hwdrivers::CGPSInterface::setJAVAD_rtk_format ( const std::string &  s)
inlineprotected

Only used when "m_JAVAD_rtk_src_port" is not empty: format of RTK corrections: "cmr", "rtcm", "rtcm3", etc.

Definition at line 220 of file CGPSInterface.h.

◆ setJAVAD_rtk_src_baud()

void mrpt::hwdrivers::CGPSInterface::setJAVAD_rtk_src_baud ( unsigned int  baud)
inlineprotected

Only used when "m_JAVAD_rtk_src_port" is not empty.

Definition at line 217 of file CGPSInterface.h.

◆ setJAVAD_rtk_src_port()

void mrpt::hwdrivers::CGPSInterface::setJAVAD_rtk_src_port ( const std::string &  s)
inlineprotected

If not empty, will send a cmd "set,/par/pos/pd/port,...".

Example value: "/dev/ser/b"

Definition at line 214 of file CGPSInterface.h.

◆ setParser()

void mrpt::hwdrivers::CGPSInterface::setParser ( PARSERS  parser)

Select the parser for incomming data, among the options enumerated in CGPSInterface.

◆ setPathForExternalImages()

virtual void mrpt::hwdrivers::CGenericSensor::setPathForExternalImages ( const std::string &  directory)
inlinevirtualinherited

Set the path where to save off-rawlog image files (will be ignored in those sensors where this is not applicable).

An empty string (the default value at construction) means to save images embedded in the rawlog, instead of on separate files.

Exceptions
std::exceptionIf the directory doesn't exists and cannot be created.

Reimplemented in mrpt::hwdrivers::CCameraSensor, mrpt::hwdrivers::CKinect, mrpt::hwdrivers::COpenNI2_RGBD360, mrpt::hwdrivers::COpenNI2Sensor, and mrpt::hwdrivers::CSwissRanger3DCamera.

Definition at line 216 of file CGenericSensor.h.

References MRPT_UNUSED_PARAM.

◆ setSensorLabel()

void mrpt::hwdrivers::CGenericSensor::setSensorLabel ( const std::string &  sensorLabel)
inlineinherited

Definition at line 87 of file CGenericSensor.h.

◆ setSerialPortName()

void mrpt::hwdrivers::CGPSInterface::setSerialPortName ( const std::string &  COM_port)

Set the serial port to use (COM1, ttyUSB0, etc).

◆ setSetupCommands()

void mrpt::hwdrivers::CGPSInterface::setSetupCommands ( const std::vector< std::string > &  cmds)

◆ setSetupCommandsDelay()

void mrpt::hwdrivers::CGPSInterface::setSetupCommandsDelay ( const double  delay_secs)

◆ setShutdownCommands()

void mrpt::hwdrivers::CGPSInterface::setShutdownCommands ( const std::vector< std::string > &  cmds)

◆ tryToOpenTheCOM()

bool mrpt::hwdrivers::CGPSInterface::tryToOpenTheCOM ( )
private

Returns true if the COM port is already open, or try to open it in other case.

Returns
true if everything goes OK, or false if there are problems opening the port.

◆ unsetJAVAD_AIM_mode()

bool mrpt::hwdrivers::CGPSInterface::unsetJAVAD_AIM_mode ( )
protected

Unset Advanced Input Mode for the primary port and use it only as a command port.

◆ useExternalStream()

bool mrpt::hwdrivers::CGPSInterface::useExternalStream ( ) const
inline

Definition at line 150 of file CGPSInterface.h.

◆ useExternCOM()

bool mrpt::hwdrivers::CGPSInterface::useExternCOM ( ) const
inline

Definition at line 149 of file CGPSInterface.h.

Member Data Documentation

◆ m_COMbauds

int mrpt::hwdrivers::CGPSInterface::m_COMbauds
private

Definition at line 235 of file CGPSInterface.h.

◆ m_COMname

std::string mrpt::hwdrivers::CGPSInterface::m_COMname
private

Definition at line 234 of file CGPSInterface.h.

◆ m_csObjList

synch::CCriticalSection mrpt::hwdrivers::CGenericSensor::m_csObjList
privateinherited

The critical section for m_objList.

Definition at line 104 of file CGenericSensor.h.

◆ m_custom_cmds_append_CRLF

bool mrpt::hwdrivers::CGPSInterface::m_custom_cmds_append_CRLF
private

Definition at line 241 of file CGPSInterface.h.

◆ m_custom_cmds_delay

double mrpt::hwdrivers::CGPSInterface::m_custom_cmds_delay
private

Definition at line 240 of file CGPSInterface.h.

◆ m_customInit

std::string mrpt::hwdrivers::CGPSInterface::m_customInit
protected

Definition at line 206 of file CGPSInterface.h.

◆ m_data_stream

mrpt::utils::CStream* mrpt::hwdrivers::CGPSInterface::m_data_stream
protected

Typically a CSerialPort created by this class, but may be set externally.

Definition at line 201 of file CGPSInterface.h.

◆ m_data_stream_cs

mrpt::synch::CCriticalSection* mrpt::hwdrivers::CGPSInterface::m_data_stream_cs
protected

Definition at line 202 of file CGPSInterface.h.

◆ m_data_stream_is_external

bool mrpt::hwdrivers::CGPSInterface::m_data_stream_is_external
protected

Definition at line 203 of file CGPSInterface.h.

◆ m_external_images_format

std::string mrpt::hwdrivers::CGenericSensor::m_external_images_format
protectedinherited

The extension ("jpg","gif","png",...) that determines the format of images saved externally.

See also
setPathForExternalImages

Definition at line 130 of file CGenericSensor.h.

◆ m_external_images_jpeg_quality

unsigned int mrpt::hwdrivers::CGenericSensor::m_external_images_jpeg_quality
protectedinherited

For JPEG images, the quality (default=95%).

Definition at line 131 of file CGenericSensor.h.

◆ m_GPS_comsWork

bool mrpt::hwdrivers::CGPSInterface::m_GPS_comsWork
private

Definition at line 237 of file CGPSInterface.h.

◆ m_grab_decimation

size_t mrpt::hwdrivers::CGenericSensor::m_grab_decimation
protectedinherited

If set to N>=2, only 1 out of N observations will be saved to m_objList.

Definition at line 117 of file CGenericSensor.h.

◆ m_grab_decimation_counter

size_t mrpt::hwdrivers::CGenericSensor::m_grab_decimation_counter
protectedinherited

Used when "m_grab_decimation" is enabled.

Definition at line 122 of file CGenericSensor.h.

◆ m_JAVAD_rtk_format

std::string mrpt::hwdrivers::CGPSInterface::m_JAVAD_rtk_format
private

Only used when "m_JAVAD_rtk_src_port" is not empty: format of RTK corrections: "cmr", "rtcm", "rtcm3", etc.

Definition at line 249 of file CGPSInterface.h.

◆ m_JAVAD_rtk_src_baud

unsigned int mrpt::hwdrivers::CGPSInterface::m_JAVAD_rtk_src_baud
private

Only used when "m_JAVAD_rtk_src_port" is not empty.

Definition at line 248 of file CGPSInterface.h.

◆ m_JAVAD_rtk_src_port

std::string mrpt::hwdrivers::CGPSInterface::m_JAVAD_rtk_src_port
private

If not empty, will send a cmd "set,/par/pos/pd/port,...". Example value: "/dev/ser/b".

Definition at line 247 of file CGPSInterface.h.

◆ m_just_parsed_messages

mrpt::obs::CObservationGPS mrpt::hwdrivers::CGPSInterface::m_just_parsed_messages
private

A private copy of the last received gps datum.

Definition at line 264 of file CGPSInterface.h.

◆ m_knownClasses

std::map< std::string , const TSensorClassId *> mrpt::hwdrivers::CGenericSensor::m_knownClasses
staticprivateinherited

Used in registerClass.

Definition at line 108 of file CGenericSensor.h.

◆ m_last_GGA

std::string mrpt::hwdrivers::CGPSInterface::m_last_GGA
private

Used in getLastGGA()

Definition at line 265 of file CGPSInterface.h.

◆ m_last_timestamp

mrpt::system::TTimeStamp mrpt::hwdrivers::CGPSInterface::m_last_timestamp
private

Definition at line 238 of file CGPSInterface.h.

◆ m_max_queue_len

size_t mrpt::hwdrivers::CGenericSensor::m_max_queue_len
protectedinherited

See CGenericSensor.

Definition at line 116 of file CGenericSensor.h.

◆ m_objList

TListObservations mrpt::hwdrivers::CGenericSensor::m_objList
privateinherited

The queue of objects to be returned by getObservations.

Definition at line 105 of file CGenericSensor.h.

◆ m_parser

PARSERS mrpt::hwdrivers::CGPSInterface::m_parser
private

Definition at line 232 of file CGPSInterface.h.

◆ m_path_for_external_images

std::string mrpt::hwdrivers::CGenericSensor::m_path_for_external_images
protectedinherited

The path where to save off-rawlog images: empty means save images embedded in the rawlog.

Definition at line 129 of file CGenericSensor.h.

◆ m_process_rate

double mrpt::hwdrivers::CGenericSensor::m_process_rate
protectedinherited

See CGenericSensor.

Definition at line 115 of file CGenericSensor.h.

◆ m_raw_dump_file_prefix

std::string mrpt::hwdrivers::CGPSInterface::m_raw_dump_file_prefix
private

Definition at line 233 of file CGPSInterface.h.

◆ m_raw_output_file

mrpt::utils::CFileOutputStream mrpt::hwdrivers::CGPSInterface::m_raw_output_file
private

Definition at line 239 of file CGPSInterface.h.

◆ m_rx_buffer

mrpt::utils::circular_buffer<uint8_t> mrpt::hwdrivers::CGPSInterface::m_rx_buffer
private

Auxiliary buffer for readings.

Definition at line 231 of file CGPSInterface.h.

◆ m_sensorLabel

std::string mrpt::hwdrivers::CGenericSensor::m_sensorLabel
protectedinherited

See CGenericSensor.

Definition at line 118 of file CGenericSensor.h.

◆ m_sensorLabelAppendMsgType

bool mrpt::hwdrivers::CGPSInterface::m_sensorLabelAppendMsgType
private

Definition at line 236 of file CGPSInterface.h.

◆ m_sensorPose

poses::CPose3D mrpt::hwdrivers::CGPSInterface::m_sensorPose
protected

Definition at line 205 of file CGPSInterface.h.

◆ m_setup_cmds

std::vector<std::string> mrpt::hwdrivers::CGPSInterface::m_setup_cmds
private

Definition at line 242 of file CGPSInterface.h.

◆ m_shutdown_cmds

std::vector<std::string> mrpt::hwdrivers::CGPSInterface::m_shutdown_cmds
private

Definition at line 243 of file CGPSInterface.h.

◆ m_state

TSensorState mrpt::hwdrivers::CGenericSensor::m_state
protectedinherited

Definition at line 124 of file CGenericSensor.h.

◆ m_topcon_AIMConfigured

bool mrpt::hwdrivers::CGPSInterface::m_topcon_AIMConfigured
private

Indicates if the AIM has been properly set up.

Definition at line 252 of file CGPSInterface.h.

◆ m_topcon_data_period

double mrpt::hwdrivers::CGPSInterface::m_topcon_data_period
private

The period in seconds which the data should be provided by the GPS.

Definition at line 253 of file CGPSInterface.h.

◆ m_topcon_useAIMMode

bool mrpt::hwdrivers::CGPSInterface::m_topcon_useAIMMode
private

Use this mode for receive RTK corrections from a external source through the primary port.

Definition at line 251 of file CGPSInterface.h.

◆ m_verbose

bool mrpt::hwdrivers::CGenericSensor::m_verbose
protectedinherited

Definition at line 125 of file CGenericSensor.h.




Page generated by Doxygen 1.9.5 for MRPT 1.4.0 SVN: at Tue Dec 27 00:53:09 UTC 2022