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

Public Member Functions

 Task (const std::string &name, Tasks::Context &ctx)
 
 ~Task (void)
 
void clear (void)
 
void onResourceAcquisition (void)
 
void onResourceRelease (void)
 
void onResourceInitialization (void)
 
bool waitReply (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 (char *line, int line_len)
 
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

SerialPort * m_uart
 
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
 

Constructor & Destructor Documentation

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

References onResourceRelease().

Member Function Documentation

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

References m_agvel, m_euler, and m_fix.

Referenced by interpretSentence(), and Task().

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_uart, m_wdog, and processSentence().

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

References m_uart.

Referenced by ~Task().

void Sensors::GPS::Task::processSentence ( char *  line,
int  line_len 
)
inline

Process sentence.

Parameters
[in]linepointer to sentence.
[in]line_lenlength of sentence.

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

Referenced by onMain().

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::waitReply ( const std::string &  stn)
inline

Wait reply.

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

References m_uart.

Referenced by onResourceInitialization().

Member Data Documentation

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

Angular velocity message.

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

IMC::EulerAngles Sensors::GPS::Task::m_euler

Euler angles message.

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

IMC::GpsFix Sensors::GPS::Task::m_fix
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().

SerialPort* Sensors::GPS::Task::m_uart
Time::Counter<float> Sensors::GPS::Task::m_wdog

Input watchdog.

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

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