MRPT logo

mrpt::hwdrivers::CGPSInterface Class Reference

A parser of NMEA commands, for connecting to a GPS by a serial port. More...

#include <mrpt/hwdrivers/CGPSInterface.h>

Inheritance diagram for mrpt::hwdrivers::CGPSInterface:

mrpt::utils::CDebugOutputCapable mrpt::hwdrivers::CGenericSensor mrpt::utils::CUncopiable

List of all members.

Public Member Functions

 CGPSInterface (int BUFFER_LENGTH=500)
 Constructor.
virtual ~CGPSInterface ()
 Destructor.
void doProcess ()
 This method should be called periodically (at least at 1Hz to capture ALL the real-time data) It is thread safe, i.e.
void loadConfig (const mrpt::utils::CConfigFileBase &configSource, const std::string &iniSection)
 Loads specific configuration for the device from a given source of configuration parameters, for example, an ".ini" file, loading from the section "[iniSection]" (see utils::CConfigFileBase and derived classes) See hwdrivers::CGPSInterface for the possible parameters.
bool isGPS_connected ()
 Returns true if communications work.
bool isGPS_signalAcquired ()
 Returns true if the last message from the GPS indicates that the signal from sats has been acquired.
void setSerialPortName (const std::string &COM_port)
 Set the serial port to use (COM1, ttyUSB0, etc).
std::string getSerialPortName () const
 Get the serial port to use (COM1, ttyUSB0, etc).

Protected Member Functions

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

Protected Attributes

CSerialPortm_COM
poses::CPoint3D m_sensorPose
std::string m_sensorLabel
std::string m_customInit

Private Member Functions

bool tryToOpenTheCOM ()
 Returns true if the COM port is already open, or try to open it in other case.
void processBuffer ()
 Process data in "m_buffer" to extract GPS messages, and remove them from the buffer.
void processGPSstring (const std::string &s)
 Process a complete string from the GPS:.
void getNextToken (const std::string &str, std::string &token, unsigned int &parserPos)
 Tokenize a string "str" into commas separated tokens.

Private Attributes

std::string m_COMname
int m_COMbauds
bool m_GPS_comsWork
bool m_GPS_signalAcquired
int m_BUFFER_LENGTH
char * m_buffer
size_t m_bufferLength
size_t m_bufferWritePos
mrpt::slam::CObservationGPS m_latestGPS_data


Detailed Description

A parser of NMEA commands, for connecting to a GPS by a serial port.

  PARAMETERS IN THE ".INI"-LIKE CONFIGURATION STRINGS:
 -------------------------------------------------------
   [supplied_section_name]
    COM_port_WIN = COM3
    COM_port_LIN = ttyS0
    baudRate     = 4800   ; The baudrate of the communications (typ. 4800 bauds)
    pose_x       = 0      ; 3D position of the sensed point relative to the robot (meters)
    pose_y       = 0
    pose_z       = 0
    customInit   =

VERSIONS HISTORY: -9/JUN/2006: First version (JLBC) -4/JUN/2008: Added virtual methods for device-specific initialization commands. -10/JUN/2008: Converted into CGenericSensor class (there are no inhirited classes anymore).

Definition at line 70 of file CGPSInterface.h.


Constructor & Destructor Documentation

mrpt::hwdrivers::CGPSInterface::CGPSInterface ( int  BUFFER_LENGTH = 500  ) 

Constructor.

Parameters:
BUFFER_LENGTH The size of the communications buffer (default value should be fine always)

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

Destructor.


Member Function Documentation

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

This method should be called periodically (at least at 1Hz to capture ALL the real-time data) It is thread safe, i.e.

you can call this from one thread, then to other methods from other threads. This method processes data from the GPS and update the object state accordingly.

Implements mrpt::hwdrivers::CGenericSensor.

void mrpt::hwdrivers::CGPSInterface::getNextToken ( const std::string &  str,
std::string &  token,
unsigned int &  parserPos 
) [private]

Tokenize a string "str" into commas separated tokens.

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

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

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

Returns true if communications work.

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

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

void mrpt::hwdrivers::CGPSInterface::loadConfig ( const mrpt::utils::CConfigFileBase configSource,
const std::string &  iniSection 
) [virtual]

Loads specific configuration for the device from a given source of configuration parameters, for example, an ".ini" file, loading from the section "[iniSection]" (see utils::CConfigFileBase and derived classes) See hwdrivers::CGPSInterface for the possible parameters.

Implements mrpt::hwdrivers::CGenericSensor.

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.

void mrpt::hwdrivers::CGPSInterface::processBuffer (  )  [private]

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

void mrpt::hwdrivers::CGPSInterface::processGPSstring ( const std::string &  s  )  [private]

Process a complete string from the GPS:.

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

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

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.


Member Data Documentation

Definition at line 130 of file CGPSInterface.h.

Definition at line 128 of file CGPSInterface.h.

Definition at line 131 of file CGPSInterface.h.

Definition at line 132 of file CGPSInterface.h.

Definition at line 116 of file CGPSInterface.h.

Definition at line 125 of file CGPSInterface.h.

Definition at line 124 of file CGPSInterface.h.

Definition at line 121 of file CGPSInterface.h.

Definition at line 126 of file CGPSInterface.h.

Definition at line 127 of file CGPSInterface.h.

Definition at line 156 of file CGPSInterface.h.

Definition at line 120 of file CGPSInterface.h.

Definition at line 118 of file CGPSInterface.h.




Page generated by Doxygen 1.5.9 for MRPT 0.7.1 SVN: at Mon Aug 17 22:27:43 EDT 2009