DUNE: Uniform Navigational Environment  2016.05.0
Sensors::GPS::Task Struct Reference

Public Member Functions

 Task (const std::string &name, Tasks::Context &ctx)
 
void onResourceAcquisition (void)
 
bool openSocket (void)
 
void onResourceRelease (void)
 
void onResourceInitialization (void)
 
void consume (const IMC::DevDataText *msg)
 
void consume (const IMC::IoEvent *msg)
 
void clearMessages (void)
 
bool waitInitReply (const std::string &stn)
 
bool readTime (const std::string &str, float &dst)
 
bool readLatitude (const std::string &str, const std::string &h, double &dst)
 
double readLongitude (const std::string &str, const std::string &h, double &dst)
 
template<typename T >
bool readDecimal (const std::string &str, T &dst)
 
template<typename T >
bool readNumber (const std::string &str, T &dst)
 
void processSentence (const std::string &line)
 
void interpretSentence (std::vector< std::string > &parts)
 
void interpretGPZDA (const std::vector< std::string > &parts)
 
void interpretGPGGA (const std::vector< std::string > &parts)
 
void interpretPUBX00 (const std::vector< std::string > &parts)
 
void interpretGPVTG (const std::vector< std::string > &parts)
 
void interpretGPHDT (const std::vector< std::string > &parts)
 
void interpretGPHDM (const std::vector< std::string > &parts)
 
void interpretGPROT (const std::vector< std::string > &parts)
 
void interpretPSATHPR (const std::vector< std::string > &parts)
 
void onMain (void)
 

Public Attributes

IO::Handle * m_handle
 
IMC::GpsFix m_fix
 
IMC::EulerAngles m_euler
 
IMC::AngularVelocity m_agvel
 
Arguments m_args
 
Time::Counter< float > m_wdog
 
bool m_has_agvel
 
bool m_has_euler
 
std::string m_init_line
 
Readerm_reader
 

Constructor & Destructor Documentation

Member Function Documentation

void Sensors::GPS::Task::clearMessages ( void  )
inline

References m_agvel, m_euler, and m_fix.

Referenced by interpretSentence(), and Task().

void Sensors::GPS::Task::consume ( const IMC::DevDataText *  msg)
inline

References m_init_line, and processSentence().

void Sensors::GPS::Task::consume ( const IMC::IoEvent *  msg)
inline
void Sensors::GPS::Task::interpretGPGGA ( const std::vector< std::string > &  parts)
inline

Interpret GPGGA sentence (GPS fix data).

Parameters
[in]partsvector of strings from sentence.

References m_fix, readDecimal(), readLatitude(), readLongitude(), and readNumber().

Referenced by interpretSentence().

void Sensors::GPS::Task::interpretGPHDM ( const std::vector< std::string > &  parts)
inline

Interpret GPHDM sentence (Magnetic heading of the vessel derived from the true heading calculated).

Parameters
[in]partsvector of strings from sentence.

References m_euler, m_has_euler, and readNumber().

Referenced by interpretSentence().

void Sensors::GPS::Task::interpretGPHDT ( const std::vector< std::string > &  parts)
inline

Interpret GPVTG sentence (true heading).

Parameters
[in]partsvector of strings from sentence.

References m_euler, and readNumber().

Referenced by interpretSentence().

void Sensors::GPS::Task::interpretGPROT ( const std::vector< std::string > &  parts)
inline

Interpret GPROT sentence (rate of turn).

Parameters
[in]partsvector of strings from sentence.

References m_agvel, m_has_agvel, and readNumber().

Referenced by interpretSentence().

void Sensors::GPS::Task::interpretGPVTG ( const std::vector< std::string > &  parts)
inline

Interpret GPVTG sentence (course over ground).

Parameters
[in]partsvector of strings from sentence.

References m_fix, and readNumber().

Referenced by interpretSentence().

void Sensors::GPS::Task::interpretGPZDA ( const std::vector< std::string > &  parts)
inline

Interpret GPZDA sentence (UTC date and time).

Parameters
[in]partsvector of strings from sentence.

References m_fix, readDecimal(), and readTime().

Referenced by interpretSentence().

void Sensors::GPS::Task::interpretPSATHPR ( const std::vector< std::string > &  parts)
inline

Interpret PSATHPR sentence (Proprietary NMEA message that provides the heading, pitch, roll, and time in a single message).

Parameters
[in]partsvector of strings from sentence.

References m_euler, m_has_euler, and readNumber().

Referenced by interpretSentence().

void Sensors::GPS::Task::interpretPUBX00 ( const std::vector< std::string > &  parts)
inline

Interpret PUBX00 sentence (navstar position).

Parameters
[in]partsvector of strings from sentence.

References m_fix, readDecimal(), readLatitude(), readLongitude(), and readNumber().

Referenced by interpretSentence().

void Sensors::GPS::Task::interpretSentence ( std::vector< std::string > &  parts)
inline
void Sensors::GPS::Task::onMain ( void  )
inline

References m_wdog.

void Sensors::GPS::Task::onResourceAcquisition ( void  )
inline
void Sensors::GPS::Task::onResourceInitialization ( void  )
inline
void Sensors::GPS::Task::onResourceRelease ( void  )
inline

References m_handle, and m_reader.

bool Sensors::GPS::Task::openSocket ( void  )
inline
void Sensors::GPS::Task::processSentence ( const std::string &  line)
inline

Process sentence.

Parameters
[in]lineline.

References interpretSentence(), m_args, and Sensors::GPS::Arguments::stn_order.

Referenced by consume().

template<typename T >
bool Sensors::GPS::Task::readDecimal ( const std::string &  str,
T &  dst 
)
inline

Read decimal from input string.

Parameters
[in]strinput string.
[out]dstdecimal.
Returns
true if successful, false otherwise.

Referenced by interpretGPGGA(), interpretGPZDA(), and interpretPUBX00().

bool Sensors::GPS::Task::readLatitude ( const std::string &  str,
const std::string &  h,
double &  dst 
)
inline

Read latitude from string.

Parameters
[in]strinput string.
[in]heither North (N) or South (S).
[out]dstlatitude.
Returns
true if successful, false otherwise.

Referenced by interpretGPGGA(), and interpretPUBX00().

double Sensors::GPS::Task::readLongitude ( const std::string &  str,
const std::string &  h,
double &  dst 
)
inline

Read longitude from string.

Parameters
[in]strinput string.
[in]heither West (W) or East (E).
[out]dstlongitude.
Returns
true if successful, false otherwise.

Referenced by interpretGPGGA(), and interpretPUBX00().

template<typename T >
bool Sensors::GPS::Task::readNumber ( const std::string &  str,
T &  dst 
)
inline

Read number from input string.

Parameters
[in]strinput string.
[out]dstnumber.
Returns
true if successful, false otherwise.

Referenced by interpretGPGGA(), interpretGPHDM(), interpretGPHDT(), interpretGPROT(), interpretGPVTG(), interpretPSATHPR(), and interpretPUBX00().

bool Sensors::GPS::Task::readTime ( const std::string &  str,
float &  dst 
)
inline

Read time from string.

Parameters
[in]strstring.
[out]dsttime.
Returns
true if successful, false otherwise.

Referenced by interpretGPZDA().

bool Sensors::GPS::Task::waitInitReply ( const std::string &  stn)
inline

Wait reply to initialization command.

Parameters
[in]stnstring to compare.
Returns
true on successful match, false otherwise.

References m_init_line.

Referenced by onResourceInitialization().

Member Data Documentation

IMC::AngularVelocity Sensors::GPS::Task::m_agvel

Angular velocity message.

Referenced by clearMessages(), interpretGPROT(), and interpretSentence().

IMC::EulerAngles Sensors::GPS::Task::m_euler
IMC::GpsFix Sensors::GPS::Task::m_fix
IO::Handle* Sensors::GPS::Task::m_handle
bool Sensors::GPS::Task::m_has_agvel

True if we have angular velocity.

Referenced by interpretGPROT(), and interpretSentence().

bool Sensors::GPS::Task::m_has_euler

True if we have euler angles.

Referenced by interpretGPHDM(), interpretPSATHPR(), and interpretSentence().

std::string Sensors::GPS::Task::m_init_line

Last initialization line read.

Referenced by consume(), and waitInitReply().

Reader* Sensors::GPS::Task::m_reader

Reader thread.

Referenced by onResourceAcquisition(), and onResourceRelease().

Time::Counter<float> Sensors::GPS::Task::m_wdog

Input watchdog.

Referenced by interpretSentence(), onMain(), and onResourceInitialization().

Collaboration diagram for Sensors::GPS::Task:
Collaboration graph