You can subscribe to this list here.
| 2008 |
Jan
|
Feb
(58) |
Mar
(15) |
Apr
(23) |
May
(8) |
Jun
(92) |
Jul
(66) |
Aug
(6) |
Sep
(9) |
Oct
(44) |
Nov
(8) |
Dec
(1) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2009 |
Jan
(10) |
Feb
(8) |
Mar
(2) |
Apr
(8) |
May
(19) |
Jun
(11) |
Jul
(8) |
Aug
(6) |
Sep
(5) |
Oct
(4) |
Nov
(26) |
Dec
(4) |
| 2010 |
Jan
(5) |
Feb
(3) |
Mar
(4) |
Apr
(3) |
May
(4) |
Jun
|
Jul
(1) |
Aug
(16) |
Sep
(7) |
Oct
(3) |
Nov
(7) |
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <rus...@us...> - 2008-06-05 05:31:03
|
Revision: 157
http://gearbox.svn.sourceforge.net/gearbox/?rev=157&view=rev
Author: russo2503v
Date: 2008-06-04 22:31:00 -0700 (Wed, 04 Jun 2008)
Log Message:
-----------
added more fields to test output. improved docco
Modified Paths:
--------------
gearbox/trunk/submitted/gbxgarminacfr/doc.dox
gearbox/trunk/submitted/gbxgarminacfr/driver.cpp
gearbox/trunk/submitted/gbxgarminacfr/test/example.readme
gearbox/trunk/submitted/gbxgarminacfr/test/test.cpp
Modified: gearbox/trunk/submitted/gbxgarminacfr/doc.dox
===================================================================
--- gearbox/trunk/submitted/gbxgarminacfr/doc.dox 2008-06-04 14:15:46 UTC (rev 156)
+++ gearbox/trunk/submitted/gbxgarminacfr/doc.dox 2008-06-05 05:31:00 UTC (rev 157)
@@ -24,9 +24,6 @@
#include <gbxgarminacfr/driver.h>
@endverbatim
-@par Example
- See test/test.cpp
-
@par Style
See http://orca-robotics.sourceforge.net/orca/orca_doc_style.html
@@ -46,6 +43,17 @@
- @ref gbx_library_gbxserialacfr
+@par Example
+
+See test/test.cpp and test/example.readme on how to compile the test program.
+
+To run the test program (assuming the GPS device is connected to /dev/ttyS0) :
+@verbatim
+$ gbxgarminacfrtest -p /dev/ttyS0
+@endverbatim
+
+The test program reports back all messages received from the driver and prints out a few data fields for each message. When the fix type is reported as 0 ("Invalid"), only the number of satellites and the time stamp are meaningful.
+
@section gbx_library_gbxgarminacfr What is EPE?
Bits of information assembled by Duncan Mercer.
Modified: gearbox/trunk/submitted/gbxgarminacfr/driver.cpp
===================================================================
--- gearbox/trunk/submitted/gbxgarminacfr/driver.cpp 2008-06-04 14:15:46 UTC (rev 156)
+++ gearbox/trunk/submitted/gbxgarminacfr/driver.cpp 2008-06-05 05:31:00 UTC (rev 157)
@@ -42,6 +42,9 @@
sscanf(msg.getDataToken(UTC).c_str(),"%02d%02d%lf",
&data->utcTimeHrs, &data->utcTimeMin, &data->utcTimeSec );
+ //number of satellites in use
+ data->satellites = atoi(msg.getDataToken(NSatsUsed).c_str());
+
// fix type
switch ( msg.getDataToken(FixType)[0] )
{
@@ -51,7 +54,6 @@
data->latitude = 0.0;
data->longitude = 0.0;
data->altitude = 0.0;
- data->satellites = 0;
data->geoidalSeparation = 0.0;
return data;
case '1':
@@ -76,9 +78,6 @@
dir = (*msg.getDataToken(LonDir).c_str()=='E') ? 1.0 : -1.0;
data->longitude=dir*(deg+(min/60.0));
- //number of satellites in use
- data->satellites = atoi(msg.getDataToken(NSatsUsed).c_str());
-
//altitude
data->altitude=atof(msg.getDataToken(Hgt).c_str());
Modified: gearbox/trunk/submitted/gbxgarminacfr/test/example.readme
===================================================================
--- gearbox/trunk/submitted/gbxgarminacfr/test/example.readme 2008-06-04 14:15:46 UTC (rev 156)
+++ gearbox/trunk/submitted/gbxgarminacfr/test/example.readme 2008-06-05 05:31:00 UTC (rev 157)
@@ -10,3 +10,5 @@
$ mkdir gbxgarminacfr_example
$ cd gbxgarminacfr_example
$ ccmake /usr/local/share/gearbox/gbxgarminacfr
+
+For more information, see driver documentation.
Modified: gearbox/trunk/submitted/gbxgarminacfr/test/test.cpp
===================================================================
--- gearbox/trunk/submitted/gbxgarminacfr/test/test.cpp 2008-06-04 14:15:46 UTC (rev 156)
+++ gearbox/trunk/submitted/gbxgarminacfr/test/test.cpp 2008-06-05 05:31:00 UTC (rev 157)
@@ -93,23 +93,29 @@
case gbxgarminacfr::GpGga :
{
gbxgarminacfr::GgaData* d = (gbxgarminacfr::GgaData*)data.get();
- cout<<"GPGGA: fix type="<<d->fixType<<endl;
+ cout<<"GPGGA:"<<endl
+ <<" satellites = "<<d->satellites<<endl
+ <<" fix type = "<<d->fixType<<endl
+ <<" longitude = "<<d->longitude<<endl
+ <<" latitude = "<<d->latitude<<endl;
break;
}
case gbxgarminacfr::GpVtg :
{
gbxgarminacfr::VtgData* d = (gbxgarminacfr::VtgData*)data.get();
- cout<<"GPVTG: speed="<<d->speed<<endl;
+ cout<<"GPVTG:"<<endl
+ <<" speed = "<<d->speed<<endl;
break;
}
case gbxgarminacfr::PgRme :
{
gbxgarminacfr::RmeData* d = (gbxgarminacfr::RmeData*)data.get();
- cout<<"PGRME: herror="<<d->horizontalPositionError<<endl;
+ cout<<"PGRME:"<<endl
+ <<" horiz error = "<<d->horizontalPositionError<<endl;
break;
}
default :
- cout<<"?????"<<endl;
+ cout<<"Unknown message"<<endl;
}
// no need to delete the data object, the auto pointer will delete it automatically
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rus...@us...> - 2008-06-04 14:16:12
|
Revision: 156
http://gearbox.svn.sourceforge.net/gearbox/?rev=156&view=rev
Author: russo2503v
Date: 2008-06-04 07:15:46 -0700 (Wed, 04 Jun 2008)
Log Message:
-----------
cosmetic
Modified Paths:
--------------
gearbox/trunk/submitted/gbxgarminacfr/driver.cpp
gearbox/trunk/submitted/gbxgarminacfr/nmea.h
Modified: gearbox/trunk/submitted/gbxgarminacfr/driver.cpp
===================================================================
--- gearbox/trunk/submitted/gbxgarminacfr/driver.cpp 2008-06-04 13:26:14 UTC (rev 155)
+++ gearbox/trunk/submitted/gbxgarminacfr/driver.cpp 2008-06-04 14:15:46 UTC (rev 156)
@@ -53,7 +53,6 @@
data->altitude = 0.0;
data->satellites = 0;
data->geoidalSeparation = 0.0;
-cout<<"DEBUG: invalid fix, lat="<<data->latitude<<endl;
return data;
case '1':
data->fixType = Autonomous;
Modified: gearbox/trunk/submitted/gbxgarminacfr/nmea.h
===================================================================
--- gearbox/trunk/submitted/gbxgarminacfr/nmea.h 2008-06-04 13:26:14 UTC (rev 155)
+++ gearbox/trunk/submitted/gbxgarminacfr/nmea.h 2008-06-04 14:15:46 UTC (rev 156)
@@ -8,16 +8,12 @@
*
*/
-#include <vector>
-#include <string>
-
-// #include <hydroportability/sharedlib.h>
-
#ifndef GBXGPSUTILACFR_NMEA_H
#define GBXGPSUTILACFR_NMEA_H
+#include <vector>
+#include <string>
-
/*
for further info:
@@ -51,12 +47,14 @@
class NmeaException : public std::exception
{
public:
-
NmeaException(const char *message)
: message_(message) {}
+
NmeaException(const std::string &message)
: message_(message) {}
+
virtual ~NmeaException() throw() {}
+
virtual const char* what() const throw() { return message_.c_str(); }
protected:
@@ -68,36 +66,48 @@
// When using class to send data, need to add checksum, when reciving data need to test checksum
// Checksums are usually optional
-enum{TestChecksum, AddChecksum, DontTestOrAddChecksum};
+enum NmeaMessageOptions
+{
+ TestChecksum,
+ AddChecksum,
+ DontTestOrAddChecksum
+};
// class SOEXPORT NmeaMessage{
class NmeaMessage
{
public:
NmeaMessage();
- NmeaMessage(const char *sentence, int testCheckSum = DontTestOrAddChecksum);
+ NmeaMessage(const char *sentence, int testCheckSum=DontTestOrAddChecksum );
// Set up the internal data for a sentence
- void setSentence(const char *data, int testCheckSum = DontTestOrAddChecksum);
+ void setSentence(const char *data, int testCheckSum=DontTestOrAddChecksum );
// Do we only have the raw string ?
bool haveSentence() const { return haveSentence_; };
+
// Have we parsed fields ?
bool haveTokens() const { return haveTokens_; };
+
// have we a valid checksum ?
- bool haveValidChecksum() const { return checkSumOK_; };
+ bool haveValidChecksum() const { return checkSumOK_; };
+
// have we checked the checksum?
- bool haveTestedChecksum()const { return haveCheckSum_; };
+ bool haveTestedChecksum()const { return haveCheckSum_; };
+
// calculate the checksum from sentence
// Note that this function may throw NMEA_Exception...
bool testChecksumOk();
+
// Return the raw sentence string
const char * sentence() { return sentence_; };
+
// Return a single data token as a string
std::string& getDataToken(int i) { return dataTokens_[i]; };
// Return the number of fields
int numDataTokens() const { return dataTokens_.size(); };
+
//Tokenise the string that we received
void parseTokens();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rus...@us...> - 2008-06-04 13:26:07
|
Revision: 155
http://gearbox.svn.sourceforge.net/gearbox/?rev=155&view=rev
Author: russo2503v
Date: 2008-06-04 06:26:14 -0700 (Wed, 04 Jun 2008)
Log Message:
-----------
removed climbRate field
Modified Paths:
--------------
gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/gbxiceutilacfr.h
gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/CMakeLists.txt
gearbox/trunk/submitted/gbxgarminacfr/driver.cpp
gearbox/trunk/submitted/gbxgarminacfr/driver.h
Removed Paths:
-------------
gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/subsystemthread.cpp
gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/subsystemthread.h
gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/subsystemthreadtest.cpp
Modified: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/gbxiceutilacfr.h
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/gbxiceutilacfr.h 2008-06-04 05:37:33 UTC (rev 154)
+++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/gbxiceutilacfr.h 2008-06-04 13:26:14 UTC (rev 155)
@@ -15,7 +15,7 @@
#ifndef GBXICEUTILACFR_GBXICEUTILACFRL_H
#define GBXICEUTILACFR_GBXICEUTILACFRL_H
-#include <gbxsickacfr/gbxiceutilacfr/subsystemthread.h>
+#include <gbxsickacfr/gbxiceutilacfr/safethread.h>
#include <gbxsickacfr/gbxiceutilacfr/timer.h>
#include <gbxsickacfr/gbxiceutilacfr/buffer.h>
#include <gbxsickacfr/gbxiceutilacfr/store.h>
Deleted: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/subsystemthread.cpp
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/subsystemthread.cpp 2008-06-04 05:37:33 UTC (rev 154)
+++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/subsystemthread.cpp 2008-06-04 13:26:14 UTC (rev 155)
@@ -1,71 +0,0 @@
-/*
- * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
- * http://gearbox.sf.net/
- * Copyright (c) 2004-2008 Alex Brooks, Alexei Makarenko, Tobias Kaupp
- *
- * This distribution is licensed to you under the terms described in
- * the LICENSE file included in this distribution.
- *
- */
-
-#include <iostream>
-#include <sstream>
-
-#include "subsystemthread.h"
-
-using namespace gbxiceutilacfr;
-using namespace std;
-
-
-SubsystemThread::SubsystemThread( gbxutilacfr::Tracer& tracer, gbxutilacfr::Status& status, const std::string& subsysName ) :
- tracer_(tracer),
- subStatus_( status, subsysName )
-{
-}
-
-void
-SubsystemThread::run()
-{
- stringstream ss;
- try
- {
- walk();
- }
- catch ( const IceUtil::Exception &e )
- {
- ss << "SubsystemThread::run() "<<subsysName()<<": Caught unexpected exception: " << e;
- }
- catch ( const std::exception &e )
- {
- ss << "SubsystemThread::run() "<<subsysName()<<": Caught unexpected exception: " << e.what();
- }
- catch ( const std::string &e )
- {
- ss << "SubsystemThread::run() "<<subsysName()<<": Caught unexpected string: " << e;
- }
- catch ( const char *e )
- {
- ss << "SubsystemThread::run() "<<subsysName()<<": Caught unexpected char *: " << e;
- }
- catch ( ... )
- {
- ss << "SubsystemThread::run() "<<subsysName()<<": Caught unexpected unknown exception.";
- }
-
- // report status fault if there was an exception and we are not stopping
- if ( !ss.str().empty() ) {
- if ( !isStopping() ) {
- tracer_.error( ss.str() );
- subStatus().fault( ss.str() );
- }
- else {
- tracer_.warning( subsysName()+": Caught exception when stopping: "+ss.str() );
- }
- }
- else {
- tracer_.debug( subsysName()+": dropping out from run() ", 4 );
- }
-
- // wait for somebody to realize that we are quitting and tell us to stop.
- waitForStop();
-}
Deleted: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/subsystemthread.h
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/subsystemthread.h 2008-06-04 05:37:33 UTC (rev 154)
+++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/subsystemthread.h 2008-06-04 13:26:14 UTC (rev 155)
@@ -1,76 +0,0 @@
-/*
- * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
- * http://gearbox.sf.net/
- * Copyright (c) 2004-2008 Alex Brooks, Alexei Makarenko, Tobias Kaupp
- *
- * This distribution is licensed to you under the terms described in
- * the LICENSE file included in this distribution.
- *
- */
-
-#ifndef GBXICEUTILACFR_SUBSYSTEM_THREAD_H
-#define GBXICEUTILACFR_SUBSYSTEM_THREAD_H
-
-#include <gbxsickacfr/gbxiceutilacfr/thread.h>
-#include <gbxutilacfr/substatus.h>
-#include <gbxutilacfr/status.h>
-#include <gbxutilacfr/tracer.h>
-
-namespace gbxiceutilacfr {
-
-/*!
-@brief A version of the Thread class which catches all possible exceptions and integrates some Status operations.
-
-If an exception is caught when the thread is not stopping, a status fault is issued.
-Then the thread will wait for someone to call stop().
-
-To use this class, simply implement the pure virtual walk() function.
-@verbatim
-void MyThread::walk()
-{
- // initialize
-
- // main loop
- while ( !isStopping() )
- {
- // do something
- }
-
- // clean up
-}
-@endverbatim
-
-@see Thread, SafeThread.
- */
-class SubsystemThread : public Thread
-{
-public:
- //! Supply an optional Tracer and Status. The optional @c subsysName is used in reporting status changes
- //! as the subsystem name.
- SubsystemThread( gbxutilacfr::Tracer& tracer, gbxutilacfr::Status& status, const std::string& subsysName="SubsystemThread" );
-
- // from IceUtil::Thread
- //! This implementation calls walk(), catches all possible exceptions, prints out
- //! errors and waits for someone to call stop().
- virtual void run();
-
- //! Implement this function in the derived class and put here all the stuff which your
- //! thread needs to do.
- virtual void walk()=0;
-
- //! Access to subsystem status.
- gbxutilacfr::SubStatus& subStatus() { return subStatus_; };
-
- //! Returns subsystem name assigned to this thread.
- std::string subsysName() const { return subStatus_.name(); };
-
-private:
- gbxutilacfr::Tracer& tracer_;
- gbxutilacfr::SubStatus subStatus_;
-};
-//! A smart pointer to the SubsystemThread class.
-typedef IceUtil::Handle<SubsystemThread> SubsystemThreadPtr;
-
-} // end namespace
-
-#endif
Modified: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/CMakeLists.txt
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/CMakeLists.txt 2008-06-04 05:37:33 UTC (rev 154)
+++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/CMakeLists.txt 2008-06-04 13:26:14 UTC (rev 155)
@@ -16,6 +16,3 @@
ADD_EXECUTABLE( safethreadtest safethreadtest.cpp )
GBX_ADD_TEST( GbxIceUtilAcfrSafeThreadTest safethreadtest )
-
-ADD_EXECUTABLE( subsystemthreadtest subsystemthreadtest.cpp )
-GBX_ADD_TEST( GbxIceUtilAcfrSubsystemThreadTest subsystemthreadtest )
Deleted: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/subsystemthreadtest.cpp
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/subsystemthreadtest.cpp 2008-06-04 05:37:33 UTC (rev 154)
+++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/subsystemthreadtest.cpp 2008-06-04 13:26:14 UTC (rev 155)
@@ -1,106 +0,0 @@
-/*
- * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
- * http://gearbox.sf.net/
- * Copyright (c) 2004-2008 Alex Brooks, Alexei Makarenko, Tobias Kaupp
- *
- * This distribution is licensed to you under the terms described in
- * the LICENSE file included in this distribution.
- *
- */
-
-#include <iostream>
-
-#include <IceUtil/Time.h>
-
-#include <gbxsickacfr/gbxiceutilacfr/subsystemthread.h>
-#include <gbxutilacfr/trivialtracer.h>
-#include <gbxutilacfr/trivialstatus.h>
-
-using namespace std;
-
-class TestThread : public gbxiceutilacfr::SubsystemThread
-{
-public:
- // it's safe to pass zero pointers
- TestThread( gbxutilacfr::Tracer& tracer, gbxutilacfr::Status& status ) :
- SubsystemThread( tracer, status ) {};
- virtual void walk()
- {
- while ( !isStopping() ) {
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(50));
- }
- };
-};
-
-class TestThreadWithThrow : public gbxiceutilacfr::SubsystemThread
-{
-public:
- // it's safe to pass zero pointers
- TestThreadWithThrow( gbxutilacfr::Tracer& tracer, gbxutilacfr::Status& status ) :
- SubsystemThread( tracer, status ) {};
- virtual void walk()
- {
- throw "throwing from walk";
- };
-};
-
-class TestThreadWithTools : public gbxiceutilacfr::SubsystemThread
-{
-public:
- TestThreadWithTools( gbxutilacfr::Tracer& tracer, gbxutilacfr::Status& status ) :
- SubsystemThread( tracer, status, "MyName" )
- {
- };
- virtual void walk()
- {
- throw "throwing from walk";
- };
-};
-
-int main(int argc, char * argv[])
-{
- gbxutilacfr::TrivialTracer tracer;
- gbxutilacfr::TrivialStatus status( tracer );
-
- cout<<"testing start() and stop()... ";
- {
- gbxiceutilacfr::Thread* t=0;
- try
- {
- t = new TestThread( tracer, status );
- t->start();
- }
- catch (...)
- {
- cout<<"failed"<<endl<<"should be able to create thread"<<endl;
- exit(EXIT_FAILURE);
- }
- IceUtil::ThreadControl tc = t->getThreadControl();
- t->stop();
- tc.join();
- // do not delete t! it's already self-destructed.
- }
- cout<<"ok"<<endl;
-
- cout<<"testing SubsystemThread() with exceptions... ";
- {
- gbxiceutilacfr::Thread* t=0;
- try
- {
- t = new TestThreadWithThrow( tracer, status );
- t->start();
- }
- catch (...)
- {
- cout<<"failed"<<endl<<"all exception should've been caught."<<endl;
- // ok
- }
- IceUtil::ThreadControl tc = t->getThreadControl();
- t->stop();
- tc.join();
- // do not delete t! it's already self-destructed.
- }
- cout<<"ok"<<endl;
-
- return EXIT_SUCCESS;
-}
Modified: gearbox/trunk/submitted/gbxgarminacfr/driver.cpp
===================================================================
--- gearbox/trunk/submitted/gbxgarminacfr/driver.cpp 2008-06-04 05:37:33 UTC (rev 154)
+++ gearbox/trunk/submitted/gbxgarminacfr/driver.cpp 2008-06-04 13:26:14 UTC (rev 155)
@@ -107,7 +107,6 @@
data->headingTrue=0.0;
data->headingMagnetic=0.0;
data->speed=0.0;
- data->climbRate=0.0;
// NOTE: not processing the rest!
return data;
}
@@ -126,9 +125,6 @@
data->speed=atof(msg.getDataToken(SpeedKPH).c_str());
data->speed*=(1000/3600.0);
- //set to zero
- data->climbRate=0.0;
-
return data;
}
@@ -149,6 +145,7 @@
data->horizontalPositionError = atof(msg.getDataToken(HError).c_str());
data->verticalPositionError = atof(msg.getDataToken(VError).c_str());
+ data->estimatedPositionError = atof(msg.getDataToken(EPE).c_str());
return data;
}
Modified: gearbox/trunk/submitted/gbxgarminacfr/driver.h
===================================================================
--- gearbox/trunk/submitted/gbxgarminacfr/driver.h 2008-06-04 05:37:33 UTC (rev 154)
+++ gearbox/trunk/submitted/gbxgarminacfr/driver.h 2008-06-04 13:26:14 UTC (rev 155)
@@ -144,12 +144,8 @@
double headingMagnetic;
//! Horizontal velocity [metres/second]
double speed;
- //! Vertical velocity [metres/second]
- double climbRate;
};
- enum VTGTokens{MsgType=0,HError,M1,VError,M2,EPE,M3};
-
//! Gps data structure
class RmeData : public GenericData
{
@@ -167,6 +163,9 @@
double horizontalPositionError;
//! Vertical position error: one standard deviation [metres]
double verticalPositionError;
+
+ //! Estimated position error.
+ double estimatedPositionError;
};
/*!
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rus...@us...> - 2008-06-04 05:37:27
|
Revision: 154
http://gearbox.svn.sourceforge.net/gearbox/?rev=154&view=rev
Author: russo2503v
Date: 2008-06-03 22:37:33 -0700 (Tue, 03 Jun 2008)
Log Message:
-----------
promoted gbxutilacfr to the top level of src
Modified Paths:
--------------
gearbox/trunk/src/CMakeLists.txt
gearbox/trunk/src/gbxsickacfr/CMakeLists.txt
gearbox/trunk/src/gbxsickacfr/driver.cpp
gearbox/trunk/src/gbxsickacfr/driver.h
gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/buffer.h
gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/notify.h
gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/safethread.cpp
gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/safethread.h
gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/store.h
gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/subsystemthread.cpp
gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/subsystemthread.h
gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/buffertest.cpp
gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/notifytest.cpp
gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/safethreadtest.cpp
gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/storetest.cpp
gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/subsystemthreadtest.cpp
gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/threadtest.cpp
gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/thread.cpp
gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/thread.h
gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/timer.cpp
gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/timer.h
gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.h
gearbox/trunk/src/gbxsickacfr/messages.cpp
gearbox/trunk/src/gbxsickacfr/test/test.cpp
gearbox/trunk/src/gbxutilacfr/CMakeLists.txt
gearbox/trunk/src/gbxutilacfr/exceptions.cpp
gearbox/trunk/src/gbxutilacfr/exceptions.h
gearbox/trunk/src/gbxutilacfr/gbxutilacfr.h
gearbox/trunk/src/gbxutilacfr/status.h
gearbox/trunk/src/gbxutilacfr/substatus.h
gearbox/trunk/src/gbxutilacfr/test/mathtest.cpp
gearbox/trunk/src/gbxutilacfr/tokenise.cpp
gearbox/trunk/src/gbxutilacfr/tokenise.h
gearbox/trunk/src/gbxutilacfr/tracer.h
gearbox/trunk/src/gbxutilacfr/trivialstatus.cpp
gearbox/trunk/src/gbxutilacfr/trivialstatus.h
gearbox/trunk/src/gbxutilacfr/trivialtracer.cpp
gearbox/trunk/src/gbxutilacfr/trivialtracer.h
gearbox/trunk/submitted/gbxgarminacfr/driver.cpp
gearbox/trunk/submitted/gbxgarminacfr/driver.h
gearbox/trunk/submitted/gbxgarminacfr/nmea.cpp
gearbox/trunk/submitted/gbxgarminacfr/test/test.cpp
Added Paths:
-----------
gearbox/trunk/src/gbxutilacfr/
gearbox/trunk/src/gbxutilacfr/doc.dox
Removed Paths:
-------------
gearbox/trunk/src/gbxsickacfr/gbxutilacfr/
Modified: gearbox/trunk/src/CMakeLists.txt
===================================================================
--- gearbox/trunk/src/CMakeLists.txt 2008-06-04 02:02:30 UTC (rev 153)
+++ gearbox/trunk/src/CMakeLists.txt 2008-06-04 05:37:33 UTC (rev 154)
@@ -8,5 +8,6 @@
ADD_SUBDIRECTORY( basicexample )
ADD_SUBDIRECTORY( gbxadvancedexample )
ADD_SUBDIRECTORY( gbxserialacfr )
+ADD_SUBDIRECTORY( gbxutilacfr )
ADD_SUBDIRECTORY( gbxsickacfr )
ADD_SUBDIRECTORY( urg_nz )
Modified: gearbox/trunk/src/gbxsickacfr/CMakeLists.txt
===================================================================
--- gearbox/trunk/src/gbxsickacfr/CMakeLists.txt 2008-06-04 02:02:30 UTC (rev 153)
+++ gearbox/trunk/src/gbxsickacfr/CMakeLists.txt 2008-06-04 05:37:33 UTC (rev 154)
@@ -8,15 +8,14 @@
INCLUDE( ${GBX_CMAKE_DIR}/FindIceUtil.cmake )
GBX_REQUIRE_VAR( build LIB ${lib_name} ICEUTIL_FOUND "libIceUtil not found" )
-SET( proj_libs GbxSerialAcfr )
-GBX_REQUIRE_TARGETS( build LIB ${lib_name} ${proj_libs} )
+SET( int_libs GbxUtilAcfr GbxSerialAcfr )
+GBX_REQUIRE_TARGETS( build LIB ${lib_name} ${int_libs} )
# these are built internally
-SET( int_libs GbxUtilAcfr GbxIceUtilAcfr GbxSerialDeviceAcfr )
+SET( private_libs GbxIceUtilAcfr GbxSerialDeviceAcfr )
IF( build )
- ADD_SUBDIRECTORY( gbxutilacfr )
ADD_SUBDIRECTORY( gbxiceutilacfr )
ADD_SUBDIRECTORY( gbxserialdeviceacfr )
@@ -25,7 +24,7 @@
FILE( GLOB hdrs *.h )
FILE( GLOB srcs *.cpp )
- SET( dep_libs ${proj_libs} ${int_libs} )
+ SET( dep_libs ${int_libs} ${private_libs} )
GBX_ADD_LIBRARY( ${lib_name} SHARED ${srcs} )
TARGET_LINK_LIBRARIES( ${lib_name} ${dep_libs} )
Modified: gearbox/trunk/src/gbxsickacfr/driver.cpp
===================================================================
--- gearbox/trunk/src/gbxsickacfr/driver.cpp 2008-06-04 02:02:30 UTC (rev 153)
+++ gearbox/trunk/src/gbxsickacfr/driver.cpp 2008-06-04 05:37:33 UTC (rev 154)
@@ -11,7 +11,7 @@
#include <iostream>
#include <cstring>
-#include <gbxsickacfr/gbxutilacfr/gbxutilacfr.h>
+#include <gbxutilacfr/gbxutilacfr.h>
#include <gbxsickacfr/gbxiceutilacfr/gbxiceutilacfr.h>
#include "driver.h"
Modified: gearbox/trunk/src/gbxsickacfr/driver.h
===================================================================
--- gearbox/trunk/src/gbxsickacfr/driver.h 2008-06-04 02:02:30 UTC (rev 153)
+++ gearbox/trunk/src/gbxsickacfr/driver.h 2008-06-04 05:37:33 UTC (rev 154)
@@ -12,8 +12,8 @@
#define GBX_SICK_ACFR_H
#include <gbxsickacfr/serialhandler.h>
-#include <gbxsickacfr/gbxutilacfr/tracer.h>
-#include <gbxsickacfr/gbxutilacfr/status.h>
+#include <gbxutilacfr/tracer.h>
+#include <gbxutilacfr/status.h>
#include <memory>
namespace gbxsickacfr {
Modified: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/buffer.h
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/buffer.h 2008-06-04 02:02:30 UTC (rev 153)
+++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/buffer.h 2008-06-04 05:37:33 UTC (rev 154)
@@ -12,13 +12,12 @@
#define GBXICEUTILACFR_BUFFER_H
#include <queue>
-#include <gbxsickacfr/gbxutilacfr/exceptions.h>
+#include <gbxutilacfr/exceptions.h>
#include <IceUtil/Monitor.h>
#include <IceUtil/Mutex.h>
#include <IceUtil/Time.h>
-namespace gbxsickacfr {
namespace gbxiceutilacfr {
//! %Buffer type defines behavior when the buffer is full
@@ -409,7 +408,6 @@
queue_.push_back( obj );
}
-}
} // end namespace
#endif
Modified: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/notify.h
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/notify.h 2008-06-04 02:02:30 UTC (rev 153)
+++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/notify.h 2008-06-04 05:37:33 UTC (rev 154)
@@ -11,14 +11,13 @@
#ifndef GBXICEUTILACFR_NOTIFY_H
#define GBXICEUTILACFR_NOTIFY_H
-#include <gbxsickacfr/gbxutilacfr/exceptions.h>
+#include <gbxutilacfr/exceptions.h>
#include <iostream>
//
// note: this class can be libGbxUtilAcfr but we keep it with the other "data pattern"
// classes: Store and Buffer.
//
-namespace gbxsickacfr {
namespace gbxiceutilacfr {
/*!
@@ -64,7 +63,7 @@
bool hasNotifyHandler() { return hasNotifyHandler_; };
//! Forwards the @p obj to the data handler.
- //! Raises gbxsickacfr::gbxutilacfr::Exception if the function is called when a notify handler has
+ //! Raises gbxutilacfr::Exception if the function is called when a notify handler has
//! not been set.
void set( const Type & obj );
@@ -96,7 +95,7 @@
void Notify<Type>::set( const Type & obj )
{
if ( !hasNotifyHandler_ ) {
- throw gbxsickacfr::gbxutilacfr::Exception( ERROR_INFO, "setting data when data handler has not been set" );
+ throw gbxutilacfr::Exception( ERROR_INFO, "setting data when data handler has not been set" );
}
internalSet( obj );
@@ -108,7 +107,6 @@
handler_->handleData( obj );
}
-}
} // end namespace
#endif
Modified: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/safethread.cpp
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/safethread.cpp 2008-06-04 02:02:30 UTC (rev 153)
+++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/safethread.cpp 2008-06-04 05:37:33 UTC (rev 154)
@@ -13,11 +13,11 @@
#include "safethread.h"
-using namespace gbxsickacfr::gbxiceutilacfr;
+using namespace gbxiceutilacfr;
using namespace std;
-SafeThread::SafeThread( gbxsickacfr::gbxutilacfr::Tracer& tracer ) :
+SafeThread::SafeThread( gbxutilacfr::Tracer& tracer ) :
tracer_(tracer)
{
}
Modified: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/safethread.h
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/safethread.h 2008-06-04 02:02:30 UTC (rev 153)
+++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/safethread.h 2008-06-04 05:37:33 UTC (rev 154)
@@ -12,9 +12,8 @@
#define GBXICEUTILACFR_SAFE_THREAD_H
#include <gbxsickacfr/gbxiceutilacfr/thread.h>
-#include <gbxsickacfr/gbxutilacfr/tracer.h>
+#include <gbxutilacfr/tracer.h>
-namespace gbxsickacfr {
namespace gbxiceutilacfr {
/*!
@@ -45,7 +44,7 @@
{
public:
//! Needs an implementation of Tracer to report possible exceptions.
- SafeThread( gbxsickacfr::gbxutilacfr::Tracer& tracer );
+ SafeThread( gbxutilacfr::Tracer& tracer );
// from IceUtil::Thread (from which HydroUtil::Thread is derived)
//! This implementation calls walk(), catches all possible exceptions, prints out
@@ -57,12 +56,11 @@
virtual void walk()=0;
private:
- gbxsickacfr::gbxutilacfr::Tracer& tracer_;
+ gbxutilacfr::Tracer& tracer_;
};
//! A smart pointer to the SafeThread class.
typedef IceUtil::Handle<SafeThread> SafeThreadPtr;
-}
} // end namespace
#endif
Modified: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/store.h
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/store.h 2008-06-04 02:02:30 UTC (rev 153)
+++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/store.h 2008-06-04 05:37:33 UTC (rev 154)
@@ -11,13 +11,12 @@
#ifndef GBXICEUTILACFR_STORE_H
#define GBXICEUTILACFR_STORE_H
-#include <gbxsickacfr/gbxutilacfr/exceptions.h>
+#include <gbxutilacfr/exceptions.h>
#include <IceUtil/Monitor.h>
#include <IceUtil/Mutex.h>
#include <IceUtil/Time.h>
-namespace gbxsickacfr {
namespace gbxiceutilacfr {
/*!
@@ -31,7 +30,7 @@
* is non-empty.
*
* Write to it with set(). Read its contents with get(). Trying to read from
- * an empty Store raises an gbxsickacfr::gbxutilacfr::Exception.
+ * an empty Store raises an gbxutilacfr::Exception.
*
* @note Replaces the deprecated Proxy class.
* @see Buffer, Notify
@@ -57,7 +56,7 @@
//! Returns the contents of the Store. This operation makes the data in the Store
//! "not new", i.e. @ref isNewData returns FALSE. Calls to get() when the Store is empty
- //! raises an gbxsickacfr::gbxutilacfr::Exception exception.
+ //! raises an gbxutilacfr::Exception exception.
void get( Type & obj ) const;
/*!
@@ -140,7 +139,7 @@
}
else
{
- throw gbxsickacfr::gbxutilacfr::Exception( ERROR_INFO, "trying to read from an empty Store." );
+ throw gbxutilacfr::Exception( ERROR_INFO, "trying to read from an empty Store." );
}
}
@@ -240,7 +239,6 @@
obj_ = obj;
}
-}
} // end namespace
#endif
Modified: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/subsystemthread.cpp
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/subsystemthread.cpp 2008-06-04 02:02:30 UTC (rev 153)
+++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/subsystemthread.cpp 2008-06-04 05:37:33 UTC (rev 154)
@@ -13,7 +13,7 @@
#include "subsystemthread.h"
-using namespace gbxsickacfr::gbxiceutilacfr;
+using namespace gbxiceutilacfr;
using namespace std;
Modified: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/subsystemthread.h
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/subsystemthread.h 2008-06-04 02:02:30 UTC (rev 153)
+++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/subsystemthread.h 2008-06-04 05:37:33 UTC (rev 154)
@@ -12,11 +12,10 @@
#define GBXICEUTILACFR_SUBSYSTEM_THREAD_H
#include <gbxsickacfr/gbxiceutilacfr/thread.h>
-#include <gbxsickacfr/gbxutilacfr/substatus.h>
-#include <gbxsickacfr/gbxutilacfr/status.h>
-#include <gbxsickacfr/gbxutilacfr/tracer.h>
+#include <gbxutilacfr/substatus.h>
+#include <gbxutilacfr/status.h>
+#include <gbxutilacfr/tracer.h>
-namespace gbxsickacfr {
namespace gbxiceutilacfr {
/*!
@@ -72,7 +71,6 @@
//! A smart pointer to the SubsystemThread class.
typedef IceUtil::Handle<SubsystemThread> SubsystemThreadPtr;
-}
} // end namespace
#endif
Modified: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/buffertest.cpp
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/buffertest.cpp 2008-06-04 02:02:30 UTC (rev 153)
+++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/buffertest.cpp 2008-06-04 05:37:33 UTC (rev 154)
@@ -16,13 +16,13 @@
int main(int argc, char * argv[])
{
- gbxsickacfr::gbxiceutilacfr::Buffer<double> buffer(-1, gbxsickacfr::gbxiceutilacfr::BufferTypeCircular);
+ gbxiceutilacfr::Buffer<double> buffer(-1, gbxiceutilacfr::BufferTypeCircular);
double data = 20.0;
double copy = -1.0;
cout<<"testing default constructor and depth() and type() ... ";
- if ( buffer.depth()!=-1 || buffer.type()!=gbxsickacfr::gbxiceutilacfr::BufferTypeCircular ) {
- cout<<"failed. depth: exp=-1 got="<<buffer.depth()<<" type: exp="<<(int)gbxsickacfr::gbxiceutilacfr::BufferTypeCircular<<" got="<<(int)buffer.type()<<endl;
+ if ( buffer.depth()!=-1 || buffer.type()!=gbxiceutilacfr::BufferTypeCircular ) {
+ cout<<"failed. depth: exp=-1 got="<<buffer.depth()<<" type: exp="<<(int)gbxiceutilacfr::BufferTypeCircular<<" got="<<(int)buffer.type()<<endl;
return EXIT_FAILURE;
}
cout<<"ok"<<endl;
@@ -35,7 +35,7 @@
cout<<"failed. empty buffer, should've caught exception"<<endl;
return EXIT_FAILURE;
}
- catch ( const gbxsickacfr::gbxutilacfr::Exception & )
+ catch ( const gbxutilacfr::Exception & )
{
; // ok
}
@@ -48,7 +48,7 @@
cout<<"failed. empty buffer, should've caught exception"<<endl;
return EXIT_FAILURE;
}
- catch ( const gbxsickacfr::gbxutilacfr::Exception & )
+ catch ( const gbxutilacfr::Exception & )
{
; // ok
}
@@ -95,7 +95,7 @@
{
buffer.get( copy );
}
- catch ( const gbxsickacfr::gbxutilacfr::Exception & )
+ catch ( const gbxutilacfr::Exception & )
{
cout<<"failed. should be a non-empty buffer."<<endl;
return EXIT_FAILURE;
@@ -119,7 +119,7 @@
for ( int i=0; i < size; i++ )
buffer.getAndPop( data );
}
- catch ( const gbxsickacfr::gbxutilacfr::Exception & )
+ catch ( const gbxutilacfr::Exception & )
{
cout<<"failed. should be a non-empty buffer."<<endl;
return EXIT_FAILURE;
@@ -131,7 +131,7 @@
cout<<"ok"<<endl;
cout<<"testing circular buffer behavior ...";
- buffer.configure( 1, gbxsickacfr::gbxiceutilacfr::BufferTypeCircular );
+ buffer.configure( 1, gbxiceutilacfr::BufferTypeCircular );
//this fills the buffer
buffer.push( 0 );
// this should over-write
@@ -144,7 +144,7 @@
cout<<"ok"<<endl;
cout<<"testing queue buffer behavior ...";
- buffer.configure( 1, gbxsickacfr::gbxiceutilacfr::BufferTypeQueue );
+ buffer.configure( 1, gbxiceutilacfr::BufferTypeQueue );
//this fills the buffer
buffer.push( 0 );
// this should be ignored
@@ -156,8 +156,8 @@
}
cout<<"ok"<<endl;
- cout<<"testing configure() with gbxsickacfr::gbxiceutilacfr::BufferTypeCircular ... ";
- buffer.configure( 300, gbxsickacfr::gbxiceutilacfr::BufferTypeCircular );
+ cout<<"testing configure() with gbxiceutilacfr::BufferTypeCircular ... ";
+ buffer.configure( 300, gbxiceutilacfr::BufferTypeCircular );
for ( int i=0; i<400; ++i ) {
buffer.push( data );
}
@@ -176,8 +176,8 @@
}
cout<<"ok"<<endl;
- cout<<"testing configure() with gbxsickacfr::gbxiceutilacfr::BufferTypeQueue ... ";
- buffer.configure( 300, gbxsickacfr::gbxiceutilacfr::BufferTypeQueue );
+ cout<<"testing configure() with gbxiceutilacfr::BufferTypeQueue ... ";
+ buffer.configure( 300, gbxiceutilacfr::BufferTypeQueue );
for ( int i=0; i<400; ++i ) {
buffer.push( data );
}
Modified: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/notifytest.cpp
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/notifytest.cpp 2008-06-04 02:02:30 UTC (rev 153)
+++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/notifytest.cpp 2008-06-04 05:37:33 UTC (rev 154)
@@ -14,7 +14,7 @@
using namespace std;
-class TestNotifyHandler : public gbxsickacfr::gbxiceutilacfr::NotifyHandler<double>
+class TestNotifyHandler : public gbxiceutilacfr::NotifyHandler<double>
{
public:
virtual void handleData( const double& obj )
@@ -27,10 +27,10 @@
int main(int argc, char * argv[])
{
- gbxsickacfr::gbxiceutilacfr::Notify<double> notify;
+ gbxiceutilacfr::Notify<double> notify;
double data = 2.0;
- gbxsickacfr::gbxiceutilacfr::NotifyHandler<double>* emptyHandler = 0;
+ gbxiceutilacfr::NotifyHandler<double>* emptyHandler = 0;
TestNotifyHandler testHandler;
cout<<"testing set() ... ";
@@ -41,7 +41,7 @@
cout<<"failed. empty notify handler, should've caught exception"<<endl;
return EXIT_FAILURE;
}
- catch ( const gbxsickacfr::gbxutilacfr::Exception & )
+ catch ( const gbxutilacfr::Exception & )
{
; // ok
}
@@ -72,7 +72,7 @@
{
notify.set( data );
}
- catch ( const gbxsickacfr::gbxutilacfr::Exception & )
+ catch ( const gbxutilacfr::Exception & )
{
cout<<"failed. shouldn't have caught exception"<<endl;
return EXIT_FAILURE;
Modified: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/safethreadtest.cpp
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/safethreadtest.cpp 2008-06-04 02:02:30 UTC (rev 153)
+++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/safethreadtest.cpp 2008-06-04 05:37:33 UTC (rev 154)
@@ -13,15 +13,15 @@
#include <IceUtil/Time.h>
#include <gbxsickacfr/gbxiceutilacfr/safethread.h>
-#include <gbxsickacfr/gbxutilacfr/trivialtracer.h>
+#include <gbxutilacfr/trivialtracer.h>
using namespace std;
-class TestThread : public gbxsickacfr::gbxiceutilacfr::SafeThread
+class TestThread : public gbxiceutilacfr::SafeThread
{
public:
// it's safe to pass zero pointers
- TestThread( gbxsickacfr::gbxutilacfr::Tracer& tracer ) :
+ TestThread( gbxutilacfr::Tracer& tracer ) :
SafeThread( tracer ) {};
virtual void walk()
{
@@ -31,11 +31,11 @@
};
};
-class TestThreadWithThrow : public gbxsickacfr::gbxiceutilacfr::SafeThread
+class TestThreadWithThrow : public gbxiceutilacfr::SafeThread
{
public:
// it's safe to pass zero pointers
- TestThreadWithThrow( gbxsickacfr::gbxutilacfr::Tracer& tracer ) :
+ TestThreadWithThrow( gbxutilacfr::Tracer& tracer ) :
SafeThread( tracer ) {};
virtual void walk()
{
@@ -45,11 +45,11 @@
int main(int argc, char * argv[])
{
- gbxsickacfr::gbxutilacfr::TrivialTracer tracer;
+ gbxutilacfr::TrivialTracer tracer;
cout<<"testing start() and stop()... ";
{
- gbxsickacfr::gbxiceutilacfr::Thread* t=0;
+ gbxiceutilacfr::Thread* t=0;
try
{
t = new TestThread( tracer );
@@ -69,7 +69,7 @@
cout<<"testing SafeThread() with exceptions... ";
{
- gbxsickacfr::gbxiceutilacfr::Thread* t=0;
+ gbxiceutilacfr::Thread* t=0;
try
{
t = new TestThreadWithThrow( tracer );
Modified: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/storetest.cpp
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/storetest.cpp 2008-06-04 02:02:30 UTC (rev 153)
+++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/storetest.cpp 2008-06-04 05:37:33 UTC (rev 154)
@@ -16,7 +16,7 @@
int main(int argc, char * argv[])
{
- gbxsickacfr::gbxiceutilacfr::Store<double> store;
+ gbxiceutilacfr::Store<double> store;
double data = 20.0;
double copy = -1.0;
@@ -28,7 +28,7 @@
cout<<"failed. empty store, should've caught exception"<<endl;
return EXIT_FAILURE;
}
- catch ( const gbxsickacfr::gbxutilacfr::Exception & )
+ catch ( const gbxutilacfr::Exception & )
{
; // ok
}
@@ -63,7 +63,7 @@
{
store.get( copy );
}
- catch ( const gbxsickacfr::gbxutilacfr::Exception & )
+ catch ( const gbxutilacfr::Exception & )
{
cout<<"failed. should be a non-empty store."<<endl;
return EXIT_FAILURE;
Modified: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/subsystemthreadtest.cpp
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/subsystemthreadtest.cpp 2008-06-04 02:02:30 UTC (rev 153)
+++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/subsystemthreadtest.cpp 2008-06-04 05:37:33 UTC (rev 154)
@@ -13,16 +13,16 @@
#include <IceUtil/Time.h>
#include <gbxsickacfr/gbxiceutilacfr/subsystemthread.h>
-#include <gbxsickacfr/gbxutilacfr/trivialtracer.h>
-#include <gbxsickacfr/gbxutilacfr/trivialstatus.h>
+#include <gbxutilacfr/trivialtracer.h>
+#include <gbxutilacfr/trivialstatus.h>
using namespace std;
-class TestThread : public gbxsickacfr::gbxiceutilacfr::SubsystemThread
+class TestThread : public gbxiceutilacfr::SubsystemThread
{
public:
// it's safe to pass zero pointers
- TestThread( gbxsickacfr::gbxutilacfr::Tracer& tracer, gbxsickacfr::gbxutilacfr::Status& status ) :
+ TestThread( gbxutilacfr::Tracer& tracer, gbxutilacfr::Status& status ) :
SubsystemThread( tracer, status ) {};
virtual void walk()
{
@@ -32,11 +32,11 @@
};
};
-class TestThreadWithThrow : public gbxsickacfr::gbxiceutilacfr::SubsystemThread
+class TestThreadWithThrow : public gbxiceutilacfr::SubsystemThread
{
public:
// it's safe to pass zero pointers
- TestThreadWithThrow( gbxsickacfr::gbxutilacfr::Tracer& tracer, gbxsickacfr::gbxutilacfr::Status& status ) :
+ TestThreadWithThrow( gbxutilacfr::Tracer& tracer, gbxutilacfr::Status& status ) :
SubsystemThread( tracer, status ) {};
virtual void walk()
{
@@ -44,10 +44,10 @@
};
};
-class TestThreadWithTools : public gbxsickacfr::gbxiceutilacfr::SubsystemThread
+class TestThreadWithTools : public gbxiceutilacfr::SubsystemThread
{
public:
- TestThreadWithTools( gbxsickacfr::gbxutilacfr::Tracer& tracer, gbxsickacfr::gbxutilacfr::Status& status ) :
+ TestThreadWithTools( gbxutilacfr::Tracer& tracer, gbxutilacfr::Status& status ) :
SubsystemThread( tracer, status, "MyName" )
{
};
@@ -59,12 +59,12 @@
int main(int argc, char * argv[])
{
- gbxsickacfr::gbxutilacfr::TrivialTracer tracer;
- gbxsickacfr::gbxutilacfr::TrivialStatus status( tracer );
+ gbxutilacfr::TrivialTracer tracer;
+ gbxutilacfr::TrivialStatus status( tracer );
cout<<"testing start() and stop()... ";
{
- gbxsickacfr::gbxiceutilacfr::Thread* t=0;
+ gbxiceutilacfr::Thread* t=0;
try
{
t = new TestThread( tracer, status );
@@ -84,7 +84,7 @@
cout<<"testing SubsystemThread() with exceptions... ";
{
- gbxsickacfr::gbxiceutilacfr::Thread* t=0;
+ gbxiceutilacfr::Thread* t=0;
try
{
t = new TestThreadWithThrow( tracer, status );
Modified: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/threadtest.cpp
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/threadtest.cpp 2008-06-04 02:02:30 UTC (rev 153)
+++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/threadtest.cpp 2008-06-04 05:37:33 UTC (rev 154)
@@ -13,11 +13,11 @@
#include <IceUtil/Time.h>
#include <gbxsickacfr/gbxiceutilacfr/thread.h>
-#include <gbxsickacfr/gbxutilacfr/exceptions.h>
+#include <gbxutilacfr/exceptions.h>
using namespace std;
-class TestThread : public gbxsickacfr::gbxiceutilacfr::Thread
+class TestThread : public gbxiceutilacfr::Thread
{
public:
virtual void run()
@@ -28,7 +28,7 @@
};
};
-class TestThreadWithThrow : public gbxsickacfr::gbxiceutilacfr::Thread
+class TestThreadWithThrow : public gbxiceutilacfr::Thread
{
public:
TestThreadWithThrow( bool shouldIThrow )
@@ -46,7 +46,7 @@
};
};
-class TestThreadWithExit : public gbxsickacfr::gbxiceutilacfr::Thread
+class TestThreadWithExit : public gbxiceutilacfr::Thread
{
public:
TestThreadWithExit() :
@@ -82,7 +82,7 @@
IceUtil::Mutex exitMutex_;
};
-class TestThreadWithWait : public gbxsickacfr::gbxiceutilacfr::Thread
+class TestThreadWithWait : public gbxiceutilacfr::Thread
{
public:
virtual void run()
@@ -91,12 +91,12 @@
};
};
-class TestThreadWithNap : public gbxsickacfr::gbxiceutilacfr::Thread
+class TestThreadWithNap : public gbxiceutilacfr::Thread
{
public:
virtual void run()
{
- gbxsickacfr::gbxiceutilacfr::checkedSleep( this, IceUtil::Time::seconds(5), 100 );
+ gbxiceutilacfr::checkedSleep( this, IceUtil::Time::seconds(5), 100 );
};
};
@@ -104,7 +104,7 @@
{
cout<<"testing start() and stop()... ";
{
- gbxsickacfr::gbxiceutilacfr::Thread* t=0;
+ gbxiceutilacfr::Thread* t=0;
try
{
t = new TestThread;
@@ -124,7 +124,7 @@
cout<<"testing start() and stop() with smart pointer ... ";
{
- gbxsickacfr::gbxiceutilacfr::ThreadPtr t;
+ gbxiceutilacfr::ThreadPtr t;
try
{
t = new TestThread;
@@ -162,7 +162,7 @@
{
// works only with smart pointers because with dumb ones the threads self-destruct
// and we can't examine their final state.
- gbxsickacfr::gbxiceutilacfr::ThreadPtr t = new TestThreadWithExit;
+ gbxiceutilacfr::ThreadPtr t = new TestThreadWithExit;
if ( t->isStopping()!=false || t->isAlive()!=false || t->isStarted()!=false ) {
cout<<"failed"<<endl
@@ -205,7 +205,7 @@
cout<<"testing waitForStop() ... ";
{
- gbxsickacfr::gbxiceutilacfr::ThreadPtr t = new TestThreadWithWait;
+ gbxiceutilacfr::ThreadPtr t = new TestThreadWithWait;
t->start();
if ( t->isAlive()!=true ) {
cout<<"failed"<<endl
@@ -235,7 +235,7 @@
cout<<"testing stopAndJoin() with smart pointer ... ";
{
- gbxsickacfr::gbxiceutilacfr::ThreadPtr t = new TestThread;
+ gbxiceutilacfr::ThreadPtr t = new TestThread;
t->start();
if ( t->isAlive()!=true ) {
cout<<"failed"<<endl
@@ -244,7 +244,7 @@
exit(EXIT_FAILURE);
}
- gbxsickacfr::gbxiceutilacfr::stopAndJoin( t );
+ gbxiceutilacfr::stopAndJoin( t );
IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(150));
if ( t->isAlive()!=false ) {
cout<<"failed"<<endl
@@ -257,11 +257,11 @@
cout<<"testing checkedSleep() ... ";
{
- gbxsickacfr::gbxiceutilacfr::ThreadPtr t = new TestThreadWithNap;
+ gbxiceutilacfr::ThreadPtr t = new TestThreadWithNap;
t->start();
IceUtil::Time stopTime = IceUtil::Time::now();
- gbxsickacfr::gbxiceutilacfr::stopAndJoin( t );
+ gbxiceutilacfr::stopAndJoin( t );
IceUtil::Time joinTime = IceUtil::Time::now();
cout<<"time to stop = "<<(joinTime-stopTime).toDuration()<<endl;
Modified: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/thread.cpp
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/thread.cpp 2008-06-04 02:02:30 UTC (rev 153)
+++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/thread.cpp 2008-06-04 05:37:33 UTC (rev 154)
@@ -9,11 +9,10 @@
*/
#include <IceUtil/Time.h>
-#include <gbxsickacfr/gbxutilacfr/exceptions.h>
+#include <gbxutilacfr/exceptions.h>
#include "thread.h"
-namespace gbxsickacfr {
namespace gbxiceutilacfr {
Thread::Thread() :
@@ -92,5 +91,4 @@
}
}
-}
} // namespace
Modified: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/thread.h
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/thread.h 2008-06-04 02:02:30 UTC (rev 153)
+++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/thread.h 2008-06-04 05:37:33 UTC (rev 154)
@@ -13,7 +13,6 @@
#include <IceUtil/Thread.h>
-namespace gbxsickacfr {
namespace gbxiceutilacfr {
/*!
@@ -115,7 +114,6 @@
//! this function will sleep for @ref checkIntervalMs.
void checkedSleep( const gbxiceutilacfr::ThreadPtr& thread, IceUtil::Time duration, int checkIntervalMs=250 );
-}
} // end namespace
#endif
Modified: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/timer.cpp
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/timer.cpp 2008-06-04 02:02:30 UTC (rev 153)
+++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/timer.cpp 2008-06-04 05:37:33 UTC (rev 154)
@@ -10,7 +10,6 @@
#include <gbxsickacfr/gbxiceutilacfr/timer.h>
-namespace gbxsickacfr {
namespace gbxiceutilacfr {
Timer::Timer()
@@ -38,5 +37,4 @@
return ( (IceUtil::Time::now() - time_).toSecondsDouble() );
}
-}
} // namespace
Modified: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/timer.h
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/timer.h 2008-06-04 02:02:30 UTC (rev 153)
+++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/timer.h 2008-06-04 05:37:33 UTC (rev 154)
@@ -13,7 +13,6 @@
#include <IceUtil/Time.h>
-namespace gbxsickacfr {
namespace gbxiceutilacfr {
/*!
@@ -53,7 +52,6 @@
};
-}
} // end namespace
#endif
Modified: gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.h
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.h 2008-06-04 02:02:30 UTC (rev 153)
+++ gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.h 2008-06-04 05:37:33 UTC (rev 154)
@@ -11,7 +11,7 @@
#define GBXSERIALDEVICEACFR_SERIALDEVICEHANDLER_H
#include <gbxserialacfr/serial.h>
-#include <gbxsickacfr/gbxutilacfr/substatus.h>
+#include <gbxutilacfr/substatus.h>
#include <gbxsickacfr/gbxiceutilacfr/safethread.h>
#include <gbxsickacfr/gbxiceutilacfr/buffer.h>
#include <IceUtil/IceUtil.h>
Modified: gearbox/trunk/src/gbxsickacfr/messages.cpp
===================================================================
--- gearbox/trunk/src/gbxsickacfr/messages.cpp 2008-06-04 02:02:30 UTC (rev 153)
+++ gearbox/trunk/src/gbxsickacfr/messages.cpp 2008-06-04 05:37:33 UTC (rev 154)
@@ -14,7 +14,7 @@
#include <sstream>
#include <iomanip>
#include <IceUtil/Time.h>
-#include <gbxsickacfr/gbxutilacfr/exceptions.h>
+#include <gbxutilacfr/exceptions.h>
#include <assert.h>
using namespace std;
Modified: gearbox/trunk/src/gbxsickacfr/test/test.cpp
===================================================================
--- gearbox/trunk/src/gbxsickacfr/test/test.cpp 2008-06-04 02:02:30 UTC (rev 153)
+++ gearbox/trunk/src/gbxsickacfr/test/test.cpp 2008-06-04 05:37:33 UTC (rev 154)
@@ -17,9 +17,9 @@
#include <iostream>
#include <sstream>
#include <gbxsickacfr/driver.h>
-#include <gbxsickacfr/gbxutilacfr/trivialtracer.h>
-#include <gbxsickacfr/gbxutilacfr/trivialstatus.h>
-#include <gbxsickacfr/gbxutilacfr/mathdefs.h>
+#include <gbxutilacfr/trivialtracer.h>
+#include <gbxutilacfr/trivialstatus.h>
+#include <gbxutilacfr/mathdefs.h>
using namespace std;
@@ -75,8 +75,8 @@
cout << "Using configuration: " << config.toString() << endl;
// Instantiate objects to handle messages from the driver
- gbxsickacfr::gbxutilacfr::TrivialTracer tracer( debug );
- gbxsickacfr::gbxutilacfr::TrivialStatus status( tracer );
+ gbxutilacfr::TrivialTracer tracer( debug );
+ gbxutilacfr::TrivialStatus status( tracer );
// Instantiate the driver itself
gbxsickacfr::Driver* device;
Copied: gearbox/trunk/src/gbxutilacfr (from rev 153, gearbox/trunk/src/gbxsickacfr/gbxutilacfr)
Modified: gearbox/trunk/src/gbxutilacfr/CMakeLists.txt
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxutilacfr/CMakeLists.txt 2008-06-04 02:02:30 UTC (rev 153)
+++ gearbox/trunk/src/gbxutilacfr/CMakeLists.txt 2008-06-04 05:37:33 UTC (rev 154)
@@ -2,8 +2,7 @@
GBX_ADD_LICENSE( LGPL )
SET( build TRUE )
-# don't give user an option
-# GBX_REQUIRE_OPTION( build LIB ${lib_name} ON )
+GBX_REQUIRE_OPTION( build LIB ${lib_name} ON )
IF( build )
@@ -17,7 +16,7 @@
GBX_ADD_LIBRARY( ${lib_name} SHARED ${srcs} )
- GBX_ADD_HEADERS( gbxsickacfr/gbxutilacfr ${hdrs} )
+ GBX_ADD_HEADERS( gbxutilacfr ${hdrs} )
IF( GBX_BUILD_TESTS )
ADD_SUBDIRECTORY( test )
Added: gearbox/trunk/src/gbxutilacfr/doc.dox
===================================================================
--- gearbox/trunk/src/gbxutilacfr/doc.dox (rev 0)
+++ gearbox/trunk/src/gbxutilacfr/doc.dox 2008-06-04 05:37:33 UTC (rev 154)
@@ -0,0 +1,52 @@
+/*
+ * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
+ * http://gearbox.sf.net/
+ * Copyright (c) 2004-2008 Alex Brooks, Alexei Makarenko, Tobias Kaupp
+ *
+ * This distribution is licensed to you under the terms described in
+ * the LICENSE file included in this distribution.
+ *
+ */
+
+/*!
+@ingroup gbx_libs
+@ingroup gbx_cpp
+@ingroup gbx_linux
+@defgroup gbx_library_gbxutilacfr GbxUtilAcfr
+@brief ACFR driver for SICK laser range-finder.
+
+Utility functions and objects used accross ACFR libraries and drivers.
+
+@par Header file
+
+@verbatim
+#include <gbxutilacfr/gbxutilacfr.h>
+@endverbatim
+
+@par Style
+ See http://orca-robotics.sourceforge.net/orca/orca_doc_style.html
+
+@par Copyright
+ Alex Brooks, Alexei Makarenko, Tobias Kaupp
+
+@par Responsible Developer
+ Alex Makarenko
+
+@par License
+ LGPL
+
+@par Dependencies
+
+- none
+
+*/
+
+/*!
+@brief ACFR utilities
+@namespace gbxutilacfr
+
+This namespace is part of a utility library.
+
+@see @ref gbx_library_gbxutilacfr
+
+*/
\ No newline at end of file
Modified: gearbox/trunk/src/gbxutilacfr/exceptions.cpp
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxutilacfr/exceptions.cpp 2008-06-04 02:02:30 UTC (rev 153)
+++ gearbox/trunk/src/gbxutilacfr/exceptions.cpp 2008-06-04 05:37:33 UTC (rev 154)
@@ -14,7 +14,6 @@
using namespace std;
-namespace gbxsickacfr {
namespace gbxutilacfr {
Exception::Exception( const char *file, const char *line, const char *message )
@@ -53,5 +52,4 @@
message_ += +"): " + msgString + "\n";
}
-}
} // namespace
Modified: gearbox/trunk/src/gbxutilacfr/exceptions.h
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxutilacfr/exceptions.h 2008-06-04 02:02:30 UTC (rev 153)
+++ gearbox/trunk/src/gbxutilacfr/exceptions.h 2008-06-04 05:37:33 UTC (rev 154)
@@ -35,7 +35,6 @@
#include <exception>
#include <string>
-namespace gbxsickacfr {
namespace gbxutilacfr {
/*!
@@ -80,7 +79,6 @@
: Exception( file, line, message ) {};
};
-}
} // namespace
Modified: gearbox/trunk/src/gbxutilacfr/gbxutilacfr.h
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxutilacfr/gbxutilacfr.h 2008-06-04 02:02:30 UTC (rev 153)
+++ gearbox/trunk/src/gbxutilacfr/gbxutilacfr.h 2008-06-04 05:37:33 UTC (rev 154)
@@ -15,11 +15,11 @@
#ifndef GBXUTILACFR_GBXUTILACFRL_H
#define GBXUTILACFR_GBXUTILACFRL_H
-#include <gbxsickacfr/gbxutilacfr/tracer.h>
-#include <gbxsickacfr/gbxutilacfr/status.h>
-#include <gbxsickacfr/gbxutilacfr/exceptions.h>
-#include <gbxsickacfr/gbxutilacfr/mathdefs.h>
-// #include <gbxsickacfr/gbxutilacfr/stringutils.h>
-// #include <gbxsickacfr/gbxutilacfr/sysutils.h>
+#include <gbxutilacfr/tracer.h>
+#include <gbxutilacfr/status.h>
+#include <gbxutilacfr/exceptions.h>
+#include <gbxutilacfr/mathdefs.h>
+// #include <gbxutilacfr/stringutils.h>
+// #include <gbxutilacfr/sysutils.h>
#endif
Modified: gearbox/trunk/src/gbxutilacfr/status.h
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxutilacfr/status.h 2008-06-04 02:02:30 UTC (rev 153)
+++ gearbox/trunk/src/gbxutilacfr/status.h 2008-06-04 05:37:33 UTC (rev 154)
@@ -14,7 +14,6 @@
#include <string>
#include <vector>
-namespace gbxsickacfr {
namespace gbxutilacfr {
//! Possible subsystem status values
@@ -47,7 +46,7 @@
float sinceHeartbeat;
};
-/*
+/*!
@brief Local interface to component status.
@par Overview
@@ -89,7 +88,7 @@
virtual ~Status() {};
- /*
+ /*!
Adds subsystem to the system status monitor. This command must be called before any
other. I.e. all other status commands are ignored unless a subsystem with that name
already exists. When trying to add a subsystem with an existing name, the existing
@@ -103,50 +102,49 @@
*/
virtual void addSubsystem( const std::string& subsystem, double maxHeartbeatIntervalSec=-1.0 )=0;
- // Removes subsystem from the status monitor. This should be done for example, if one of
- // the thread is shutting down or restarting.
- // Throws gbxutilacfr::Exception if the subsystem does not exist.
+ //! Removes subsystem from the status monitor. This should be done for example, if one of
+ //! the thread is shutting down or restarting.
+ //! Throws gbxutilacfr::Exception if the subsystem does not exist.
virtual void removeSubsystem( const std::string& subsystem )=0;
- // Returns a list of subsystem names.
+ //! Returns a list of subsystem names.
virtual std::vector<std::string> subsystems()=0;
- // Returns status of subsystem with the given name.
- // Throws gbxutilacfr::Exception when the specified subsystem does not exist.
+ //! Returns status of subsystem with the given name.
+ //! Throws gbxutilacfr::Exception when the specified subsystem does not exist.
virtual SubsystemStatus subsystemStatus( const std::string& subsystem )=0;
- // Modifies maximum expected interval between heartbeats (in seconds).
- // When time since last heartbeat exceeds this, alarm is raised.
- // Throws gbxutilacfr::Exception if the subsystem does not exist.
+ //! Modifies maximum expected interval between heartbeats (in seconds).
+ //! When time since last heartbeat exceeds this, alarm is raised.
+ //! Throws gbxutilacfr::Exception if the subsystem does not exist.
virtual void setMaxHeartbeatInterval( const std::string& subsystem, double intervalSec )=0;
- // Sets subsystem status to Initialising. Note that empty message is assumed if none is supplied.
- // Throws gbxutilacfr::Exception if the subsystem does not exist.
+ //! Sets subsystem status to Initialising. Note that empty message is assumed if none is supplied.
+ //! Throws gbxutilacfr::Exception if the subsystem does not exist.
virtual void initialising( const std::string& subsystem, const std::string& message="" )=0;
- // Sets subsystem status to Ok. Note that empty message is assumed if none is supplied.
- // Throws gbxutilacfr::Exception if the subsystem does not exist.
+ //! Sets subsystem status to Ok. Note that empty message is assumed if none is supplied.
+ //! Throws gbxutilacfr::Exception if the subsystem does not exist.
virtual void ok( const std::string& subsystem, const std::string& message="" )=0;
- // Sets subsystem status to Warning.
- // Throws gbxutilacfr::Exception if the subsystem does not exist.
+ //! Sets subsystem status to Warning.
+ //! Throws gbxutilacfr::Exception if the subsystem does not exist.
virtual void warning( const std::string& subsystem, const std::string& message )=0;
- // Sets subsystem status to Fault.
- // Throws gbxutilacfr::Exception if the subsystem does not exist.
+ //! Sets subsystem status to Fault.
+ //! Throws gbxutilacfr::Exception if the subsystem does not exist.
virtual void fault( const std::string& subsystem, const std::string& message )=0;
- // Record heartbeat from a subsystem: let Status know the subsystem is alive without
- // modifying its status.
- // Throws gbxutilacfr::Exception if the subsystem does not exist.
+ //! Record heartbeat from a subsystem: let Status know the subsystem is alive without
+ //! modifying its status.
+ //! Throws gbxutilacfr::Exception if the subsystem does not exist.
virtual void heartbeat( const std::string& subsystem )=0;
- // Some thread should call this function periodically in order for
- // status publishing to happen.
+ //! Some thread should call this function periodically in order for
+ //! status publishing to happen.
virtual void process()=0;
};
-}
} // namespace
#endif
Modified: gearbox/trunk/src/gbxutilacfr/substatus.h
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxutilacfr/substatus.h 2008-06-04 02:02:30 UTC (rev 153)
+++ gearbox/trunk/src/gbxutilacfr/substatus.h 2008-06-04 05:37:33 UTC (rev 154)
@@ -11,9 +11,8 @@
#ifndef GBXUTILACFR_SUBSYSTEM_STATUS_H
#define GBXUTILACFR_SUBSYSTEM_STATUS_H
-#include <gbxsickacfr/gbxutilacfr/status.h>
+#include <gbxutilacfr/status.h>
-namespace gbxsickacfr {
namespace gbxutilacfr {
//!
@@ -75,7 +74,6 @@
std::string subsysName_;
};
-}
} // namespace
#endif
Modified: gearbox/trunk/src/gbxutilacfr/test/mathtest.cpp
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxutilacfr/test/mathtest.cpp 2008-06-04 02:02:30 UTC (rev 153)
+++ gearbox/trunk/src/gbxutilacfr/test/mathtest.cpp 2008-06-04 05:37:33 UTC (rev 154)
@@ -9,7 +9,7 @@
*/
#include <iostream>
-#include <gbxsickacfr/gbxutilacfr/mathdefs.h>
+#include <gbxutilacfr/mathdefs.h>
#include <iomanip>
#include <assert.h>
Modified: gearbox/trunk/src/gbxutilacfr/tokenise.cpp
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxutilacfr/tokenise.cpp 2008-06-04 02:02:30 UTC (rev 153)
+++ gearbox/trunk/src/gbxutilacfr/tokenise.cpp 2008-06-04 05:37:33 UTC (rev 154)
@@ -13,7 +13,6 @@
using namespace std;
-namespace gbxsickacfr {
namespace gbxutilacfr {
std::vector<string> tokenise( const string &str, const string &delimiter )
@@ -66,4 +65,3 @@
}
}
-}
Modified: gearbox/trunk/src/gbxutilacfr/tokenise.h
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxutilacfr/tokenise.h 2008-06-04 02:02:30 UTC (rev 153)
+++ gearbox/trunk/src/gbxutilacfr/tokenise.h 2008-06-04 05:37:33 UTC (rev 154)
@@ -14,7 +14,6 @@
#include <string>
#include <vector>
-namespace gbxsickacfr {
namespace gbxutilacfr {
//! Takes a string containing tokens separated by a delimiter
@@ -23,6 +22,5 @@
const std::string &delimiter );
}
-}
#endif
Modified: gearbox/trunk/src/gbxutilacfr/tracer.h
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxutilacfr/tracer.h 2008-06-04 02:02:30 UTC (rev 153)
+++ gearbox/trunk/src/gbxutilacfr/tracer.h 2008-06-04 05:37:33 UTC (rev 154)
@@ -1,6 +1,6 @@
/*
* GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
- * http://gearbox.sf.net/
+ * http://!gearbox.sf.net/
* Copyright (c) 2004-2008 Alex Brooks, Alexei Makarenko, Tobias Kaupp
*
* This distribution is licensed to you under the terms described in
@@ -13,127 +13,126 @@
#include <string>
-namespace gbxsickacfr {
namespace gbxutilacfr {
-//
-// @brief Local and remote tracing.
-//
-// Tracer is used to log human-readable trace statements, e.g. warnings, error messages, etc (not data).
-//
-// A single Tracer object is meant to be shared by multiple threads, so the
-// implementation must be thread-safe.
-//
-// When the tracing message is cheap to generate, simply call one of the tracing functions.
-// The routing to destinations will be performed internally.
-//
-// @verbatim
-// std::string s = "something is wrong";
-// tracer->error( s );
-// @endverbatim
-//
-// If the tracing message is a result of an expensive operation, you
-// many want to perform the tracing test yourself and then call the
-// tracing function. You may test verbosity for specific TraceType /
-// DestinationType combinations or use summary fields AnyTrace and
-// ToAny.
-//
-// @verbatim
-// Tracer* tracer = context().tracer();
-// if ( tracer.verbosity( gbxutilacfr::Tracer::ErrorTrace, gbxutilacfr::Tracer::ToAny ) > 0 ) {
-// std::string s = expensiveOperation();
-// tracer.error( s );
-// }
-// @endverbatim
-//
-// Enum gbxutilacfr::Tracer::TraceType defines types of traced
-// information. Enum gbxutilacfr::Tracer::DestinationType defines possible
-// tracer destinations are. Verbosity levels range from 0 (nothing) to
-// 10 (everything). The built-in defaults are as follows:
-// @verbatim
-// ToDisplay ToNetwork ToLog ToFile
-// Info 1 0 0 0
-// Warning 1 0 0 0
-// Error 10 0 0 0
-// Debug 0 0 0 0
-// @endverbatim
-//
-// @see Status
-//
+//!
+//! @brief Local and remote tracing.
+//!
+//! Tracer is used to log human-readable trace statements, e.g. warnings, error messages, etc (not data).
+//!
+//! A single Tracer object is meant to be shared by multiple threads, so the
+//! implementation must be thread-safe.
+//!
+//! When the tracing message is cheap to generate, simply call one of the tracing functions.
+//! The routing to destinations will be performed internally.
+//!
+//! @verbatim
+//! std::string s = "something is wrong";
+//! tracer->error( s );
+//! @endverbatim
+//!
+//! If the tracing message is a result of an expensive operation, you
+//! many want to perform the tracing test yourself and then call the
+//! tracing function. You may test verbosity for specific TraceType /
+//! DestinationType combinations or use summary fields AnyTrace and
+//! ToAny.
+//!
+//! @verbatim
+//! Tracer* tracer = context().tracer();
+//! if ( tracer.verbosity( gbxutilacfr::Tracer::ErrorTrace, gbxutilacfr::Tracer::ToAny ) > 0 ) {
+//! std::string s = expensiveOperation();
+//! tracer.error( s );
+//! }
+//! @endverbatim
+//!
+//! Enum gbxutilacfr::Tracer::TraceType defines types of traced
+//! information. Enum gbxutilacfr::Tracer::DestinationType defines possible
+//! tracer destinations are. Verbosity levels range from 0 (nothing) to
+//! 10 (everything). The built-in defaults are as follows:
+//! @verbatim
+//! ToDisplay ToNetwork ToLog ToFile
+//! Info 1 0 0 0
+//! Warning 1 0 0 0
+//! Error 10 0 0 0
+//! Debug 0 0 0 0
+//! @endverbatim
+//!
+//! @see Status
+//!
class Tracer
{
public:
virtual ~Tracer() {};
- // Types of traced information
+ //! Types of traced information
enum TraceType {
- // Information
+ //! Information
InfoTrace=0,
- // Warning
+ //! Warning
WarningTrace,
- // Error
+ //! Error
ErrorTrace,
- // Debug statement
+ //! Debug statement
DebugTrace,
- // Use this index to find out the maximum verbosity among all trace types to
- // a particular destination.
+ //! Use this index to find out the maximum verbosity among all trace types to
+ //! a particular destination.
AnyTrace,
- // Number of trace types
+ //! Number of trace types
NumberOfTraceTypes,
- // Other
- // (not used by orcaice tracers, so it's verbosity level is not stored in
- // our matrix, so it's safe to have it larger than NumberOfTraceTypes)
+ //! Other
+ //! (not used by orcaice tracers, so it's verbosity level is not stored in
+ //! our matrix, so it's safe to have it larger than NumberOfTraceTypes)
OtherTrace
};
- // Types of destinations for traced information.
+ //! Types of destinations for traced information.
enum DestinationType {
- // Write to stardard display
+ //! Write to stardard display
ToDisplay=0,
- // Send over the network, details specific to Tracer implementation
+ //! Send over the network, details specific to Tracer implementation
ToNetwork,
- // Write to SysLog on Unix, EventLog on windows
+ //! Write to SysLog on Unix, EventLog on windows
ToLog,
- // Write to a file
+ //! Write to a file
ToFile,
- // Use this index to request the maximum verbosity of a particular type among
- // all destinations
+ //! Use this index to request the maximum verbosity of a particular type among
+ //! all destinations
ToAny,
- // Number of destination types
+ //! Number of destination types
NumberOfDestinationTypes
};
struct Config
{
- // array of verbosity levels
+ //! array of verbosity levels
int verbosity[NumberOfTraceTypes][NumberOfDestinationTypes];
- // affects only the printout to stdout. Remote messages always have a timestamp.
+ //! affects only the printout to stdout. Remote messages always have a timestamp.
bool addTimestamp;
};
- // LOCAL INTERFACE
+ //! LOCAL INTERFACE
- // Prints out verbatim to stdout. It is never routed over the network.
- // @see info
+ //! Prints out verbatim to stdout. It is never routed over the network.
+ //! @see info
virtual void print( const std::string &message ) = 0;
- // Routing is determined by InfoToXxx parameter.
+ //! Routing is determined by InfoToXxx parameter.
virtual void info( const std::string &message, int level=1 ) = 0;
- // Routing is determined by WarningToXxx parameter.
+ //! Routing is determined by WarningToXxx parameter.
virtual void warning( const std::string &message, int level=1 ) = 0;
- // Routing is determined by ErrorToXxx parameter.
+ //! Routing is determined by ErrorToXxx parameter.
virtual void error( const std::string &message, int level=1 ) = 0;
- // Routing is determined by DebugToXxx parameter.
+ //! Routing is determined by DebugToXxx parameter.
virtual void debug( const std::string &message, int level=1 ) = 0;
- // Returns the verbosity level for traceType to destType. This test is performed
- // internally by all tracing functions, e.g. error(). You may want to call this
- // function yourself @e before calling error() if there is a significant overhead
- // in forming the tracing string. See class documentation for an example of such
- // usage.
+ //! Returns the verbosity level for traceType to destType. This test is performed
+ //! internally by all tracing functions, e.g. error(). You may want to call this
+ //! function yourself @e before calling error() if there is a significant overhead
+ //! in forming the tracing string. See class documentation for an example of such
+ //! usage.
virtual int verbosity( TraceType traceType, DestinationType destType ) const = 0;
static std::string toString( Tracer::TraceType type )
@@ -168,20 +167,19 @@
};
- // @b EXPERIMENTAL. Sets debug level for an individual subsystem.
- // Only debug-to-display is supported.
+ //! @b EXPERIMENTAL. Sets debug level for an individual subsystem.
+ //! Only debug-to-display is supported.
virtual void setLevel( const std::string &subsystem, int level=0 ) {};
- // @b EXPERIMENTAL. Debug tracing for an individual subsystem.
- // Only debug-to-display is supported.
- // The maximum traceable level is set per-subsystem with setLevel().
+ //! @b EXPERIMENTAL. Debug tracing for an individual subsystem.
+ //! Only debug-to-display is supported.
+ //! The maximum traceable level is set per-subsystem with setLevel().
virtual void debug( const std::string &subsystem, const std::string &message, int level=1 )
{
debug( message, level );
};
};
-}
-} // namespace
+} //! namespace
#endif
Modified: gearbox/trunk/src/gbxutilacfr/trivialstatus.cpp
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxutilacfr/trivialstatus.cpp 2008-06-04 02:02:30 UTC (rev 153)
+++ gearbox/trunk/src/gbxutilacfr/trivialstatus.cpp 2008-06-04 05:37:33 UTC (rev 154)
@@ -15,7 +15,6 @@
using namespace std;
-namespace gbxsickacfr {
namespace gbxutilacfr {
TrivialStatus::TrivialStatus( Tracer& tracer,
@@ -103,4 +102,3 @@
}
}
-}
Modified: gearbox/trunk/src/gbxutilacfr/trivialstatus.h
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxutilacfr/trivialstatus.h 2008-06-04 02:02:30 UTC (rev 153)
+++ gearbox/trunk/src/gbxutilacfr/trivialstatus.h 2008-06-04 05:37:33 UTC (rev 154)
@@ -11,10 +11,9 @@
#ifndef GBXUTILACFR_TRIVIAL_STATUS_H
#define GBXUTILACFR_TRIVIAL_STATUS_H
-#include <gbxsickacfr/gbxutilacfr/status.h>
-#include <gbxsickacfr/gbxutilacfr/tracer.h>
+#include <gbxutilacfr/status.h>
+#include <gbxutilacfr/tracer.h>
-namespace gbxsickacfr {
namespace gbxutilacfr {
@@ -32,9 +31,9 @@
virtual void addSubsystem( const std::string& subsystem, double maxHeartbeatIntervalSec=-1.0 );
virtual void removeSubsystem( const std::string& subsystem );
- // does not keep track of subsystems, returns empty vector.
+ //! does not keep track of subsystems, returns empty vector.
virtual std::vector<std::string> subsystems();
- // does not keep track of status, throws Exception on any query
+ //! does not keep track of status, throws Exception on any query
virtual SubsystemStatus subsystemStatus( const std::string& subsystem );
virtual void setMaxHeartbeatInterval( const std::string& subsystem, double interval );
virtual void initialising( const std::string& subsystem, const std::string& message="" );
@@ -55,7 +54,6 @@
bool fault_;
};
-}
} // namespace
#endif
Modified: gearbox/trunk/src/gbxutilacfr/trivialtracer.cpp
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxutilacfr/trivialtracer.cpp 2008-06-04 02:02:30 UTC (rev 153)
+++ gearbox/trunk/src/gbxutilacfr/trivialtracer.cpp 2008-06-04 05:37:33 UTC (rev 154)
@@ -13,7 +13,6 @@
using namespace std;
-namespace gbxsickacfr {
namespace gbxutilacfr {
TrivialTracer::TrivialTracer( bool debug, bool info, bool warn, bool error ) :
@@ -65,5 +64,3 @@
}
}
-}
-
Modified: gearbox/trunk/src/gbxutilacfr/trivialtracer.h
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxutilacfr/trivialtracer.h 2008-06-04 02:02:30 UTC (rev 153)
+++ gearbox/trunk/src/gbxutilacfr/trivialtracer.h 2008-06-04 05:37:33 UTC (rev 154)
@@ -11,9 +11,8 @@
#ifndef GBXUTILACFR_TRIVIAL_TRACER_H
#define GBXUTILACFR_TRIVIAL_TRACER_H
-#include <gbxsickacfr/gbxutilacfr/tracer.h>
+#include <gbxutilacfr/tracer.h>
-namespace gbxsickacfr {
namespace gbxutilacfr {
//!
@@ -40,7 +39,6 @@
bool error_;
};
-}
} // namespace
#endif
Modified: gearbox/trunk/submitted/gbxgarminacfr/driver.cpp
===================================================================
--- gearbox/trunk/submitted/gbxgarminacfr/driver.cpp 2008-06-04 02:02:30 UTC (rev 153)
+++ gearbox/trunk/submitted/gbxgarminacfr/driver.cpp 2008-06-04 05:37:33 UTC (rev 154)
@@ -10,7 +10,7 @@
#include <iostream>
#include <sstream>
-#include <gbxsickacfr/gbxutilacfr/gbxutilacfr.h>
+#include <gbxutilacfr/gbxutilacfr.h>
#include "nmea.h"
#include <cstdlib>
#include <sys/time.h>
@@ -181,8 +181,8 @@
///////////////////////////////////////
Driver::Driver( const Config &config,
- gbxsickacfr::gbxutilacfr::Tracer &tracer,
- gbxsickacfr::gbxutilacfr::Status &status ) :
+ gbxutilacfr::Tracer &tracer,
+ gbxutilacfr::Status &status ) :
config_(config),
tracer_(tracer),
status_(status)
@@ -191,7 +191,7 @@
{
stringstream ss;
ss << "Invalid config: " << config_.toString();
- throw gbxsickacfr::gbxutilacfr::Exception( ERROR_INFO, ss.str() );
+ throw gbxutilacfr::Exception( ERROR_INFO, ss.str() );
}
stringstream ssDebug;
@@ -224,7 +224,7 @@
stringstream ss;
ss << "Driver: Caught SerialException: " << e.what();
tracer_.error( ss.str() );
- throw gbxsickacfr::gbxutilacfr::Exception( ERROR_INFO, ss.str() );
+ throw gbxutilacfr::Exception( ERROR_INFO, ss.str() );
}
}
@@ -297,14 +297,14 @@
if ( gettimeofday( &now, 0 ) != 0 ) {
stringstream ss;
ss << "Pproblem getting timeofday: " << strerror(errno) << endl;
- throw gbxsickacfr::gbxutilacfr::Exception( ERROR_INFO,ss.str() );
+ throw gbxutilacfr::Exception( ERROR_INFO,ss.str() );
}
// zero tolerance to serial errors
if ( ret<0 )
- throw gbxsickacfr::gbxutilacfr::Exception( ERROR_INFO, "Driver: Timeout reading from serial port" );
+ throw gbxutilacfr::Exception( ERROR_INFO, "Driver: Timeout reading from serial port" );
if ( ret==0 )
- throw gbxsickacfr::gbxutilacfr::Exception( ERROR_INFO,"Driver: Read 0 bytes from serial port");
+ throw gbxutilacfr::Exception( ERROR_INFO,"Driver: Read 0 bytes from serial port");
//
// We successfully read something from the serial port
@@ -324,7 +324,7 @@
stringstream ss;
ss << "Problem reading from GPS: " << e.what();
tracer_.error( ss.str() );
- throw gbxsickacfr::gbxutilacfr::Exception( ERROR_INFO,ss.str());
+ throw gbxutilacfr::Exception( ERROR_INFO,ss.str());
}
nmeaExceptionCount = 0;
@@ -336,7 +336,7 @@
continue;
}
else {
- throw gbxsickacfr::gbxutilacfr::Exception( ERROR_INFO,"More than 3 sequential messages failed the checksum");
+ throw gbxutilacfr::Exception( ERROR_INFO,"More than 3 sequential messages failed the checksum");
}
}
nmeaFailChecksumCount = 0;
@@ -346,7 +346,7 @@
// We should not get any messages with failed checksums, but just in case
if( nmeaMessage.haveTestedChecksum() && (!nmeaMessage.haveValidChecksum()) ) {
- throw gbxsickacfr::gbxutilacfr::Exception( ERROR_INFO,"Driver: Message fails checksum");
+ throw gbxutilacfr::Exception( ERROR_INFO,"Driver: Message fails checksum");
}
// And then find out which type of messge we have recieved...
@@ -356,7 +356,7 @@
if ( config_.readGga )
tracer_.debug("got GPGGA message",4);
else
- throw gbxsickacfr::gbxutilacfr::Exception( ERROR_INFO, "got unexpected GPGGA message" );
+ throw gbxutilacfr::Exception( ERROR_INFO, "got unexpected GPGGA message" );
genericData.reset( extractGgaData( nmeaMessage, now.tv_sec, now.tv_usec ) );
break;
}
@@ -364,7 +364,7 @@
if ( co...
[truncated message content] |
|
From: <rus...@us...> - 2008-06-04 02:02:24
|
Revision: 153
http://gearbox.svn.sourceforge.net/gearbox/?rev=153&view=rev
Author: russo2503v
Date: 2008-06-03 19:02:30 -0700 (Tue, 03 Jun 2008)
Log Message:
-----------
removed mga functionality. moved nmea into the driver
Modified Paths:
--------------
gearbox/trunk/submitted/gbxgarminacfr/CMakeLists.txt
gearbox/trunk/submitted/gbxgarminacfr/driver.cpp
Added Paths:
-----------
gearbox/trunk/submitted/gbxgarminacfr/nmea.cpp
gearbox/trunk/submitted/gbxgarminacfr/nmea.h
Removed Paths:
-------------
gearbox/trunk/submitted/gbxgarminacfr/gbxgpsutilacfr/
Modified: gearbox/trunk/submitted/gbxgarminacfr/CMakeLists.txt
===================================================================
--- gearbox/trunk/submitted/gbxgarminacfr/CMakeLists.txt 2008-06-04 01:32:03 UTC (rev 152)
+++ gearbox/trunk/submitted/gbxgarminacfr/CMakeLists.txt 2008-06-04 02:02:30 UTC (rev 153)
@@ -9,17 +9,13 @@
# SET( int_libs GbxUtilAcfr GbxSerialAcfr GbxGpsUtilAcfr )
GBX_REQUIRE_TARGETS( build LIB ${lib_name} ${int_libs} )
-SET( private_libs GbxGpsUtilAcfr )
-
IF( build )
- ADD_SUBDIRECTORY( gbxgpsutilacfr )
-
INCLUDE( ${GBX_CMAKE_DIR}/UseBasicRules.cmake )
FILE( GLOB hdrs *.h )
FILE( GLOB srcs *.cpp )
- SET( dep_libs ${int_libs} ${private_libs} )
+ SET( dep_libs ${int_libs} )
GBX_ADD_LIBRARY( ${lib_name} SHARED ${srcs} )
TARGET_LINK_LIBRARIES( ${lib_name} ${dep_libs} )
Modified: gearbox/trunk/submitted/gbxgarminacfr/driver.cpp
===================================================================
--- gearbox/trunk/submitted/gbxgarminacfr/driver.cpp 2008-06-04 01:32:03 UTC (rev 152)
+++ gearbox/trunk/submitted/gbxgarminacfr/driver.cpp 2008-06-04 02:02:30 UTC (rev 153)
@@ -11,7 +11,7 @@
#include <iostream>
#include <sstream>
#include <gbxsickacfr/gbxutilacfr/gbxutilacfr.h>
-#include <gbxgarminacfr/gbxgpsutilacfr/nmea.h>
+#include "nmea.h"
#include <cstdlib>
#include <sys/time.h>
#include <time.h>
Copied: gearbox/trunk/submitted/gbxgarminacfr/nmea.cpp (from rev 152, gearbox/trunk/submitted/gbxgarminacfr/gbxgpsutilacfr/nmea.cpp)
===================================================================
--- gearbox/trunk/submitted/gbxgarminacfr/nmea.cpp (rev 0)
+++ gearbox/trunk/submitted/gbxgarminacfr/nmea.cpp 2008-06-04 02:02:30 UTC (rev 153)
@@ -0,0 +1,208 @@
+/*
+ * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
+ * http://gearbox.sf.net/
+ * Copyright (c) 2004-2008 Mathew Ridley, Alex Brooks, Alexei Makarenko, Tobias Kaupp
+ *
+ * This distribution is licensed to you under the terms described in
+ * the LICENSE file included in this distribution.
+ *
+ */
+
+#include <stdio.h>
+#include <string>
+#include <iostream>
+#include <assert.h>
+#include <gbxsickacfr/gbxutilacfr/tokenise.h>
+
+//////////////////////////////
+
+// Ensure we have strnlen
+// eg. Solaris doesn't define strnlen in string.h, so define it here.
+#if !HAVE_STRNLEN
+
+#include <cstring>
+
+// inline the fucker to guard against multiple inclusion, without the
+// hassle of a special lib.
+inline size_t strnlen(const char *s, size_t maxlen)
+{
+ char *p;
+ if (s == NULL) {
+ return maxlen;
+ }
+ p = (char *)memchr(s, 0, maxlen);
+ if (p == NULL) {
+ return maxlen;
+ }
+ return ((p - s) + 1);
+}
+#endif
+
+//////////////////////////////
+
+#include "nmea.h"
+
+using namespace std;
+using namespace gbxgpsutilacfr;
+
+const char NMEAStartOfSentence = '$';
+const char NMEAChecksumDelim = '*';
+
+
+//*************************************************************
+//The blank constructor
+NmeaMessage::NmeaMessage()
+{
+ init();
+}
+
+//**************************************************************
+void NmeaMessage::init()
+{
+ haveSentence_ = false;
+ haveTokens_ = false;
+ haveCheckSum_ = false;
+ checkSumOK_ = false;
+
+ // Now clear the internal data store
+ sentence_[0] = 0;
+ dataTokens_.clear();
+}
+
+
+//****************************************************************
+NmeaMessage::NmeaMessage(const char *sentence, int testCheckSum)
+{
+ init();
+ setSentence(sentence,testCheckSum);
+}
+
+
+//**********************************************************************
+//Load the data as requested and test the checksum if we are asked to.
+void NmeaMessage::setSentence(const char *data, int AddOrTestCheckSum)
+{
+ init();
+
+ strncpy(sentence_,data, MAX_SENTENCE_LEN);
+
+ //terminate just in case, Note that we have a buffer which is
+ //MAX_SENTENCE_LEN + 1 long!
+
+ sentence_[MAX_SENTENCE_LEN] = '\0';
+ haveSentence_ = true;
+
+ switch(AddOrTestCheckSum)
+ {
+ case TestChecksum: //This is for Rx'd data that we need to test for correct reception
+ testChecksumOk(); break;
+ case AddChecksum: //This is for Tx data that needs to checksummed before sending
+ addCheckSum(); checkSumOK_ = true; break;
+ case DontTestOrAddChecksum:
+ break;
+ default:
+ assert(true);
+ }
+}
+
+
+//*****************************************************************
+bool NmeaMessage::testChecksumOk()
+{
+ haveCheckSum_ = true;
+ checkSumOK_ = false;
+
+ //First save the checksum chars from the existing message
+ char* ptr;
+ char chksum_HIB,chksum_LOB;
+
+ //First save the existing two checksum chars from the message
+ //These are straight after the '*' character
+ ptr = strchr(sentence_, NMEAChecksumDelim);
+ if(!ptr){return false;}
+
+ //save the high and low bytes of the checksum
+ //Make sure they are in upper case!
+ chksum_HIB = toupper(*(++ptr));
+ chksum_LOB = toupper(*(ptr + 1));
+
+
+ //invalidate the existing checksum
+ *ptr = *(ptr+1) = 'x';
+
+ //****NOTE** We leave the ptr pointing at the first chksum byte
+
+ //Re-calculate our own copy of the checksum
+ addCheckSum();
+
+ //Now compare our saved version with our new ones
+ if((chksum_HIB == *ptr) && (chksum_LOB == *(ptr+1))){
+ //all looked good!
+ checkSumOK_ = true;
+ return true;
+ }
+
+ //failed the checksum!
+ return false;
+}
+
+
+//*****************************************************
+// Add the checksum chars to an existing message
+// NOTE: this assumes that there is allready space in the message for
+// the checksum, and that the checksum delimiter is there
+
+void NmeaMessage::addCheckSum(){
+
+ assert( haveSentence_ );
+
+ haveCheckSum_ = true;
+
+ //check that we have the '$' at the start
+ if(sentence_[0]!= NMEAStartOfSentence)
+ {return;}
+
+ unsigned char chkRunning = 0;
+
+ int loopCount;
+ unsigned char nextChar;
+ for( loopCount =1; loopCount < MAX_SENTENCE_LEN; loopCount++){
+
+ nextChar = static_cast<unsigned char>(sentence_[loopCount]);
+
+ // no delimiter uh oh
+ if((nextChar=='\r')||(nextChar=='\n')||(nextChar=='\0')){
+ throw NmeaException("nmea: cannot calculate checksum, missing '*'\n");
+ return;
+ }
+
+ // goodie we found it
+ if(nextChar==NMEAChecksumDelim)
+ {break;}
+
+ //Keep the running total going
+ chkRunning ^= nextChar;
+ }
+
+ //Put the byte values as upper case HEX back into the message
+ sprintf(sentence_ + loopCount + 1,"%02X",chkRunning);
+}
+
+
+//**********************************************************************
+// Parse the data fields of our message...
+void NmeaMessage::parseTokens(){
+
+ //We should not attempt to be parsing a message twice...
+ assert (numDataTokens() == 0);
+
+ //Split the message at the commas
+ //TODO cope with missing fields
+ dataTokens_ = gbxsickacfr::gbxutilacfr::tokenise(sentence_, ",");
+
+ //Now discard the $ and the * from the first and last tokens...
+ //TODO : - dataTokens_[0] =
+
+ //keep track of what we have done.
+ haveTokens_ = true;
+}
Copied: gearbox/trunk/submitted/gbxgarminacfr/nmea.h (from rev 152, gearbox/trunk/submitted/gbxgarminacfr/gbxgpsutilacfr/nmea.h)
===================================================================
--- gearbox/trunk/submitted/gbxgarminacfr/nmea.h (rev 0)
+++ gearbox/trunk/submitted/gbxgarminacfr/nmea.h 2008-06-04 02:02:30 UTC (rev 153)
@@ -0,0 +1,122 @@
+/*
+ * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
+ * http://gearbox.sf.net/
+ * Copyright (c) 2004-2008 Alex Brooks, Alexei Makarenko, Tobias Kaupp, Duncan Mercer
+ *
+ * This distribution is licensed to you under the terms described in
+ * the LICENSE file included in this distribution.
+ *
+ */
+
+#include <vector>
+#include <string>
+
+// #include <hydroportability/sharedlib.h>
+
+#ifndef GBXGPSUTILACFR_NMEA_H
+#define GBXGPSUTILACFR_NMEA_H
+
+
+
+/*
+
+for further info:
+
+http://www.kh-gps.de/nmea-faq.htm
+http://vancouver-webpages.com/peter/nmeafaq.txt
+
+NMEA-0183 sentence
+
+$aaccc,c--c*hh<CR><LF>
+|| || || |
+|| || || \________ <CR><LF> - End of sentence (0xOD 0xOA)
+|| || |\__________ hh - Checksum field hexadecimal [optional]
+|| || \___________ * - Checksum delimiter (0x2A) [optional]
+|| |\_______________ c--c - Data sentence block
+|| \________________ , - Field delimiter (0x2c)
+|\_____________________ aaccc - Address field/Command
+\______________________ $ - Start of sentence
+
+ The optional checksum field consists of a "*" and two hex digits
+ representing the exclusive OR of all characters between, but not
+ including, the "$" and "*". A checksum is required on some
+ sentences.
+
+*/
+
+namespace gbxgpsutilacfr {
+
+
+// class SOEXPORT NmeaException : public std::exception
+class NmeaException : public std::exception
+{
+public:
+
+ NmeaException(const char *message)
+ : message_(message) {}
+ NmeaException(const std::string &message)
+ : message_(message) {}
+ virtual ~NmeaException() throw() {}
+ virtual const char* what() const throw() { return message_.c_str(); }
+
+protected:
+ std::string message_;
+};
+
+
+#define MAX_SENTENCE_LEN 256
+
+// When using class to send data, need to add checksum, when reciving data need to test checksum
+// Checksums are usually optional
+enum{TestChecksum, AddChecksum, DontTestOrAddChecksum};
+
+// class SOEXPORT NmeaMessage{
+class NmeaMessage
+{
+public:
+ NmeaMessage();
+ NmeaMessage(const char *sentence, int testCheckSum = DontTestOrAddChecksum);
+
+ // Set up the internal data for a sentence
+ void setSentence(const char *data, int testCheckSum = DontTestOrAddChecksum);
+
+ // Do we only have the raw string ?
+ bool haveSentence() const { return haveSentence_; };
+ // Have we parsed fields ?
+ bool haveTokens() const { return haveTokens_; };
+ // have we a valid checksum ?
+ bool haveValidChecksum() const { return checkSumOK_; };
+ // have we checked the checksum?
+ bool haveTestedChecksum()const { return haveCheckSum_; };
+ // calculate the checksum from sentence
+ // Note that this function may throw NMEA_Exception...
+ bool testChecksumOk();
+ // Return the raw sentence string
+ const char * sentence() { return sentence_; };
+ // Return a single data token as a string
+ std::string& getDataToken(int i) { return dataTokens_[i]; };
+
+ // Return the number of fields
+ int numDataTokens() const { return dataTokens_.size(); };
+ //Tokenise the string that we received
+ void parseTokens();
+
+private:
+ void init();
+ void addCheckSum();
+ // Do we only have the raw string ?
+ bool haveSentence_;
+ // Have we parsed data into tokens ?
+ bool haveTokens_;
+ // Have we a checksum and is it valid?
+ bool haveCheckSum_;
+ bool checkSumOK_;
+ // The raw sentence, allow for terminator
+ char sentence_[MAX_SENTENCE_LEN+1];
+ // The tokenised data
+ std::vector<std::string> dataTokens_;
+};
+
+}
+
+#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rus...@us...> - 2008-06-04 01:32:01
|
Revision: 152
http://gearbox.svn.sourceforge.net/gearbox/?rev=152&view=rev
Author: russo2503v
Date: 2008-06-03 18:32:03 -0700 (Tue, 03 Jun 2008)
Log Message:
-----------
tested with no fix
Modified Paths:
--------------
gearbox/trunk/submitted/gbxgarminacfr/doc.dox
gearbox/trunk/submitted/gbxgarminacfr/driver.cpp
gearbox/trunk/submitted/gbxgarminacfr/driver.h
Modified: gearbox/trunk/submitted/gbxgarminacfr/doc.dox
===================================================================
--- gearbox/trunk/submitted/gbxgarminacfr/doc.dox 2008-06-04 00:20:19 UTC (rev 151)
+++ gearbox/trunk/submitted/gbxgarminacfr/doc.dox 2008-06-04 01:32:03 UTC (rev 152)
@@ -37,25 +37,15 @@
Duncan Mercer, Alex Brooks, Alexei Makarenko, Tobias Kaupp
@par Responsible Developer
- Alex Brooks
+ Alex Makarenko
@par License
LGPL
@par Dependencies
-- libIceUtil (for timing), v.3.2 or newer (latest tested 3.3).
- @ref gbx_library_gbxserialacfr
-@par Installation
-
-- Finding libIceUtil
- - IceUtil will be found automatically if installed in one of several standard locations.
- - You can specify it's installation point with @c ICEUTIL_HOME CMake variable (or an environment variable with the same name). For example:
-@verbatim
-$ cmake -DICEUTIL_HOME=/home/myuser/install .
-@endverbatim
-
@section gbx_library_gbxgarminacfr What is EPE?
Bits of information assembled by Duncan Mercer.
Modified: gearbox/trunk/submitted/gbxgarminacfr/driver.cpp
===================================================================
--- gearbox/trunk/submitted/gbxgarminacfr/driver.cpp 2008-06-04 00:20:19 UTC (rev 151)
+++ gearbox/trunk/submitted/gbxgarminacfr/driver.cpp 2008-06-04 01:32:03 UTC (rev 152)
@@ -38,12 +38,22 @@
enum GgaTokens{MsgType=0,UTC,Lat,LatDir,Lon,LonDir,FixType,
NSatsUsed,HDOP,Hgt,M1,GeoidHgt,M2,DiffAge,DiffId};
+ //UTC time
+ sscanf(msg.getDataToken(UTC).c_str(),"%02d%02d%lf",
+ &data->utcTimeHrs, &data->utcTimeMin, &data->utcTimeSec );
+
// fix type
switch ( msg.getDataToken(FixType)[0] )
{
case '0':
data->fixType = Invalid;
// NOTE: not processing the rest!
+ data->latitude = 0.0;
+ data->longitude = 0.0;
+ data->altitude = 0.0;
+ data->satellites = 0;
+ data->geoidalSeparation = 0.0;
+cout<<"DEBUG: invalid fix, lat="<<data->latitude<<endl;
return data;
case '1':
data->fixType = Autonomous;
@@ -53,9 +63,6 @@
break;
}
- //UTC time
- sscanf(msg.getDataToken(UTC).c_str(),"%02d%02d%lf",
- &data->utcTimeHrs, &data->utcTimeMin, &data->utcTimeSec );
//position
int deg;
double min;
@@ -346,36 +353,39 @@
string MsgType = nmeaMessage.getDataToken(0);
if ( MsgType == "$GPGGA" ) {
- tracer_.debug("got GGA message",4);
- if ( !config_.readGga )
- continue;
+ if ( config_.readGga )
+ tracer_.debug("got GPGGA message",4);
+ else
+ throw gbxsickacfr::gbxutilacfr::Exception( ERROR_INFO, "got unexpected GPGGA message" );
genericData.reset( extractGgaData( nmeaMessage, now.tv_sec, now.tv_usec ) );
break;
}
else if ( MsgType == "$GPVTG" ) {
- tracer_.debug("got VTG message",4);
- if ( !config_.readVtg )
- continue;
+ if ( config_.readVtg )
+ tracer_.debug("got GPVTG message",4);
+ else
+ throw gbxsickacfr::gbxutilacfr::Exception( ERROR_INFO, "got unexpected GPVTG message" );
genericData.reset( extractVtgData( nmeaMessage, now.tv_sec, now.tv_usec ) );
break;
}
else if ( MsgType == "$PGRME" ) {
- tracer_.debug("got RME message",4);
- if ( !config_.readRme )
- continue;
+ if ( config_.readRme )
+ tracer_.debug("got PGRME message",4);
+ else
+ throw gbxsickacfr::gbxutilacfr::Exception( ERROR_INFO, "got unexpected PGRME message" );
genericData.reset( extractRmeData( nmeaMessage, now.tv_sec, now.tv_usec ) );
break;
}
else if ( MsgType == "$PGRMO" ) {
//This message is sent by us to control msg transmission and then echoed by GPS
- //So we can just ignore it
+ //So we can just ignore it and wait for the next one.
continue;
}
else {
// if we get here the msg is unknown
stringstream ErrMsg;
ErrMsg << "Message type unknown " << MsgType <<endl;
- throw gbxsickacfr::gbxutilacfr::Exception( ERROR_INFO,ErrMsg.str());
+ throw gbxsickacfr::gbxutilacfr::Exception( ERROR_INFO, ErrMsg.str() );
}
}
Modified: gearbox/trunk/submitted/gbxgarminacfr/driver.h
===================================================================
--- gearbox/trunk/submitted/gbxgarminacfr/driver.h 2008-06-04 00:20:19 UTC (rev 151)
+++ gearbox/trunk/submitted/gbxgarminacfr/driver.h 2008-06-04 01:32:03 UTC (rev 152)
@@ -38,11 +38,11 @@
//! Serial device. e.g. "/dev/ttyS0"
std::string device;
- //! Read PGGGA sentence
+ //! Read GPGGA sentence
bool readGga;
- //! Read PGVTG sentence
+ //! Read GPVTG sentence
bool readVtg;
- //! Read GPRME sentence
+ //! Read PGRME sentence
bool readRme;
};
@@ -80,7 +80,8 @@
Differential
};
-//! Fix data structure
+//! Fix data structure. Note that when fixType is Invalid, all other data except the time stamps
+//! are meaningless.
struct GgaData : public GenericData
{
public:
@@ -110,7 +111,8 @@
//! Altitude [metres above ellipsoid]
double altitude;
- //! Fix type.
+ //! Fix type. When fixType is Invalid, all other data except the time stamps
+ //! are meaningless.
FixType fixType;
//! Number of satellites
@@ -168,9 +170,8 @@
};
/*!
+Garmin GPS driver.
-Garmin GPS driver
-
All Garmin receivers understand the latest NMEA standard which is called: 0183 version 2.0.
This standard dictates a transfer rate of 4800 baud.
@@ -182,6 +183,9 @@
Processing of individual messages can be disabled in the Config structure.
+Note that when fixType contained in the GPGGA is Invalid, all other data in all messages
+except the time stamps are meaningless.
+
Referennces:
- http://en.wikipedia.org/wiki/NMEA
- http://www.gpsinformation.org/dale/interface.htm
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rus...@us...> - 2008-06-04 00:20:18
|
Revision: 151
http://gearbox.svn.sourceforge.net/gearbox/?rev=151&view=rev
Author: russo2503v
Date: 2008-06-03 17:20:19 -0700 (Tue, 03 Jun 2008)
Log Message:
-----------
only enabling configured messages
Modified Paths:
--------------
gearbox/trunk/submitted/gbxgarminacfr/driver.cpp
Modified: gearbox/trunk/submitted/gbxgarminacfr/driver.cpp
===================================================================
--- gearbox/trunk/submitted/gbxgarminacfr/driver.cpp 2008-06-03 15:31:54 UTC (rev 150)
+++ gearbox/trunk/submitted/gbxgarminacfr/driver.cpp 2008-06-04 00:20:19 UTC (rev 151)
@@ -39,7 +39,7 @@
NSatsUsed,HDOP,Hgt,M1,GeoidHgt,M2,DiffAge,DiffId};
// fix type
- switch (msg.getDataToken(FixType)[0])
+ switch ( msg.getDataToken(FixType)[0] )
{
case '0':
data->fixType = Invalid;
@@ -96,7 +96,7 @@
//Check for an empty string. Means that we are not moving
//When the message has empty fields tokeniser skips so we get the next field inline.
- if(msg.getDataToken(HeadingTrue)[0] == 'T' ) {
+ if( msg.getDataToken(HeadingTrue)[0] == 'T' ) {
data->headingTrue=0.0;
data->headingMagnetic=0.0;
data->speed=0.0;
@@ -171,7 +171,7 @@
return ss.str();
}
-/////////////////////
+///////////////////////////////////////
Driver::Driver( const Config &config,
gbxsickacfr::gbxutilacfr::Tracer &tracer,
@@ -224,32 +224,42 @@
void
Driver::enableDevice()
{
+ tracer_.info("Configure Garmin GPS device");
+
//Create the messages that we are going to send and add the checksums
//Note that the checksum field is filled with 'x's before we start
- gbxgpsutilacfr::NmeaMessage DisableAllMsg("$PGRMO,,2*xx\r\n",gbxgpsutilacfr::AddChecksum);
- gbxgpsutilacfr::NmeaMessage Start_GGA_Msg("$PGRMO,GPGGA,1*xx\r\n",gbxgpsutilacfr::AddChecksum);
- gbxgpsutilacfr::NmeaMessage Start_VTG_Msg("$PGRMO,GPVTG,1*xx\r\n",gbxgpsutilacfr::AddChecksum);
- gbxgpsutilacfr::NmeaMessage Start_RME_Msg("$PGRMO,PGRME,1*xx\r\n",gbxgpsutilacfr::AddChecksum);
- tracer_.info("Configure Garmin GPS device");
+ //First disables all output messages then enable selected ones only.
+ gbxgpsutilacfr::NmeaMessage disableAllMsg( "$PGRMO,,2*xx\r\n",gbxgpsutilacfr::AddChecksum );
+ serial_->writeString( disableAllMsg.sentence() );
-
- //First disables all output messages then enable selected ones only.
- serial_->writeString(DisableAllMsg.sentence());
sleep(1);
- serial_->writeString(Start_GGA_Msg.sentence());
- serial_->writeString(Start_VTG_Msg.sentence());
- serial_->writeString(Start_RME_Msg.sentence());
+ if ( config_.readGga ) {
+ gbxgpsutilacfr::NmeaMessage enableGgaMsg( "$PGRMO,GPGGA,1*xx\r\n",gbxgpsutilacfr::AddChecksum );
+ serial_->writeString( enableGgaMsg.sentence() );
+ }
+
+
+ if ( config_.readVtg ) {
+ gbxgpsutilacfr::NmeaMessage enableVtgMsg( "$PGRMO,GPVTG,1*xx\r\n",gbxgpsutilacfr::AddChecksum );
+ serial_->writeString( enableVtgMsg.sentence() );
+ }
+
+ if ( config_.readRme ) {
+ gbxgpsutilacfr::NmeaMessage enableRmeMsg( "$PGRMO,PGRME,1*xx\r\n",gbxgpsutilacfr::AddChecksum );
+ serial_->writeString( enableRmeMsg.sentence() );
+ }
+
sleep(1);
}
void
Driver::disableDevice()
{
- //Simply send the no messages command!
- gbxgpsutilacfr::NmeaMessage DisableAllMsg("$PGRMO,,2*xx\r\n",gbxgpsutilacfr::AddChecksum);
- serial_->writeString(DisableAllMsg.sentence());
+ // Simply send the no messages command!
+ gbxgpsutilacfr::NmeaMessage disableAllMsg( "$PGRMO,,2*xx\r\n",gbxgpsutilacfr::AddChecksum );
+ serial_->writeString( disableAllMsg.sentence() );
}
std::auto_ptr<GenericData>
@@ -327,12 +337,12 @@
//First split up the data fields in the string we have read.
nmeaMessage.parseTokens();
- //We should not get any messages with failed checksums, but just in case
+ // We should not get any messages with failed checksums, but just in case
if( nmeaMessage.haveTestedChecksum() && (!nmeaMessage.haveValidChecksum()) ) {
throw gbxsickacfr::gbxutilacfr::Exception( ERROR_INFO,"Driver: Message fails checksum");
}
- //And then find out which type of messge we have recieved...
+ // And then find out which type of messge we have recieved...
string MsgType = nmeaMessage.getDataToken(0);
if ( MsgType == "$GPGGA" ) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rus...@us...> - 2008-06-03 15:32:23
|
Revision: 150
http://gearbox.svn.sourceforge.net/gearbox/?rev=150&view=rev
Author: russo2503v
Date: 2008-06-03 08:31:54 -0700 (Tue, 03 Jun 2008)
Log Message:
-----------
added data cast
Modified Paths:
--------------
gearbox/trunk/submitted/gbxgarminacfr/test/test.cpp
Modified: gearbox/trunk/submitted/gbxgarminacfr/test/test.cpp
===================================================================
--- gearbox/trunk/submitted/gbxgarminacfr/test/test.cpp 2008-06-03 15:28:26 UTC (rev 149)
+++ gearbox/trunk/submitted/gbxgarminacfr/test/test.cpp 2008-06-03 15:31:54 UTC (rev 150)
@@ -91,19 +91,28 @@
switch ( data->type() )
{
case gbxgarminacfr::GpGga :
- cout<<"GPGGA"<<endl;
+ {
+ gbxgarminacfr::GgaData* d = (gbxgarminacfr::GgaData*)data.get();
+ cout<<"GPGGA: fix type="<<d->fixType<<endl;
break;
+ }
case gbxgarminacfr::GpVtg :
- cout<<"GPVTG"<<endl;
+ {
+ gbxgarminacfr::VtgData* d = (gbxgarminacfr::VtgData*)data.get();
+ cout<<"GPVTG: speed="<<d->speed<<endl;
break;
+ }
case gbxgarminacfr::PgRme :
- cout<<"PGRME"<<endl;
+ {
+ gbxgarminacfr::RmeData* d = (gbxgarminacfr::RmeData*)data.get();
+ cout<<"PGRME: herror="<<d->horizontalPositionError<<endl;
break;
+ }
default :
cout<<"?????"<<endl;
}
- // no need to delete the message, the auto pointer will delete it automatically
+ // no need to delete the data object, the auto pointer will delete it automatically
cout<<"Test: Got data "<<i+1<<" of "<<numReads<<endl;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rus...@us...> - 2008-06-03 15:28:20
|
Revision: 149
http://gearbox.svn.sourceforge.net/gearbox/?rev=149&view=rev
Author: russo2503v
Date: 2008-06-03 08:28:26 -0700 (Tue, 03 Jun 2008)
Log Message:
-----------
cosmetic
Modified Paths:
--------------
gearbox/trunk/submitted/gbxgarminacfr/driver.h
gearbox/trunk/submitted/gbxgarminacfr/test/test.cpp
Modified: gearbox/trunk/submitted/gbxgarminacfr/driver.h
===================================================================
--- gearbox/trunk/submitted/gbxgarminacfr/driver.h 2008-06-03 14:55:22 UTC (rev 148)
+++ gearbox/trunk/submitted/gbxgarminacfr/driver.h 2008-06-03 15:28:26 UTC (rev 149)
@@ -57,30 +57,13 @@
PgRme
};
-//! Possible Status Messages GenericData can contain
-enum StatusMessageType
-{
- //! Nothing new, no message
- NoMsg,
- //! All good, but something to say
- Ok,
- //! Problem, likely to go away
- Warning,
- //! Problem, probably fatal
- Fault
-};
-
//! Generic data type returned by a read
class GenericData
{
public:
- virtual ~GenericData(){};
+ virtual ~GenericData() {};
//! Returns data type.
virtual DataType type() const=0;
- //! Status message type.
- StatusMessageType statusMessageType;
- //! Status message
- std::string statusMessage;
private:
};
@@ -188,48 +171,20 @@
Garmin GPS driver
+All Garmin receivers understand the latest NMEA standard which is called: 0183 version 2.0.
-Referennces:
-- http://en.wikipedia.org/wiki/NMEA
-- http://www.gpsinformation.org/dale/interface.htm
-
-All Garmin receivers understand the latest standard which is called: 0183 version 2.0.
-
This standard dictates a transfer rate of 4800 baud.
-Out of all the messages below, this driver can read only the following messages (sentences):
-- GPGGA
-- GPVTG
-- PGRME
-
-The sentences sent by Garmin receivers include:
-NMEA 2.0
-- GPBOD bearing, origin to destination - earlier G-12's do not transmit this
+This driver can read only the following messages (sentences):
- GPGGA fix data
-- GPGLL Lat/Lon data - earlier G-12's do not transmit this
-- GPGSA overall satellite reception data
-- GPGSV detailed satellite data
-- GPRMB minimum recommended data when following a route
-- GPRMC minimum recommended data
-- GPRTE route data
-- GPWPL waypoint data (this is bidirectional)
-
-NMEA 1.5 - some units do not support version 1.5
-- GPBOD bearing origin to destination - earlier G-12's do not send this
-- GPBWC bearing to waypoint using great circle route.
-- GPGLL lat/lon - earlier G-12's do not send this
-- GPRMC minimum recommend data
-- GPRMB minimum recommended data when following a route
+- PGRME (estimated error) - not sent if set to 0183 1.5
- GPVTG vector track and speed over ground
-- GPWPL waypoint data (only when active goto)
-- GPXTE cross track error
-In addition Garmin receivers send the following Proprietary Sentences:
-- PGRME (estimated error) - not sent if set to 0183 1.5
-- PGRMM (map datum)
-- PGRMZ (altitude)
-- PSLIB (beacon receiver control)
+Processing of individual messages can be disabled in the Config structure.
+Referennces:
+- http://en.wikipedia.org/wiki/NMEA
+- http://www.gpsinformation.org/dale/interface.htm
*/
class Driver
{
@@ -247,7 +202,22 @@
~Driver();
- //! Blocks till new data is available
+/*!
+Blocks till new data is available.
+
+Throws gbxsickacfr::gbxutilacfr::Exception when a problem is encountered.
+
+@verbatim
+std::auto_ptr<gbxgarminacfr::GenericData> data;
+
+try {
+ data = device->read();
+}
+catch ( const std::exception& e ) {
+ cout <<"Test: Failed to read data: "<<e.what()<<endl;
+}
+@endverbatim
+*/
std::auto_ptr<GenericData> read();
private:
Modified: gearbox/trunk/submitted/gbxgarminacfr/test/test.cpp
===================================================================
--- gearbox/trunk/submitted/gbxgarminacfr/test/test.cpp 2008-06-03 14:55:22 UTC (rev 148)
+++ gearbox/trunk/submitted/gbxgarminacfr/test/test.cpp 2008-06-03 15:28:26 UTC (rev 149)
@@ -51,8 +51,8 @@
gbxgarminacfr::Config config;
config.device = port;
config.readGga = true;
- config.readVtg = false;
- config.readRme = false;
+ config.readVtg = true;
+ config.readRme = true;
if ( !config.isValid() ) {
cout << "Test: Invalid device configuration structure: " << config.toString() << endl;
exit(1);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rus...@us...> - 2008-06-03 14:55:24
|
Revision: 148
http://gearbox.svn.sourceforge.net/gearbox/?rev=148&view=rev
Author: russo2503v
Date: 2008-06-03 07:55:22 -0700 (Tue, 03 Jun 2008)
Log Message:
-----------
tested with hardware
Modified Paths:
--------------
gearbox/trunk/submitted/gbxgarminacfr/driver.cpp
gearbox/trunk/submitted/gbxgarminacfr/driver.h
gearbox/trunk/submitted/gbxgarminacfr/test/test.cpp
Modified: gearbox/trunk/submitted/gbxgarminacfr/driver.cpp
===================================================================
--- gearbox/trunk/submitted/gbxgarminacfr/driver.cpp 2008-06-03 13:53:43 UTC (rev 147)
+++ gearbox/trunk/submitted/gbxgarminacfr/driver.cpp 2008-06-03 14:55:22 UTC (rev 148)
@@ -152,8 +152,12 @@
bool
Config::isValid() const
{
- if ( device.empty() ) return false;
+ if ( device.empty() )
+ return false;
+ if ( !( readGga || readVtg || readRme ) )
+ return false;
+
return true;
}
Modified: gearbox/trunk/submitted/gbxgarminacfr/driver.h
===================================================================
--- gearbox/trunk/submitted/gbxgarminacfr/driver.h 2008-06-03 13:53:43 UTC (rev 147)
+++ gearbox/trunk/submitted/gbxgarminacfr/driver.h 2008-06-03 14:55:22 UTC (rev 148)
@@ -26,8 +26,12 @@
readGga(true),
readVtg(true),
readRme(true) {};
- //! Returns true if the configuration is sane.
+
+ //! Returns true if the configuration is sane. Checks include:
+ //! - a non-empty device name
+ //! - at least one read-sentence flag set to TRUE
bool isValid() const;
+
//! Returns human-readable configuration description.
std::string toString() const;
Modified: gearbox/trunk/submitted/gbxgarminacfr/test/test.cpp
===================================================================
--- gearbox/trunk/submitted/gbxgarminacfr/test/test.cpp 2008-06-03 13:53:43 UTC (rev 147)
+++ gearbox/trunk/submitted/gbxgarminacfr/test/test.cpp 2008-06-03 14:55:22 UTC (rev 148)
@@ -51,8 +51,8 @@
gbxgarminacfr::Config config;
config.device = port;
config.readGga = true;
- config.readVtg = true;
- config.readRme = true;
+ config.readVtg = false;
+ config.readRme = false;
if ( !config.isValid() ) {
cout << "Test: Invalid device configuration structure: " << config.toString() << endl;
exit(1);
@@ -80,13 +80,31 @@
std::auto_ptr<gbxgarminacfr::GenericData> data;
// Read a few times
- const int numReads = 3;
+ const int numReads = 30;
for ( int i=0; i < numReads; i++ )
{
try
{
data = device->read();
+
+ // find out which data type it is
+ switch ( data->type() )
+ {
+ case gbxgarminacfr::GpGga :
+ cout<<"GPGGA"<<endl;
+ break;
+ case gbxgarminacfr::GpVtg :
+ cout<<"GPVTG"<<endl;
+ break;
+ case gbxgarminacfr::PgRme :
+ cout<<"PGRME"<<endl;
+ break;
+ default :
+ cout<<"?????"<<endl;
+ }
+ // no need to delete the message, the auto pointer will delete it automatically
+
cout<<"Test: Got data "<<i+1<<" of "<<numReads<<endl;
}
catch ( const std::exception& e )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rus...@us...> - 2008-06-03 13:53:41
|
Revision: 147
http://gearbox.svn.sourceforge.net/gearbox/?rev=147&view=rev
Author: russo2503v
Date: 2008-06-03 06:53:43 -0700 (Tue, 03 Jun 2008)
Log Message:
-----------
big cleanup. removed frame assembly. untested on hardware
Modified Paths:
--------------
gearbox/trunk/submitted/gbxgarminacfr/doc.dox
gearbox/trunk/submitted/gbxgarminacfr/driver.cpp
gearbox/trunk/submitted/gbxgarminacfr/driver.h
gearbox/trunk/submitted/gbxgarminacfr/gbxgpsutilacfr/nmea.cpp
gearbox/trunk/submitted/gbxgarminacfr/gbxgpsutilacfr/nmea.h
gearbox/trunk/submitted/gbxgarminacfr/test/test.cpp
Modified: gearbox/trunk/submitted/gbxgarminacfr/doc.dox
===================================================================
--- gearbox/trunk/submitted/gbxgarminacfr/doc.dox 2008-06-02 03:04:54 UTC (rev 146)
+++ gearbox/trunk/submitted/gbxgarminacfr/doc.dox 2008-06-03 13:53:43 UTC (rev 147)
@@ -56,6 +56,151 @@
$ cmake -DICEUTIL_HOME=/home/myuser/install .
@endverbatim
+@section gbx_library_gbxgarminacfr What is EPE?
+
+Bits of information assembled by Duncan Mercer.
+
+A quote from Garmin Engineering:
+
+The EPE is an estimation based upon the information the receiver
+can determine. SA consists of artificial clock errors and
+artificial ephemeral errors. Both of these effects, as well as
+atmospheric effects, can result in a positional area of uncer-
+tainty, which can be measured and will add to the receivers EPE.
+Bias errors cannot be measured and will typically not be detected
+in the EPE calculation.
+
+The 12XL will typically have a better EPE than other units due to
+the 12 channel correlator and the use of all tracked satellites
+in the positional computation.
+
+EPE is an estimation, rather than a measurement, but all
+measurable factors are used in the estimation algorithm. We
+consider the details of our EPE and FOM calculations proprietary.
+
+We calculate EPE our own way. URE and HDOP are definitely
+significant factors in the calculation. We calculate an over-
+determined solution, and fully understand the characteristics of
+SA, and are able (in our opinion) to provide for a better
+estimate of current position error than the simplistic calcula-
+tions will indicate.
+
+Many folks have and will demand to know our specific calcula-
+tions, but we consider these to be proprietary and we do not
+release the specific formulas. This is similar in our FOM
+calculation, we use a lot of finesse in our software which other
+manufacturers have not been able to duplicate. This is further
+evidenced by Dr. Wilson's reports on our accuracy compared to
+other receivers. If the tests were performed, I believe you would
+see closer correlation between our EPE values and actual errors,
+as compared to other manufacturers units.
+@endverbatim
+
+From Joe Mehaffey:
+
+@verbatim
+One experimenter has found that about 2/3 of the time, the
+ACTUAL error is less than the EPE readout on a Garmin 45 GPS unit
+tested. Your figures may vary. So.. EPE really is an estimate
+not a guarantee or a measurement.
+@endverbatim
+
+Sam Wormley offers the following additional information on EPE:
+
+@verbatim
+Garmin does not give an explanation for the EPE calculation
+displayed on a number of their handheld receivers. EPE is an
+acronym for "Estimated Position Error". See page 18 of the GPS
+12XL Owner's Manual and Reference. The behavior of EPE is not
+identical on all of Garmin's receivers... some reflect the dgps
+mode and others do not.
+
+A number of sources indicate the error in position can be
+estimated by the simple calculation DOP * URA with the former
+calculated in the GPS receiver from the geometry of the satel-
+lites used in the position solution and the later derived and
+computed from the GPS message transmitted by each satellite.
+
+DOP - Dilution of Precision - TDOP, PDOP, HDOP, VDOP, etc. are,
+in effect, multipliers that, when used with some measure of
+positioning statistic, can give you a realistic expectation of
+probability of error.
+
+URA - User Range Accuracy - this is a quantity that is transmit-
+ted in the navigation message that is the predicted (not
+measured) statistical ranging accuracy. Since it is defined for
+SPS (Standard Positioning Service), it includes SA.
+@endverbatim
+
+More from Sam Wormley (http://www.cnde.iastate.edu/gps.html)
+
+@verbatim
+The NMEA sentence $GPGGA recorded periodically over at least a
+twenty-four-hour period may provide enough data to draw a
+conclusion. This is a good experiment for all to try who have
+the capability to capture data.... you will learn much.
+
+Many of you may have better approaches than mine to gather and
+analyse data to resolve the EPE issue.... and, of course it goes
+without saying, we would hold Garmin in high[er] esteem if Garmin
+would give a complete technical discription of the calculation.
+And... if that technical language is over the typical readership
+heads, I'm sure there are many qualified to translate.
+@endverbatim
+
+Bill Stone wrote [March 1997]:
+
+@verbatim
+What does Garmin mean by EPE?
+
+EPE = HDOP * URA (1-sigma) would give a measure of the 68%
+confidence circle, i.e., 68% of your position fixes would fall
+within and 32% would fall outside.
+
+EPE = HDOP * URA (1-sigma) * 2 gives a measure of the 95%
+confidence circle, i.e., 95% of your position fixes would fall
+within and 5% would fall outside.
+
+EPE = HDOP * URA (1-sigma) * 0.73 gives a measure of the 50%
+confidence circle, i.e., 50% of your position fixes would fall
+within and 50% would fall outside. This is also known in the
+literature as CEP (Circular Error Probable).
+
+This latter expression is what several of you have indicated that
+you think Garmin's EPE calculation is for the Garmin 12XL. There
+may also be an "EPE filter" to minimize the EPE figure from
+jumping about to much.
+
+There should be a "reasonable correlation" between HDOP and outer
+radial position from a known geodetic point (could be determined
+over a long period of time by statisical averaging). I use the
+word "reasonable" because the comparison involves the points
+wandering around mostly within a circle of confidence, whereas
+HDOP will relate to the radius of that circle of confidence.
+@endverbatim
+
+To further complicate the analysis, witout an absolutely clear
+view of the sky, you can expect the HDOP to take jumps as
+satellites are obstructed from view. This might not be a bad
+idea to collect data under conditions less than desireable. John
+Franke reports:
+
+@verbatim
+It is interesting to see what happens under certain
+alinements. I recently had a case where the receiver (6
+channel, parallel) was tracking 4 satellites but was doing
+2D NAV and the HDOP was 32. A quick look at the satellite
+position screen showed the 4 tracked satellites to be in a
+straight line. There were other satellites available but
+the view to them was blocked by buildings. So, knowing the
+orbits repeat but are several minutes earlier each day, I
+watched the next day to see the alinement develop and the
+PDOP change. In less than twenty minutes the receiver went
+from 3D NAV with a PDOP of 2.3 to 2D NAV and a HDOP of 30
+back to 3D NAV and PDOP of 2.4! Quite impressive and
+educational to observe.
+@endverbatim
+
*/
Modified: gearbox/trunk/submitted/gbxgarminacfr/driver.cpp
===================================================================
--- gearbox/trunk/submitted/gbxgarminacfr/driver.cpp 2008-06-02 03:04:54 UTC (rev 146)
+++ gearbox/trunk/submitted/gbxgarminacfr/driver.cpp 2008-06-03 13:53:43 UTC (rev 147)
@@ -11,8 +11,7 @@
#include <iostream>
#include <sstream>
#include <gbxsickacfr/gbxutilacfr/gbxutilacfr.h>
-// #include <IceUtil/IceUtil.h>
-// #include <gbxsickacfr/gbxiceutilacfr/gbxiceutilacfr.h>
+#include <gbxgarminacfr/gbxgpsutilacfr/nmea.h>
#include <cstdlib>
#include <sys/time.h>
#include <time.h>
@@ -23,6 +22,133 @@
using namespace std;
using namespace gbxgarminacfr;
+///////////////////////////////////////
+
+namespace {
+
+// Get the useful bits from a GGA message
+GenericData* extractGgaData( gbxgpsutilacfr::NmeaMessage& msg, int timeSec, int timeUsec )
+{
+ GgaData* data = new GgaData;
+
+ data->timeStampSec = timeSec;
+ data->timeStampUsec = timeUsec;
+
+ //Names for the tokens in the GGA message
+ enum GgaTokens{MsgType=0,UTC,Lat,LatDir,Lon,LonDir,FixType,
+ NSatsUsed,HDOP,Hgt,M1,GeoidHgt,M2,DiffAge,DiffId};
+
+ // fix type
+ switch (msg.getDataToken(FixType)[0])
+ {
+ case '0':
+ data->fixType = Invalid;
+ // NOTE: not processing the rest!
+ return data;
+ case '1':
+ data->fixType = Autonomous;
+ break;
+ case '2':
+ data->fixType = Differential;
+ break;
+ }
+
+ //UTC time
+ sscanf(msg.getDataToken(UTC).c_str(),"%02d%02d%lf",
+ &data->utcTimeHrs, &data->utcTimeMin, &data->utcTimeSec );
+ //position
+ int deg;
+ double min;
+ double dir;
+
+ //latitude
+ sscanf(msg.getDataToken(Lat).c_str(),"%02d%lf",°,&min);
+ dir = (*msg.getDataToken(LatDir).c_str()=='N') ? 1.0 : -1.0;
+ data->latitude=dir*(deg+(min/60.0));
+ //longitude
+ sscanf(msg.getDataToken(Lon).c_str(),"%03d%lf",°,&min);
+ dir = (*msg.getDataToken(LonDir).c_str()=='E') ? 1.0 : -1.0;
+ data->longitude=dir*(deg+(min/60.0));
+
+ //number of satellites in use
+ data->satellites = atoi(msg.getDataToken(NSatsUsed).c_str());
+
+ //altitude
+ data->altitude=atof(msg.getDataToken(Hgt).c_str());
+
+ //geoidal Separation
+ data->geoidalSeparation=atof(msg.getDataToken(GeoidHgt).c_str());
+
+ return data;
+}
+
+// VTG provides velocity and heading information
+GenericData* extractVtgData( gbxgpsutilacfr::NmeaMessage& msg, int timeSec, int timeUsec )
+{
+ VtgData* data = new VtgData;
+
+ data->timeStampSec = timeSec;
+ data->timeStampUsec = timeUsec;
+
+ //Names for the VTG message items
+ enum VtgTokens{MsgType=0,HeadingTrue,T,HeadingMag,M,SpeedKnots,
+ N,SpeedKPH,K,ModeInd};
+
+ //Check for an empty string. Means that we are not moving
+ //When the message has empty fields tokeniser skips so we get the next field inline.
+ if(msg.getDataToken(HeadingTrue)[0] == 'T' ) {
+ data->headingTrue=0.0;
+ data->headingMagnetic=0.0;
+ data->speed=0.0;
+ data->climbRate=0.0;
+ // NOTE: not processing the rest!
+ return data;
+ }
+
+ // true heading
+ double headingRad = DEG2RAD(atof(msg.getDataToken(HeadingTrue).c_str()));
+ NORMALISE_ANGLE( headingRad );
+ data->headingTrue=headingRad;
+
+ // magnetic heading
+ headingRad = DEG2RAD(atof(msg.getDataToken(HeadingMag).c_str()));
+ NORMALISE_ANGLE( headingRad );
+ data->headingMagnetic=headingRad;
+
+ //speed - converted to m/s
+ data->speed=atof(msg.getDataToken(SpeedKPH).c_str());
+ data->speed*=(1000/3600.0);
+
+ //set to zero
+ data->climbRate=0.0;
+
+ return data;
+}
+
+// RME message. This one is garmin specific... Give position error estimates
+// See doc.dox for a discussion of the position errors as reported here.
+// Essentially the EPE reported by the garmin is a 1 sigma error (RMS) or a
+// 68% confidence bounds.
+GenericData* extractRmeData( gbxgpsutilacfr::NmeaMessage& msg, int timeSec, int timeUsec )
+{
+ RmeData* data = new RmeData;
+
+ data->timeStampSec = timeSec;
+ data->timeStampUsec = timeUsec;
+
+ //Names for the RME message items
+ enum RmeTokens{MsgType=0,HError,M1,VError,M2,EPE,M3};
+
+ data->horizontalPositionError = atof(msg.getDataToken(HError).c_str());
+ data->verticalPositionError = atof(msg.getDataToken(VError).c_str());
+
+ return data;
+}
+
+}
+
+///////////////////////////////////////
+
bool
Config::isValid() const
{
@@ -35,7 +161,9 @@
Config::toString() const
{
std::stringstream ss;
- ss << "Garmin driver config: device="<<device;
+ ss << "Garmin driver config: " <<
+ "\tdevice="<<device <<
+ "\twill read sentences: GPGGA="<<readGga<<" GPVTG="<<readVtg<<" PGRME="<<readRme;
return ss.str();
}
@@ -51,7 +179,7 @@
if ( !config_.isValid() )
{
stringstream ss;
- ss << __func__ << "(): Invalid config: " << config_.toString();
+ ss << "Invalid config: " << config_.toString();
throw gbxsickacfr::gbxutilacfr::Exception( ERROR_INFO, ss.str() );
}
@@ -59,12 +187,10 @@
ssDebug << "Connecting to GPS on serial port " << config_.device;
tracer_.debug( ssDebug.str() );
- // there's no need to make this configurable
-// int baud = context_.properties().getPropertyAsIntWidDefault( prefix+"Baud", 4800 );
+ // BAUD rate is dictated by the NMEA standard.
int baud = 4800;
- // according to Duncan, the first 5 initialization messages come in 1 sec.
- // 2 secs should be conservative.
+ // the first 5 initialization messages come in 1 sec. Therefore, 2 secs should be conservative.
serial_.reset( new gbxserialacfr::Serial( config_.device, baud, gbxserialacfr::Serial::Timeout(2,0) ) );
init();
@@ -75,23 +201,12 @@
disableDevice();
}
-void
-Driver::read( Data &data )
-{
- return readFrame( data );
-}
-
void
Driver::init()
{
- //Make sure that we clear our internal data structures
- memset((void*)(&nmeaMessage_) , 0 , sizeof(nmeaMessage_));
- memset((void*)(&gpsData_) , 0 , sizeof(gpsData_));
-
try {
enableDevice();
//TODO Need to check here that we have been successful.
- clearFrame();
}
catch ( const gbxserialacfr::SerialException &e )
{
@@ -102,12 +217,9 @@
}
}
-//*****************************************************************************
-
void
Driver::enableDevice()
{
-
//Create the messages that we are going to send and add the checksums
//Note that the checksum field is filled with 'x's before we start
gbxgpsutilacfr::NmeaMessage DisableAllMsg("$PGRMO,,2*xx\r\n",gbxgpsutilacfr::AddChecksum);
@@ -128,277 +240,131 @@
sleep(1);
}
-
-
-//***********************************************************************
void
Driver::disableDevice()
{
-
//Simply send the no messages command!
gbxgpsutilacfr::NmeaMessage DisableAllMsg("$PGRMO,,2*xx\r\n",gbxgpsutilacfr::AddChecksum);
serial_->writeString(DisableAllMsg.sentence());
}
+std::auto_ptr<GenericData>
+Driver::read()
+{
+ std::auto_ptr<GenericData> genericData;
+ gbxgpsutilacfr::NmeaMessage nmeaMessage;
+ // Make sure that we clear our internal data structures
+ // alexm: is this necessary? should NmeaMessage do it for itself?
+ memset((void*)(&nmeaMessage) , 0 , sizeof(nmeaMessage));
+ int nmeaExceptionCount = 0;
+ int nmeaFailChecksumCount = 0;
-//****************************************************************************
-// Read one complete frame of data. IE all the messages that we need before returning the data.
-
-void
-Driver::readFrame(Data& GpsData)
-{
+ while ( true )
+ {
+ string serialData;
- string serial_data;
- int gpsMsgNotYetGotFrameCount = 0;
-
- //How many messages are we looking for to make our frame
- const int N_MSGS_IN_FRAME = 3;
-
- //Clear our data before we start trying to assemble the frame
- clearFrame();
-
-
- while(! haveCompleteFrame() ){
-
+ //
// This will block up to the timeout
+ //
tracer_.debug( "Driver::read(): calling serial_->readLine()", 10 );
- int ret = serial_->readLine(serial_data);
- tracer_.debug( serial_data, 10 );
-
-// timeOfRead_ = IceUtil::Time::now();
-// gbxsickacfr::gbxiceutilacfr::now( timeOfReadSec_, timeOfReadUsec_ );
+ int ret = serial_->readLine(serialData);
+
+ // get time stamp right away (Linux only!)
timeval now;
if ( gettimeofday( &now, 0 ) != 0 ) {
stringstream ss;
ss << "Pproblem getting timeofday: " << strerror(errno) << endl;
throw gbxsickacfr::gbxutilacfr::Exception( ERROR_INFO,ss.str() );
}
-
- if ( ret<0 ) {
- throw gbxsickacfr::gbxutilacfr::Exception( ERROR_INFO, "Driver: Timeout reading from serial port" );
- }
- if(ret==0) {
+ // zero tolerance to serial errors
+ if ( ret<0 )
+ throw gbxsickacfr::gbxutilacfr::Exception( ERROR_INFO, "Driver: Timeout reading from serial port" );
+ if ( ret==0 )
throw gbxsickacfr::gbxutilacfr::Exception( ERROR_INFO,"Driver: Read 0 bytes from serial port");
- }
//
// We successfully read something from the serial port
//
+ tracer_.debug( serialData, 10 );
-
//Put it into the message object and checksum the data
- static int nmeaExceptionCount =0;
- try{
- //This throws if it cannot find the * to deliminate the checksum field
- nmeaMessage_.setSentence(serial_data.c_str(),gbxgpsutilacfr::TestChecksum);
+ try {
+ // This throws if it cannot find the * to deliminate the checksum field
+ nmeaMessage.setSentence( serialData.c_str(), gbxgpsutilacfr::TestChecksum );
}
- catch (gbxgpsutilacfr::NmeaException &e){
- //Don't throw if only occasional messages are missing the checksums
- if(nmeaExceptionCount++ < 3) {return;}
+ catch ( const gbxgpsutilacfr::NmeaException& e ) {
+ //Don't throw on isolated checksum problems
+ if ( nmeaExceptionCount++ < 3 ) {
+ continue;
+ }
stringstream ss;
- ss << "MainThread: Problem reading from GPS: " << e.what();
+ ss << "Problem reading from GPS: " << e.what();
tracer_.error( ss.str() );
throw gbxsickacfr::gbxutilacfr::Exception( ERROR_INFO,ss.str());
}
nmeaExceptionCount = 0;
- //Only populate the data structures if our message passes the checksum!
- static int nmeaFailChecksumCount =0;
- if(nmeaMessage_.haveValidChecksum()){
- nmeaFailChecksumCount = 0;
- addDataToFrame();
- }else{
- if(nmeaFailChecksumCount++ >= 3){ //Dont throw an exception on the first failed checksum.
- throw gbxsickacfr::gbxutilacfr::Exception( ERROR_INFO,"Driver: more than 3 sequential messages failed the checksum\n");
- }else{
- tracer_.error("Driver: Single message failed checksum. Not throwing an exception yet!\n" );
+ // Only populate the data structures if our message passes the checksum!
+ if ( !nmeaMessage.haveValidChecksum() ) {
+ // Dont throw an exception on the first failed checksum.
+ if ( nmeaFailChecksumCount++ < 3 ) {
+ tracer_.warning("Gps driver: Single message failed checksum. Not throwing an exception yet!" );
+ continue;
}
+ else {
+ throw gbxsickacfr::gbxutilacfr::Exception( ERROR_INFO,"More than 3 sequential messages failed the checksum");
+ }
}
+ nmeaFailChecksumCount = 0;
- //Make sure that we do not wait for ever trying to get a frame of data
- //Note that we might need to skip the N * $PGRMO messages echoed back from receiver when starting
- //As well as the N * messages that we are looking for
- if(gpsMsgNotYetGotFrameCount++ >= (N_MSGS_IN_FRAME * 3)){
- throw gbxsickacfr::gbxutilacfr::Exception( ERROR_INFO,"Driver: Not able to assemble a complete data frame\n");
+ //First split up the data fields in the string we have read.
+ nmeaMessage.parseTokens();
+
+ //We should not get any messages with failed checksums, but just in case
+ if( nmeaMessage.haveTestedChecksum() && (!nmeaMessage.haveValidChecksum()) ) {
+ throw gbxsickacfr::gbxutilacfr::Exception( ERROR_INFO,"Driver: Message fails checksum");
}
+
+ //And then find out which type of messge we have recieved...
+ string MsgType = nmeaMessage.getDataToken(0);
+
+ if ( MsgType == "$GPGGA" ) {
+ tracer_.debug("got GGA message",4);
+ if ( !config_.readGga )
+ continue;
+ genericData.reset( extractGgaData( nmeaMessage, now.tv_sec, now.tv_usec ) );
+ break;
+ }
+ else if ( MsgType == "$GPVTG" ) {
+ tracer_.debug("got VTG message",4);
+ if ( !config_.readVtg )
+ continue;
+ genericData.reset( extractVtgData( nmeaMessage, now.tv_sec, now.tv_usec ) );
+ break;
+ }
+ else if ( MsgType == "$PGRME" ) {
+ tracer_.debug("got RME message",4);
+ if ( !config_.readRme )
+ continue;
+ genericData.reset( extractRmeData( nmeaMessage, now.tv_sec, now.tv_usec ) );
+ break;
+ }
+ else if ( MsgType == "$PGRMO" ) {
+ //This message is sent by us to control msg transmission and then echoed by GPS
+ //So we can just ignore it
+ continue;
+ }
+ else {
+ // if we get here the msg is unknown
+ stringstream ErrMsg;
+ ErrMsg << "Message type unknown " << MsgType <<endl;
+ throw gbxsickacfr::gbxutilacfr::Exception( ERROR_INFO,ErrMsg.str());
+ }
}
- tracer_.debug("GPS got a complete frame\n", 10 );
-
- // Hand the data back to the outside world
- GpsData=gpsData_;
+ return genericData;
}
-
-
-
-
-//**********************************************************************************
-
-void
-Driver::addDataToFrame()
-{
- //First split up the data fields in the string we have read.
- nmeaMessage_.parseTokens();
-
- //We should not be being passed any messages with failed checksums, but just in case
- if(nmeaMessage_.haveTestedChecksum() && (!nmeaMessage_.haveValidChecksum())){
- throw gbxsickacfr::gbxutilacfr::Exception( ERROR_INFO,"Driver: Message fails checksum");
- }
-
- //And then find out which type of messge we have recieved...
- string MsgType = nmeaMessage_.getDataToken(0);
-
- if(MsgType == "$GPGGA"){
- tracer_.debug("got GGA message\n",4);
- extractGGAData();
- haveGGA_ = true;
- return;
- }else if(MsgType == "$GPVTG"){
- tracer_.debug("got VTG message\n",4);
- extractVTGData();
- haveVTG_ = true;
- return;
- }else if(MsgType == "$PGRME"){
- tracer_.debug("got RME message\n",4);
- extractRMEData();
- haveRME_ = true;
- return;
- }else if(MsgType == "$PGRMO"){
- //This message is sent by us to control msg transmission and then echoed by GPS
- //So we can just ignore it
- return;
- }else{
- // if we get here the msg is unknown
- stringstream ErrMsg;
- ErrMsg << "Message type unknown " << MsgType <<endl;
- throw gbxsickacfr::gbxutilacfr::Exception( ERROR_INFO,ErrMsg.str());
- }
-}
-
-
-//**************************************************************************************
-// Get the useful bits from a GGA message
-
-void
-Driver::extractGGAData(void){
-
- //Names for the tokens in the GGA message
- enum GGATokens{MsgType=0,UTC,Lat,LatDir,Lon,LonDir,FixType,
- NSatsUsed,HDOP,Hgt,M1,GeoidHgt,M2,DiffAge,DiffId};
-
- //cout << nmeaMessage_.sentence()<<endl;
-
- //position fix type
- switch (nmeaMessage_.getDataToken(FixType)[0])
- {
- case '0':
- gpsData_.positionType = GpsPositionTypeNotAvailable;
- return;
- case '1':
- gpsData_.positionType = GpsPositionTypeAutonomous;
- break;
- case '2':
- gpsData_.positionType = GpsPositionTypeDifferential;
- break;
- }
-
-// gpsData_.timeStamp = orcaice::toOrcaTime (timeOfRead_);
-// gbxiceutil::timeFromIceUtil( timeOfRead_, gpsData_.timeStampSec, gpsData_.timeStampUsec );
- gpsData_.timeStampSec = timeOfReadSec_;
- gpsData_.timeStampUsec = timeOfReadUsec_;
-
- //UTC time
- sscanf(nmeaMessage_.getDataToken(UTC).c_str(),"%02d%02d%lf",
- &gpsData_.utcTimeHrs, &gpsData_.utcTimeMin, &gpsData_.utcTimeSec );
- //position
- int deg;
- double min;
- double dir;
-
- //latitude
- sscanf(nmeaMessage_.getDataToken(Lat).c_str(),"%02d%lf",°,&min);
- dir = (*nmeaMessage_.getDataToken(LatDir).c_str()=='N') ? 1.0 : -1.0;
- gpsData_.latitude=dir*(deg+(min/60.0));
- //longitude
- sscanf(nmeaMessage_.getDataToken(Lon).c_str(),"%03d%lf",°,&min);
- dir = (*nmeaMessage_.getDataToken(LonDir).c_str()=='E') ? 1.0 : -1.0;
- gpsData_.longitude=dir*(deg+(min/60.0));
-
- //number of satellites in use
- gpsData_.satellites = atoi(nmeaMessage_.getDataToken(NSatsUsed).c_str());
-
- //altitude
- gpsData_.altitude=atof(nmeaMessage_.getDataToken(Hgt).c_str());
-
- //geoidal Separation
- gpsData_.geoidalSeparation=atof(nmeaMessage_.getDataToken(GeoidHgt).c_str());
-
-
- //cout << "Lat " << GpsData_.latitude << " Long " << GpsData_.longitude ;
- //cout << " Hght "<< GpsData_.altitude << " Geoid "<< GpsData_.geoidalSeparation << endl;
-
- // Set flag
-
- return;
-}
-
-
-//********************************************************************
-// VTG provides velocity and heading information
-void
-Driver::extractVTGData(void){
-
- //Names for the VTG message items
- enum VTGTokens{MsgType=0,HeadingTrue,T,HeadingMag,M,SpeedKnots,
- N,SpeedKPH,K,ModeInd};
-
- //Check for an empty string. Means that we are not moving
- //When the message has empty fields tokeniser skips so we get the next field inline.
- if(nmeaMessage_.getDataToken(HeadingTrue)[0] == 'T' ){
- gpsData_.speed=0.0;
- gpsData_.climbRate=0.0;
- gpsData_.heading=0.0;
- return;
- }
-
- //heading
- double headingRad = DEG2RAD(atof(nmeaMessage_.getDataToken(HeadingTrue).c_str()));
- NORMALISE_ANGLE( headingRad );
- gpsData_.heading=headingRad;
- //speed - converted to m/s
- gpsData_.speed=atof(nmeaMessage_.getDataToken(SpeedKPH).c_str());
- gpsData_.speed*=(1000/3600.0);
- //set to zero
- gpsData_.climbRate=0.0;
-
- //cout << nmeaMessage_.sentence() << endl;
- // cout << "head "<< RAD2DEG(GpsData_.heading) << " speed " << GpsData_.speed << endl;
-
- return;
-}
-
-
-//*********************************************************************************************
-// RME message. This one is garmin specific... Give position error estimates
-// See the file garminErrorPositionEstimate.txt for a discussion of the position errors as
-// reported here. Essentially the EPE reported by the garmin is a 1 sigma error (RMS) or a
-// 68% confidence bounds.
-
-void
-Driver::extractRMEData(void){
- //Names for the RME message items
- enum VTGTokens{MsgType=0,HError,M1,VError,M2,EPE,M3};
-
- gpsData_.horizontalPositionError = atof(nmeaMessage_.getDataToken(HError).c_str());
- gpsData_.verticalPositionError = atof(nmeaMessage_.getDataToken(VError).c_str());
-
- //cout << nmeaMessage_.sentence() << endl;
- //cout << "Herr " << GpsData_.horizontalPositionError << " Verr " << GpsData_.verticalPositionError<<endl;
-
- return;
-
-}
Modified: gearbox/trunk/submitted/gbxgarminacfr/driver.h
===================================================================
--- gearbox/trunk/submitted/gbxgarminacfr/driver.h 2008-06-02 03:04:54 UTC (rev 146)
+++ gearbox/trunk/submitted/gbxgarminacfr/driver.h 2008-06-03 13:53:43 UTC (rev 147)
@@ -14,7 +14,6 @@
#include <gbxserialacfr/serial.h>
#include <gbxsickacfr/gbxutilacfr/tracer.h>
#include <gbxsickacfr/gbxutilacfr/status.h>
-#include <gbxgarminacfr/gbxgpsutilacfr/nmea.h>
#include <memory>
namespace gbxgarminacfr {
@@ -23,106 +22,211 @@
class Config
{
public:
- Config() {};
+ Config() :
+ readGga(true),
+ readVtg(true),
+ readRme(true) {};
+ //! Returns true if the configuration is sane.
bool isValid() const;
+ //! Returns human-readable configuration description.
std::string toString() const;
//! Serial device. e.g. "/dev/ttyS0"
std::string device;
+
+ //! Read PGGGA sentence
+ bool readGga;
+ //! Read PGVTG sentence
+ bool readVtg;
+ //! Read GPRME sentence
+ bool readRme;
};
+//! Possible types GenericData can contain
+enum DataType
+{
+ //! Contents of PGGGA message.
+ GpGga,
+ //! Contents of PGVTG message.
+ GpVtg,
+ //! Contents of PGRME message.
+ PgRme
+};
-//! Gps position types.
-//! Using Novatel codes here is probably not the best thing. With more
-//! thought it's probably possible to categorize these position types
-//! into more generic categories. For now, non-Novatel receivers should
-//! use the generic types listed first.
-enum PositionType {
+//! Possible Status Messages GenericData can contain
+enum StatusMessageType
+{
+ //! Nothing new, no message
+ NoMsg,
+ //! All good, but something to say
+ Ok,
+ //! Problem, likely to go away
+ Warning,
+ //! Problem, probably fatal
+ Fault
+};
+
+//! Generic data type returned by a read
+class GenericData
+{
+public:
+ virtual ~GenericData(){};
+ //! Returns data type.
+ virtual DataType type() const=0;
+ //! Status message type.
+ StatusMessageType statusMessageType;
+ //! Status message
+ std::string statusMessage;
+
+private:
+};
+
+//! GPS fix types.
+enum FixType
+{
//! Invalid or not available
- GpsPositionTypeNotAvailable,
+ Invalid,
//! Autonomous position
//! (This is the normal case for non-differential GPS)
- GpsPositionTypeAutonomous,
+ Autonomous,
//! Differentially corrected
- GpsPositionTypeDifferential,
- NovatelNone,
- NovatelFixedPos,
- NovatelFixedHeigth,
- NovatelFloatConv,
- NovatelWideLane,
- NovatelNarrowLane,
- NovatelDopplerVelocity,
- NovatelSingle,
- NovatelPsrDiff,
- NovatelWAAS,
- NovatelPropagated,
- NovatelOmnistar,
- NovatelL1Float,
- NovatelIonFreeFloat,
- NovatelNarrowFloat,
- NovatelL1Int,
- NovatelWideInt,
- NovatelNarrowInt,
- NovatelRTKDirectINS,
- NovatelINS,
- NovatelINSPSRSP,
- NovatelINSPSRFLOAT,
- NovatelINSRTKFLOAT,
- NovatelINSRTKFIXED,
- NovatelOmnistarHP,
- NovatelUnknown
+ Differential
};
-//! Gps data structure
-struct Data
+//! Fix data structure
+struct GgaData : public GenericData
{
+public:
+ DataType type() const { return GpGga; }
+
//! Time (according to the computer clock) when data was measured.
//! Number of seconds
int timeStampSec;
//! Time (according to the computer clock) when data was measured.
//! Number of microseconds
int timeStampUsec;
- //! UTC time (according to GPS device), reference is Greenwich.
+
+ //! UTC time (according to the GPS device), reference is Greenwich.
//! Hour [0..23]
int utcTimeHrs;
- //! UTC time (according to GPS device), reference is Greenwich.
+ //! UTC time (according to the GPS device), reference is Greenwich.
//! Minutes [0..59]
int utcTimeMin;
- //! UTC time (according to GPS device), reference is Greenwich.
+ //! UTC time (according to the GPS device), reference is Greenwich.
//! Seconds [0.0..59.9999(9)]
double utcTimeSec;
- //! Latitude (degrees)
+ //! Latitude [degrees]
double latitude;
- //! Longitude (degrees)
+ //! Longitude [degrees]
double longitude;
- //! Altitude (metres above ellipsoid)
+ //! Altitude [metres above ellipsoid]
double altitude;
- //! Horizontal position error: one standard deviation (metres)
- double horizontalPositionError;
- //! Vertical position error: one standard deviation (metres)
- double verticalPositionError;
-
- //! Heading/track/course with respect to true north (rad)
- double heading;
- //! Horizontal velocity (metres/second)
- double speed;
- //! Vertical velocity (metres/second)
- double climbRate;
-
+ //! Fix type.
+ FixType fixType;
+
//! Number of satellites
int satellites;
- int observationCountOnL1;
- int observationCountOnL2;
- //! Position type (see above)
- PositionType positionType;
- //! Geoidal Separation (metres)
+
+ //! Horizontal dilution of position [metres]
+ double horizontalDilutionOfPosition;
+
+ //! Height of geoid (mean sea level) above WGS84 ellipsoid [metres]
double geoidalSeparation;
};
+//! Vector track and speed over ground data structure.
+class VtgData : public GenericData
+{
+public:
+ DataType type() const { return GpVtg; }
-//! Garmin driver
+ //! Time (according to the computer clock) when data was measured.
+ //! Number of seconds
+ int timeStampSec;
+ //! Time (according to the computer clock) when data was measured.
+ //! Number of microseconds
+ int timeStampUsec;
+
+ //! Heading/track/course with respect to true North [rad]
+ double headingTrue;
+ //! Heading/track/course with respect to magnetic North [rad]
+ double headingMagnetic;
+ //! Horizontal velocity [metres/second]
+ double speed;
+ //! Vertical velocity [metres/second]
+ double climbRate;
+};
+
+ enum VTGTokens{MsgType=0,HError,M1,VError,M2,EPE,M3};
+
+//! Gps data structure
+class RmeData : public GenericData
+{
+public:
+ DataType type() const { return PgRme; }
+
+ //! Time (according to the computer clock) when data was measured.
+ //! Number of seconds
+ int timeStampSec;
+ //! Time (according to the computer clock) when data was measured.
+ //! Number of microseconds
+ int timeStampUsec;
+
+ //! Horizontal position error: one standard deviation [metres)]
+ double horizontalPositionError;
+ //! Vertical position error: one standard deviation [metres]
+ double verticalPositionError;
+};
+
+/*!
+
+Garmin GPS driver
+
+
+Referennces:
+- http://en.wikipedia.org/wiki/NMEA
+- http://www.gpsinformation.org/dale/interface.htm
+
+All Garmin receivers understand the latest standard which is called: 0183 version 2.0.
+
+This standard dictates a transfer rate of 4800 baud.
+
+Out of all the messages below, this driver can read only the following messages (sentences):
+- GPGGA
+- GPVTG
+- PGRME
+
+The sentences sent by Garmin receivers include:
+NMEA 2.0
+- GPBOD bearing, origin to destination - earlier G-12's do not transmit this
+- GPGGA fix data
+- GPGLL Lat/Lon data - earlier G-12's do not transmit this
+- GPGSA overall satellite reception data
+- GPGSV detailed satellite data
+- GPRMB minimum recommended data when following a route
+- GPRMC minimum recommended data
+- GPRTE route data
+- GPWPL waypoint data (this is bidirectional)
+
+NMEA 1.5 - some units do not support version 1.5
+- GPBOD bearing origin to destination - earlier G-12's do not send this
+- GPBWC bearing to waypoint using great circle route.
+- GPGLL lat/lon - earlier G-12's do not send this
+- GPRMC minimum recommend data
+- GPRMB minimum recommended data when following a route
+- GPVTG vector track and speed over ground
+- GPWPL waypoint data (only when active goto)
+- GPXTE cross track error
+
+In addition Garmin receivers send the following Proprietary Sentences:
+- PGRME (estimated error) - not sent if set to 0183 1.5
+- PGRMM (map datum)
+- PGRMZ (altitude)
+- PSLIB (beacon receiver control)
+
+*/
class Driver
{
@@ -133,44 +237,23 @@
//! gbxutilacfr::Tracer and gbxutilacfr::Status allow
//! (human-readable and machine-readable respectively) external
//! monitorining of the driver's internal state.
- Driver( const Config &config,
- gbxsickacfr::gbxutilacfr::Tracer &tracer,
- gbxsickacfr::gbxutilacfr::Status &status );
+ Driver( const Config& config,
+ gbxsickacfr::gbxutilacfr::Tracer& tracer,
+ gbxsickacfr::gbxutilacfr::Status& status );
~Driver();
-
//! Blocks till new data is available
- void read( Data &data );
+ std::auto_ptr<GenericData> read();
private:
void init();
- void addDataToFrame();
void enableDevice();
void disableDevice();
- int resetDevice();
- void extractGGAData();
- void extractVTGData();
- void extractRMEData();
- void clearFrame(){haveGGA_ = false; haveVTG_ = false; haveRME_ =false;};
- bool haveCompleteFrame(){return (haveGGA_ & haveVTG_ & haveRME_);};
- void readFrame( Data &data);
-
std::auto_ptr<gbxserialacfr::Serial> serial_;
- Data gpsData_;
- gbxgpsutilacfr::NmeaMessage nmeaMessage_;
- int timeOfReadSec_;
- int timeOfReadUsec_;
-
- //*** NOTE:- if we change the number of messages in the frame need to change
- //The N_MSGS_IN_FRAME in the readFrame fn...
- bool haveGGA_;
- bool haveVTG_;
- bool haveRME_;
-
Config config_;
gbxsickacfr::gbxutilacfr::Tracer& tracer_;
gbxsickacfr::gbxutilacfr::Status& status_;
Modified: gearbox/trunk/submitted/gbxgarminacfr/gbxgpsutilacfr/nmea.cpp
===================================================================
--- gearbox/trunk/submitted/gbxgarminacfr/gbxgpsutilacfr/nmea.cpp 2008-06-02 03:04:54 UTC (rev 146)
+++ gearbox/trunk/submitted/gbxgarminacfr/gbxgpsutilacfr/nmea.cpp 2008-06-03 13:53:43 UTC (rev 147)
@@ -103,7 +103,6 @@
default:
assert(true);
}
-
}
@@ -145,7 +144,6 @@
//failed the checksum!
return false;
-
}
@@ -188,7 +186,6 @@
//Put the byte values as upper case HEX back into the message
sprintf(sentence_ + loopCount + 1,"%02X",chkRunning);
-
}
@@ -208,5 +205,4 @@
//keep track of what we have done.
haveTokens_ = true;
-
}
Modified: gearbox/trunk/submitted/gbxgarminacfr/gbxgpsutilacfr/nmea.h
===================================================================
--- gearbox/trunk/submitted/gbxgarminacfr/gbxgpsutilacfr/nmea.h 2008-06-02 03:04:54 UTC (rev 146)
+++ gearbox/trunk/submitted/gbxgarminacfr/gbxgpsutilacfr/nmea.h 2008-06-03 13:53:43 UTC (rev 147)
@@ -68,54 +68,55 @@
// When using class to send data, need to add checksum, when reciving data need to test checksum
// Checksums are usually optional
- enum{TestChecksum, AddChecksum, DontTestOrAddChecksum};
+enum{TestChecksum, AddChecksum, DontTestOrAddChecksum};
// class SOEXPORT NmeaMessage{
- class NmeaMessage{
- public:
- NmeaMessage();
- NmeaMessage(const char *sentence, int testCheckSum = DontTestOrAddChecksum);
+class NmeaMessage
+{
+public:
+ NmeaMessage();
+ NmeaMessage(const char *sentence, int testCheckSum = DontTestOrAddChecksum);
- // Do we only have the raw string ?
- bool haveSentence(){return haveSentence_;};
- // Set up the internal data for a sentence
- void setSentence(const char *data, int testCheckSum = DontTestOrAddChecksum);
- // Have we parsed fields ?
- bool haveTokens(){return haveTokens_;};
- // have we a valid checksum ?
- bool haveValidChecksum(){return checkSumOK_;};
- // have we checked the checksum?
- bool haveTestedChecksum(){return haveCheckSum_;};
- // calculate the checksum from sentence
- // Note that this function may throw NMEA_Exception...
- bool testChecksumOk();
- // Return the raw sentence string
- const char * sentence(){return sentence_;};
- // Return a single data token as a string
- std::string& getDataToken(int i){return dataTokens_[i];};
+ // Set up the internal data for a sentence
+ void setSentence(const char *data, int testCheckSum = DontTestOrAddChecksum);
- // Return the number of fields
- int numDataTokens(){return dataTokens_.size();};
- //Tokenise the string that we received
- void parseTokens();
+ // Do we only have the raw string ?
+ bool haveSentence() const { return haveSentence_; };
+ // Have we parsed fields ?
+ bool haveTokens() const { return haveTokens_; };
+ // have we a valid checksum ?
+ bool haveValidChecksum() const { return checkSumOK_; };
+ // have we checked the checksum?
+ bool haveTestedChecksum()const { return haveCheckSum_; };
+ // calculate the checksum from sentence
+ // Note that this function may throw NMEA_Exception...
+ bool testChecksumOk();
+ // Return the raw sentence string
+ const char * sentence() { return sentence_; };
+ // Return a single data token as a string
+ std::string& getDataToken(int i) { return dataTokens_[i]; };
- private:
- void init();
- void addCheckSum();
- // Do we only have the raw string ?
- bool haveSentence_;
- // Have we parsed data into tokens ?
- bool haveTokens_;
- // Have we a checksum and is it valid?
- bool haveCheckSum_;
- bool checkSumOK_;
- // The raw sentence, allow for terminator
- char sentence_[MAX_SENTENCE_LEN+1];
- // The tokenised data
- std::vector<std::string> dataTokens_;
-
- };
+ // Return the number of fields
+ int numDataTokens() const { return dataTokens_.size(); };
+ //Tokenise the string that we received
+ void parseTokens();
+private:
+ void init();
+ void addCheckSum();
+ // Do we only have the raw string ?
+ bool haveSentence_;
+ // Have we parsed data into tokens ?
+ bool haveTokens_;
+ // Have we a checksum and is it valid?
+ bool haveCheckSum_;
+ bool checkSumOK_;
+ // The raw sentence, allow for terminator
+ char sentence_[MAX_SENTENCE_LEN+1];
+ // The tokenised data
+ std::vector<std::string> dataTokens_;
+};
+
}
#endif
Modified: gearbox/trunk/submitted/gbxgarminacfr/test/test.cpp
===================================================================
--- gearbox/trunk/submitted/gbxgarminacfr/test/test.cpp 2008-06-02 03:04:54 UTC (rev 146)
+++ gearbox/trunk/submitted/gbxgarminacfr/test/test.cpp 2008-06-03 13:53:43 UTC (rev 147)
@@ -24,7 +24,7 @@
using namespace std;
//
-// Instantiates the laser driver, reads a few scans
+// Instantiates the driver, reads a messages
//
int main( int argc, char **argv )
{
@@ -33,7 +33,7 @@
string port = "/dev/ttyS0";
// Get some options from the command line
- while ((opt = getopt(argc, argv, "p:b:")) != -1)
+ while ((opt = getopt(argc, argv, "p:")) != -1)
{
switch ( opt )
{
@@ -42,14 +42,17 @@
break;
default:
cout << "Usage: " << argv[0] << " [-p port]" << endl << endl
- << "-p port\tPort the laser scanner is connected to. E.g. /dev/ttyS0" << endl;
+ << "-p port\tPort the device is connected to. E.g. /dev/ttyS0" << endl;
return 1;
}
}
- // Set up the laser's configuration
+ // Set up the device configuration
gbxgarminacfr::Config config;
config.device = port;
+ config.readGga = true;
+ config.readVtg = true;
+ config.readRme = true;
if ( !config.isValid() ) {
cout << "Test: Invalid device configuration structure: " << config.toString() << endl;
exit(1);
@@ -57,7 +60,7 @@
cout << "Using configuration: " << config.toString() << endl;
// Instantiate objects to handle messages from the driver
- const bool debug=false;
+ const bool debug = false;
gbxsickacfr::gbxutilacfr::TrivialTracer tracer( debug );
gbxsickacfr::gbxutilacfr::TrivialStatus status( tracer );
@@ -74,7 +77,7 @@
}
// Create data structure to store sensor data
- gbxgarminacfr::Data data;
+ std::auto_ptr<gbxgarminacfr::GenericData> data;
// Read a few times
const int numReads = 3;
@@ -82,7 +85,7 @@
{
try
{
- device->read( data );
+ data = device->read();
cout<<"Test: Got data "<<i+1<<" of "<<numReads<<endl;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2008-06-02 03:04:48
|
Revision: 146
http://gearbox.svn.sourceforge.net/gearbox/?rev=146&view=rev
Author: borax00
Date: 2008-06-01 20:04:54 -0700 (Sun, 01 Jun 2008)
Log Message:
-----------
Modified Paths:
--------------
gearbox/trunk/src/gbxserialacfr/serial.h
Modified: gearbox/trunk/src/gbxserialacfr/serial.h
===================================================================
--- gearbox/trunk/src/gbxserialacfr/serial.h 2008-06-01 03:14:13 UTC (rev 145)
+++ gearbox/trunk/src/gbxserialacfr/serial.h 2008-06-02 03:04:54 UTC (rev 146)
@@ -77,6 +77,10 @@
//! but can't set the {en|dis}abled state of timeouts.
void setTimeout( const Timeout &timeout );
+ //! Gets the current timeout.
+ //! A timeout value of (sec=0,usec=0) indicates 'timeouts disabled'.
+ const Timeout &timeout() const { return timeout_; }
+
//! Reads up to @c count bytes into buffer @c buf.
//! Returns the number of bytes read, or '-1' on timeout (if timeouts are enabled).
//! If timeouts are not enabled, blocks till it gets something.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2008-06-01 03:14:06
|
Revision: 145
http://gearbox.svn.sourceforge.net/gearbox/?rev=145&view=rev
Author: borax00
Date: 2008-05-31 20:14:13 -0700 (Sat, 31 May 2008)
Log Message:
-----------
fixed timeout issue.
Modified Paths:
--------------
gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.cpp
Modified: gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.cpp
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.cpp 2008-06-01 02:53:57 UTC (rev 144)
+++ gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.cpp 2008-06-01 03:14:13 UTC (rev 145)
@@ -88,8 +88,8 @@
void
SerialDeviceHandler::walk()
{
- // TODO: this max heartbeat interval should reflect the actual timeout of the serial device.
- subStatus_.setMaxHeartbeatInterval( 2 );
+ double maxIntervalSec = serial_.timeout().sec + 1e6*serial_.timeout().usec;
+ subStatus_.setMaxHeartbeatInterval( maxIntervalSec * 5.0 );
while ( !isStopping() )
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rus...@us...> - 2008-06-01 02:53:48
|
Revision: 144
http://gearbox.svn.sourceforge.net/gearbox/?rev=144&view=rev
Author: russo2503v
Date: 2008-05-31 19:53:57 -0700 (Sat, 31 May 2008)
Log Message:
-----------
printout out a warning on exception during shutdown
Modified Paths:
--------------
gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/subsystemthread.cpp
Modified: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/subsystemthread.cpp
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/subsystemthread.cpp 2008-06-01 02:53:19 UTC (rev 143)
+++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/subsystemthread.cpp 2008-06-01 02:53:57 UTC (rev 144)
@@ -53,10 +53,14 @@
}
// report status fault if there was an exception and we are not stopping
- if ( !ss.str().empty() && !isStopping() )
- {
- tracer_.error( ss.str() );
- subStatus().fault( ss.str() );
+ if ( !ss.str().empty() ) {
+ if ( !isStopping() ) {
+ tracer_.error( ss.str() );
+ subStatus().fault( ss.str() );
+ }
+ else {
+ tracer_.warning( subsysName()+": Caught exception when stopping: "+ss.str() );
+ }
}
else {
tracer_.debug( subsysName()+": dropping out from run() ", 4 );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rus...@us...> - 2008-06-01 02:53:11
|
Revision: 143
http://gearbox.svn.sourceforge.net/gearbox/?rev=143&view=rev
Author: russo2503v
Date: 2008-05-31 19:53:19 -0700 (Sat, 31 May 2008)
Log Message:
-----------
not using subystemthread. using safethread instead with custom substatus
Modified Paths:
--------------
gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.cpp
gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.h
Modified: gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.cpp
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.cpp 2008-06-01 02:52:34 UTC (rev 142)
+++ gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.cpp 2008-06-01 02:53:19 UTC (rev 143)
@@ -47,16 +47,15 @@
gbxutilacfr::Tracer &tracer,
gbxutilacfr::Status &status,
int unparsedBytesWarnThreshold )
- : gbxiceutilacfr::SubsystemThread( tracer, status, subsysName ),
+ : gbxiceutilacfr::SafeThread( tracer ),
serial_(serialPort),
responseParser_(responseParser),
responseBuffer_(-1,gbxiceutilacfr::BufferTypeCircular),
unparsedBytesWarnThreshold_(unparsedBytesWarnThreshold),
tracer_(tracer),
- status_(status)
+ subStatus_( status, subsysName )
{
- status_.setMaxHeartbeatInterval( subsysName, 60 );
- status_.initialising( subsysName );
+ subStatus_.setMaxHeartbeatInterval( 60 );
}
SerialDeviceHandler::~SerialDeviceHandler()
@@ -65,7 +64,7 @@
// The component may outlive this subsystem.
// So tell status that it might not hear from us for a while.
//
- status_.setMaxHeartbeatInterval( subsysName(), 1e9 );
+ subStatus_.setMaxHeartbeatInterval( 1e9 );
}
void
@@ -89,7 +88,8 @@
void
SerialDeviceHandler::walk()
{
- status_.setMaxHeartbeatInterval( subsysName(), 2 );
+ // TODO: this max heartbeat interval should reflect the actual timeout of the serial device.
+ subStatus_.setMaxHeartbeatInterval( 2 );
while ( !isStopping() )
{
@@ -109,7 +109,7 @@
try {
bool statusOK = processBuffer( timeStampSec, timeStampUsec );
if ( statusOK )
- status_.ok( subsysName() );
+ subStatus_.ok();
}
catch ( std::exception &e )
{
@@ -121,7 +121,7 @@
}
else
{
- status_.ok( subsysName() );
+ subStatus_.ok();
}
}
catch ( std::exception &e )
@@ -136,19 +136,19 @@
{
stringstream ss;
ss << "SerialDeviceHandler: Caught Ice exception: " << e;
- status_.fault( subsysName(), ss.str() );
+ subStatus_.fault( ss.str() );
}
catch ( std::exception &e )
{
stringstream ss;
ss << "SerialDeviceHandler: Caught exception: " << e.what();
- status_.fault( subsysName(), ss.str() );
+ subStatus_.fault( ss.str() );
}
catch ( ... )
{
stringstream ss;
ss << "SerialDeviceHandler: Caught unknown exception.";
- status_.fault( subsysName(), ss.str() );
+ subStatus_.fault( ss.str() );
}
}
}
@@ -241,7 +241,7 @@
{
stringstream ss;
ss << "SerialDeviceHandler: Received abnormal response: " << response->toString();
- status_.warning( subsysName(), ss.str() );
+ subStatus_.warning( ss.str() );
statusOK = false;
}
else
Modified: gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.h
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.h 2008-06-01 02:52:34 UTC (rev 142)
+++ gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.h 2008-06-01 02:53:19 UTC (rev 143)
@@ -11,7 +11,8 @@
#define GBXSERIALDEVICEACFR_SERIALDEVICEHANDLER_H
#include <gbxserialacfr/serial.h>
-#include <gbxsickacfr/gbxiceutilacfr/subsystemthread.h>
+#include <gbxsickacfr/gbxutilacfr/substatus.h>
+#include <gbxsickacfr/gbxiceutilacfr/safethread.h>
#include <gbxsickacfr/gbxiceutilacfr/buffer.h>
#include <IceUtil/IceUtil.h>
@@ -85,7 +86,7 @@
//!
//! @author Alex Brooks
//!
-class SerialDeviceHandler : public gbxiceutilacfr::SubsystemThread
+class SerialDeviceHandler : public gbxiceutilacfr::SafeThread
{
public:
@@ -95,8 +96,6 @@
// - unparsedBytesWarnThreshold: if we get more than this many un-parsed bytes packed into the
// receive buffer, flag a warning.
// - serialPort_: must have timeouts enabled
- // - serialTimeout: the timout to use when reading fromt he serial port
- // (controls the frequency of the loop)
SerialDeviceHandler( const std::string &subsysName,
gbxserialacfr::Serial &serialPort,
IResponseParser &responseParser,
@@ -139,7 +138,7 @@
int unparsedBytesWarnThreshold_;
gbxutilacfr::Tracer& tracer_;
- gbxutilacfr::Status& status_;
+ gbxutilacfr::SubStatus subStatus_;
};
//////////////////////////////////////////////////////////////////////
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rus...@us...> - 2008-06-01 02:52:30
|
Revision: 142
http://gearbox.svn.sourceforge.net/gearbox/?rev=142&view=rev
Author: russo2503v
Date: 2008-05-31 19:52:34 -0700 (Sat, 31 May 2008)
Log Message:
-----------
cosmetic change in printout
Modified Paths:
--------------
gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/safethread.cpp
Modified: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/safethread.cpp
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/safethread.cpp 2008-05-26 10:22:58 UTC (rev 141)
+++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/safethread.cpp 2008-06-01 02:52:34 UTC (rev 142)
@@ -54,7 +54,7 @@
tracer_.debug( ss.str(), 4 );
}
else {
- tracer_.debug( "dropping out from run()", 4 );
+ tracer_.debug( "SafeThread: dropping out from run()", 4 );
}
// wait for the component to realize that we are quitting and tell us to stop.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rus...@us...> - 2008-05-26 10:22:50
|
Revision: 141
http://gearbox.svn.sourceforge.net/gearbox/?rev=141&view=rev
Author: russo2503v
Date: 2008-05-26 03:22:58 -0700 (Mon, 26 May 2008)
Log Message:
-----------
not setting status fault when the thread is stopping
Modified Paths:
--------------
gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/safethread.cpp
gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/safethread.h
gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/subsystemthread.cpp
gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/subsystemthread.h
Modified: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/safethread.cpp
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/safethread.cpp 2008-05-08 08:10:39 UTC (rev 140)
+++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/safethread.cpp 2008-05-26 10:22:58 UTC (rev 141)
@@ -46,9 +46,12 @@
ss << "SafeThread::run(): Caught unexpected unknown exception.";
}
- // only if there were exceptions
- if ( !ss.str().empty() ) {
- tracer_.error( ss.str() );
+ // report error if there was an exception and we are not stopping
+ if ( !ss.str().empty() ) {
+ if ( !isStopping() )
+ tracer_.error( ss.str() );
+ else
+ tracer_.debug( ss.str(), 4 );
}
else {
tracer_.debug( "dropping out from run()", 4 );
Modified: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/safethread.h
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/safethread.h 2008-05-08 08:10:39 UTC (rev 140)
+++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/safethread.h 2008-05-26 10:22:58 UTC (rev 141)
@@ -20,8 +20,8 @@
/*!
@brief A version of the Thread class which catches all possible exceptions.
-If a stray exception is caught, an error message will be printed
-(using cout), then we will wait for someone to call stop().
+If an exception is caught when the thread is not stopping, an error trace message
+will be printed. Then the thread wil wait for someone to call stop().
To use this class, simply implement the pure virtual walk() function.
@verbatim
Modified: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/subsystemthread.cpp
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/subsystemthread.cpp 2008-05-08 08:10:39 UTC (rev 140)
+++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/subsystemthread.cpp 2008-05-26 10:22:58 UTC (rev 141)
@@ -52,8 +52,8 @@
ss << "SubsystemThread::run() "<<subsysName()<<": Caught unexpected unknown exception.";
}
- // only if there were exceptions
- if ( !ss.str().empty() )
+ // report status fault if there was an exception and we are not stopping
+ if ( !ss.str().empty() && !isStopping() )
{
tracer_.error( ss.str() );
subStatus().fault( ss.str() );
@@ -62,6 +62,6 @@
tracer_.debug( subsysName()+": dropping out from run() ", 4 );
}
- // wait for the component to realize that we are quitting and tell us to stop.
+ // wait for somebody to realize that we are quitting and tell us to stop.
waitForStop();
}
Modified: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/subsystemthread.h
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/subsystemthread.h 2008-05-08 08:10:39 UTC (rev 140)
+++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/subsystemthread.h 2008-05-26 10:22:58 UTC (rev 141)
@@ -22,8 +22,8 @@
/*!
@brief A version of the Thread class which catches all possible exceptions and integrates some Status operations.
-If a stray exception is caught, an error message will be printed
-(using cout), then we will wait for someone to call stop().
+If an exception is caught when the thread is not stopping, a status fault is issued.
+Then the thread will wait for someone to call stop().
To use this class, simply implement the pure virtual walk() function.
@verbatim
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rus...@us...> - 2008-05-08 08:10:39
|
Revision: 140
http://gearbox.svn.sourceforge.net/gearbox/?rev=140&view=rev
Author: russo2503v
Date: 2008-05-08 01:10:39 -0700 (Thu, 08 May 2008)
Log Message:
-----------
added functions to get the current subsystem status. not part of an external API.
Modified Paths:
--------------
gearbox/trunk/src/gbxsickacfr/gbxutilacfr/status.h
gearbox/trunk/src/gbxsickacfr/gbxutilacfr/trivialstatus.cpp
gearbox/trunk/src/gbxsickacfr/gbxutilacfr/trivialstatus.h
Modified: gearbox/trunk/src/gbxsickacfr/gbxutilacfr/status.h
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxutilacfr/status.h 2008-05-07 07:35:47 UTC (rev 139)
+++ gearbox/trunk/src/gbxsickacfr/gbxutilacfr/status.h 2008-05-08 08:10:39 UTC (rev 140)
@@ -12,10 +12,41 @@
#define GBXUTILACFR_STATUS_H
#include <string>
+#include <vector>
namespace gbxsickacfr {
namespace gbxutilacfr {
+//! Possible subsystem status values
+enum SubsystemStatusType
+{
+ //! Subsystem is initialising -- it's not exactly OK yet, but there's also no fault yet.
+ SubsystemStatusInitialising,
+ //! Subsystem is OK
+ SubsystemStatusOk,
+ //! Subsystem has encountered an abnormal but non-fault condition
+ SubsystemStatusWarning,
+ //! Subsystem has declared a fault
+ SubsystemStatusFault,
+ //! Subsystem has not been heard from for an abnormally long time
+ SubsystemStatusStalled
+};
+
+//! Status for a single subsystem
+struct SubsystemStatus
+{
+ //! Machine-readable status description
+ SubsystemStatusType type;
+
+ //! Human-readable status description
+ std::string message;
+
+ //! Ratio of time since last heartbeat to maximum expected time between heartbeats.
+ //! For example, sinceHeartbeat=0.5 means that half of normally expected interval between heartbeats
+ //! has elapsed.
+ float sinceHeartbeat;
+};
+
/*
@brief Local interface to component status.
@@ -56,16 +87,6 @@
public:
- // this is for internal implementation only
- enum SubsystemStatusType
- {
- Initialising,
- Ok,
- Warning,
- Fault,
- Stalled
- };
-
virtual ~Status() {};
/*
@@ -87,6 +108,13 @@
// Throws gbxutilacfr::Exception if the subsystem does not exist.
virtual void removeSubsystem( const std::string& subsystem )=0;
+ // Returns a list of subsystem names.
+ virtual std::vector<std::string> subsystems()=0;
+
+ // Returns status of subsystem with the given name.
+ // Throws gbxutilacfr::Exception when the specified subsystem does not exist.
+ virtual SubsystemStatus subsystemStatus( const std::string& subsystem )=0;
+
// Modifies maximum expected interval between heartbeats (in seconds).
// When time since last heartbeat exceeds this, alarm is raised.
// Throws gbxutilacfr::Exception if the subsystem does not exist.
Modified: gearbox/trunk/src/gbxsickacfr/gbxutilacfr/trivialstatus.cpp
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxutilacfr/trivialstatus.cpp 2008-05-07 07:35:47 UTC (rev 139)
+++ gearbox/trunk/src/gbxsickacfr/gbxutilacfr/trivialstatus.cpp 2008-05-08 08:10:39 UTC (rev 140)
@@ -11,6 +11,7 @@
#include <iostream>
#include <sstream>
#include "trivialstatus.h"
+#include "exceptions.h"
using namespace std;
@@ -44,6 +45,18 @@
tracer_.debug( ss.str() );
}
+std::vector<std::string>
+TrivialStatus::subsystems()
+{
+ return std::vector<std::string> ();
+}
+
+SubsystemStatus
+TrivialStatus::subsystemStatus( const std::string& subsystem )
+{
+ throw Exception( ERROR_INFO, "This implementation of Status does not store status of the subsystems" );
+}
+
void
TrivialStatus::setMaxHeartbeatInterval( const std::string& subsystem, double maxHeartbeatIntervalSec )
{
Modified: gearbox/trunk/src/gbxsickacfr/gbxutilacfr/trivialstatus.h
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxutilacfr/trivialstatus.h 2008-05-07 07:35:47 UTC (rev 139)
+++ gearbox/trunk/src/gbxsickacfr/gbxutilacfr/trivialstatus.h 2008-05-08 08:10:39 UTC (rev 140)
@@ -32,6 +32,10 @@
virtual void addSubsystem( const std::string& subsystem, double maxHeartbeatIntervalSec=-1.0 );
virtual void removeSubsystem( const std::string& subsystem );
+ // does not keep track of subsystems, returns empty vector.
+ virtual std::vector<std::string> subsystems();
+ // does not keep track of status, throws Exception on any query
+ virtual SubsystemStatus subsystemStatus( const std::string& subsystem );
virtual void setMaxHeartbeatInterval( const std::string& subsystem, double interval );
virtual void initialising( const std::string& subsystem, const std::string& message="" );
virtual void ok( const std::string& subsystem, const std::string& message="" );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rus...@us...> - 2008-05-07 07:35:47
|
Revision: 139
http://gearbox.svn.sourceforge.net/gearbox/?rev=139&view=rev
Author: russo2503v
Date: 2008-05-07 00:35:47 -0700 (Wed, 07 May 2008)
Log Message:
-----------
Modified Paths:
--------------
gearbox/trunk/doc/todo.dox
Modified: gearbox/trunk/doc/todo.dox
===================================================================
--- gearbox/trunk/doc/todo.dox 2008-05-07 07:30:38 UTC (rev 138)
+++ gearbox/trunk/doc/todo.dox 2008-05-07 07:35:47 UTC (rev 139)
@@ -26,6 +26,9 @@
@par Project wide
+- Build system
+ - cmake files updated for cmake 2.6
+
@par New libraries
@par Updated libraries
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rus...@us...> - 2008-05-07 07:30:36
|
Revision: 138
http://gearbox.svn.sourceforge.net/gearbox/?rev=138&view=rev
Author: russo2503v
Date: 2008-05-07 00:30:38 -0700 (Wed, 07 May 2008)
Log Message:
-----------
fixed warnings with cmake 2.6
Modified Paths:
--------------
gearbox/trunk/cmake/SetupVersion.cmake
gearbox/trunk/cmake/TargetUtils.cmake
Modified: gearbox/trunk/cmake/SetupVersion.cmake
===================================================================
--- gearbox/trunk/cmake/SetupVersion.cmake 2008-05-05 00:58:47 UTC (rev 137)
+++ gearbox/trunk/cmake/SetupVersion.cmake 2008-05-07 07:30:38 UTC (rev 138)
@@ -2,8 +2,11 @@
# define the project version so we can have access to it from the code
#
+if(COMMAND cmake_policy)
+ cmake_policy(SET CMP0005 OLD)
+endif(COMMAND cmake_policy)
+
# alexm: for gcc need to produce this in the Makefile: -DGEARBOX_VERSION=\"X.Y.Z\",
# without escaping the quotes the compiler will strip them off.
# alexb: it seems that you also need to escape the quotes for windoze??
-
ADD_DEFINITIONS( "-DGEARBOX_VERSION=\\\"${GBX_PROJECT_VERSION}\\\"" )
Modified: gearbox/trunk/cmake/TargetUtils.cmake
===================================================================
--- gearbox/trunk/cmake/TargetUtils.cmake 2008-05-05 00:58:47 UTC (rev 137)
+++ gearbox/trunk/cmake/TargetUtils.cmake 2008-05-07 07:30:38 UTC (rev 138)
@@ -4,6 +4,10 @@
# Usage is the same as ADD_EXECUTABLE, all parameters are passed to ADD_EXECUTABLE.
#
MACRO( GBX_ADD_EXECUTABLE name )
+ if(COMMAND cmake_policy)
+ cmake_policy(SET CMP0003 NEW)
+ endif(COMMAND cmake_policy)
+
ADD_EXECUTABLE( ${name} ${ARGN} )
# SET_TARGET_PROPERTIES( ${name} PROPERTIES
# INSTALL_RPATH "${INSTALL_RPATH};${CMAKE_INSTALL_PREFIX}/lib/${PROJECT_NAME}"
@@ -22,6 +26,10 @@
# Usage is the same as ADD_LIBRARY, all parameters are passed to ADD_LIBRARY.
#
MACRO( GBX_ADD_LIBRARY name )
+ if(COMMAND cmake_policy)
+ cmake_policy(SET CMP0003 NEW)
+ endif(COMMAND cmake_policy)
+
ADD_LIBRARY( ${name} ${ARGN} )
# SET_TARGET_PROPERTIES( ${name} PROPERTIES
# INSTALL_RPATH "${INSTALL_RPATH};${CMAKE_INSTALL_PREFIX}/lib/${PROJECT_NAME}"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <to...@us...> - 2008-05-05 00:58:44
|
Revision: 137
http://gearbox.svn.sourceforge.net/gearbox/?rev=137&view=rev
Author: tobasco
Date: 2008-05-04 17:58:47 -0700 (Sun, 04 May 2008)
Log Message:
-----------
timezone to UTC
Modified Paths:
--------------
gearbox/trunk/CTestConfig.cmake
Modified: gearbox/trunk/CTestConfig.cmake
===================================================================
--- gearbox/trunk/CTestConfig.cmake 2008-05-04 23:43:16 UTC (rev 136)
+++ gearbox/trunk/CTestConfig.cmake 2008-05-05 00:58:47 UTC (rev 137)
@@ -1,5 +1,5 @@
set(CTEST_PROJECT_NAME "Gearbox")
-set(CTEST_NIGHTLY_START_TIME "04:00:00 AEDT")
+set(CTEST_NIGHTLY_START_TIME "18:00:00 UTC")
set(CTEST_DROP_METHOD "http")
set(CTEST_DROP_SITE "cdash.acfr.usyd.edu.au")
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2008-05-04 23:43:14
|
Revision: 136
http://gearbox.svn.sourceforge.net/gearbox/?rev=136&view=rev
Author: borax00
Date: 2008-05-04 16:43:16 -0700 (Sun, 04 May 2008)
Log Message:
-----------
Modified Paths:
--------------
gearbox/trunk/src/gbxsickacfr/CMakeLists.txt
gearbox/trunk/src/gbxsickacfr/test/test.cpp
Modified: gearbox/trunk/src/gbxsickacfr/CMakeLists.txt
===================================================================
--- gearbox/trunk/src/gbxsickacfr/CMakeLists.txt 2008-05-04 07:38:55 UTC (rev 135)
+++ gearbox/trunk/src/gbxsickacfr/CMakeLists.txt 2008-05-04 23:43:16 UTC (rev 136)
@@ -33,8 +33,8 @@
GBX_ADD_HEADERS( gbxsickacfr ${hdrs} )
-# IF( GBX_BUILD_TESTS )
+ IF( GBX_BUILD_TESTS )
ADD_SUBDIRECTORY( test )
-# ENDIF( GBX_BUILD_TESTS )
+ ENDIF( GBX_BUILD_TESTS )
ENDIF( build )
Modified: gearbox/trunk/src/gbxsickacfr/test/test.cpp
===================================================================
--- gearbox/trunk/src/gbxsickacfr/test/test.cpp 2008-05-04 07:38:55 UTC (rev 135)
+++ gearbox/trunk/src/gbxsickacfr/test/test.cpp 2008-05-04 23:43:16 UTC (rev 136)
@@ -113,7 +113,7 @@
const double angle = config.startAngle + i*config.fieldOfView/(double)(config.numberOfSamples-1);
cout << " " << i << ": angle=" << angle*180.0/M_PI
<< "deg, range=" << data.ranges[i]
- << ", intensity=" << data.intensities[i] << endl;
+ << ", intensity=" << (int)(data.intensities[i]) << endl;
}
}
if ( data.haveWarnings )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2008-05-04 07:38:48
|
Revision: 135
http://gearbox.svn.sourceforge.net/gearbox/?rev=135&view=rev
Author: borax00
Date: 2008-05-04 00:38:55 -0700 (Sun, 04 May 2008)
Log Message:
-----------
improved reliability.
Modified Paths:
--------------
gearbox/trunk/src/gbxsickacfr/CMakeLists.txt
gearbox/trunk/src/gbxsickacfr/driver.cpp
gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.cpp
gearbox/trunk/src/gbxsickacfr/messages.cpp
gearbox/trunk/src/gbxsickacfr/serialhandler.h
gearbox/trunk/src/gbxsickacfr/test/test.cpp
Modified: gearbox/trunk/src/gbxsickacfr/CMakeLists.txt
===================================================================
--- gearbox/trunk/src/gbxsickacfr/CMakeLists.txt 2008-05-01 00:05:33 UTC (rev 134)
+++ gearbox/trunk/src/gbxsickacfr/CMakeLists.txt 2008-05-04 07:38:55 UTC (rev 135)
@@ -33,8 +33,8 @@
GBX_ADD_HEADERS( gbxsickacfr ${hdrs} )
- IF( GBX_BUILD_TESTS )
+# IF( GBX_BUILD_TESTS )
ADD_SUBDIRECTORY( test )
- ENDIF( GBX_BUILD_TESTS )
+# ENDIF( GBX_BUILD_TESTS )
ENDIF( build )
Modified: gearbox/trunk/src/gbxsickacfr/driver.cpp
===================================================================
--- gearbox/trunk/src/gbxsickacfr/driver.cpp 2008-05-01 00:05:33 UTC (rev 134)
+++ gearbox/trunk/src/gbxsickacfr/driver.cpp 2008-05-04 07:38:55 UTC (rev 135)
@@ -129,27 +129,37 @@
ssDebug << "Connecting to laser on serial port " << config_.device;
tracer_.debug( ssDebug.str() );
- serialHandler_.reset( new SerialHandler( config_.device, tracer, status ) );
+ const int MAX_TRIES=3;
+ for ( int i=0; i < MAX_TRIES; i++ )
+ {
+ stringstream tryString;
+ tryString << "Connection attempt " << i+1 << " of " << MAX_TRIES << ": ";
+ try {
- try {
-
- initLaser();
-
+ serialHandler_.reset(0);
+ serialHandler_.reset( new SerialHandler( config_.device, tracer, status ) );
+ initLaser();
+ break;
+ }
+ catch ( const ResponseIsErrorException &e )
+ {
+ std::string errorLog = errorConditions();
+ stringstream ss;
+ ss << e.what() << endl << "Laser error log: " << errorLog;
+ if ( i == MAX_TRIES-1 )
+ throw ResponseIsErrorException( ss.str() );
+ else
+ tracer_.warning( tryString.str() + ss.str() );
+ }
+ catch ( const std::exception &e )
+ {
+ stringstream ss;
+ ss << "during initLaser(): " << e.what();
+ tracer_.warning( tryString.str() + ss.str() );
+ if ( i == MAX_TRIES-1 )
+ throw;
+ }
}
- catch ( const ResponseIsErrorException &e )
- {
- std::string errorLog = errorConditions();
- stringstream ss;
- ss << e.what() << endl << "Laser error log: " << errorLog;
- throw ResponseIsErrorException( ss.str() );
- }
- catch ( const std::exception &e )
- {
- stringstream ss;
- ss << "during initLaser(): " << e.what();
- tracer_.warning( ss.str() );
- throw;
- }
}
bool
@@ -333,6 +343,7 @@
Driver::errorConditions()
{
try {
+ tracer_.debug( "Driver: Checking error conditions." );
constructRequestErrorMessage( commandAndData_ );
const bool ignoreErrorConditions = true;
TimedLmsResponse errorResponse = sendAndExpectResponse( commandAndData_, ignoreErrorConditions );
@@ -350,8 +361,10 @@
void
Driver::setBaudRate( int baudRate )
{
+ // Tell the laser to switch
constructRequestBaudRate( commandAndData_, baudRate );
sendAndExpectResponse( commandAndData_ );
+ // And switch myself
serialHandler_->setBaudRate( config_.baudRate );
}
@@ -372,26 +385,21 @@
ss << "Driver: Trying to connect at " << baudRates[baudRateI] << " baud.";
tracer_.info( ss.str() );
+ // Switch my local serial port
serialHandler_->setBaudRate( baudRates[baudRateI] );
- const uint MAX_TRIES = 2;
- for ( uint tryNum=0; tryNum < MAX_TRIES; tryNum++ )
+ try {
+ stringstream ss;
+ ss <<"Driver: Trying to get laser status with baudrate " << baudRates[baudRateI];
+ tracer_.debug( ss.str() );
+ askLaserForStatusData();
+ return baudRates[baudRateI];
+ }
+ catch ( const NoResponseException &e )
{
- try {
- stringstream ss;
- ss <<"Driver: Trying to get laser status with baudrate " << baudRates[baudRateI] << " (try number "<<tryNum<<" of " << MAX_TRIES << ")" << endl;
- tracer_.debug( ss.str() );
- askLaserForStatusData();
- return baudRates[baudRateI];
- }
- catch ( const NoResponseException &e )
- {
- stringstream ss;
- ss << "Driver::guessLaserBaudRate(): try " << tryNum << " of " << MAX_TRIES << " at baudRate " << baudRates[baudRateI] << " failed: " << e.what();
- tracer_.debug( ss.str() );
- if ( tryNum == MAX_TRIES-1 )
- break;
- }
+ stringstream ss;
+ ss << "Driver::guessLaserBaudRate(): failed: " << e.what();
+ tracer_.debug( ss.str() );
}
} // end loop over baud rates
@@ -408,30 +416,13 @@
// Turn continuous mode off
//
tracer_.debug("Driver: Turning continuous mode off");
- // For some reason this isn't always reliable, not too sure why.
- // Perhaps there's some crap left in the buffer after the thing
- // was previously in continuous mode?
- const int MAX_TRIES=3;
- for ( int i=0; i < MAX_TRIES; i++ )
- {
- try {
- constructRequestMeasuredOnRequestMode( commandAndData_ );
- sendAndExpectResponse( commandAndData_ );
- break;
- }
- catch ( NoResponseException &e )
- {
- if ( i == MAX_TRIES-1 )
- {
- // Give up
- throw;
- }
- }
- }
+ constructRequestMeasuredOnRequestMode( commandAndData_ );
+ sendAndExpectResponse( commandAndData_ );
//
// Set Desired BaudRate
//
+ tracer_.debug("Driver: Telling the laser to switch to the desired baud rate");
if ( currentBaudRate != config_.baudRate )
{
setBaudRate( config_.baudRate );
@@ -449,6 +440,7 @@
//
// Check operating data counters
//
+ tracer_.debug("Driver: Checking operating data counters");
constructRequestOperatingDataCounter( commandAndData_ );
TimedLmsResponse counterResponse = sendAndExpectResponse( commandAndData_ );
ssInfo << "OperatingDataCounter: " << toString(counterResponse.response) << endl;
@@ -456,6 +448,7 @@
//
// Get status
//
+ tracer_.debug("Driver: Checking status");
LmsResponse statusResponse = askLaserForStatusData();
LmsStatusResponseData *statusResponseData =
dynamic_cast<LmsStatusResponseData*>(statusResponse.data);
Modified: gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.cpp
===================================================================
--- gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.cpp 2008-05-01 00:05:33 UTC (rev 134)
+++ gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.cpp 2008-05-04 07:38:55 UTC (rev 135)
@@ -71,7 +71,7 @@
void
SerialDeviceHandler::setBaudRate( int baudRate )
{
- tracer_.debug( "SerialDeviceHandler: Changing baud rate and flushing." );
+ tracer_.debug( "SerialDeviceHandler: Changing baud rate of serial port." );
serial_.setBaudRate( baudRate );
// TODO: AlexB: not entirely sure if these are
// necessary, they should either be removed or
@@ -161,7 +161,7 @@
if ( SUPER_DEBUG )
{
stringstream ss;
- ss << "SerialDeviceHandler::getDataFromSerial(): nBytes: " << nBytes;
+ ss << "SerialDeviceHandler::getDataFromSerial(): nBytes available: " << nBytes;
tracer_.debug( ss.str(), 9 );
}
Modified: gearbox/trunk/src/gbxsickacfr/messages.cpp
===================================================================
--- gearbox/trunk/src/gbxsickacfr/messages.cpp 2008-05-01 00:05:33 UTC (rev 134)
+++ gearbox/trunk/src/gbxsickacfr/messages.cpp 2008-05-04 07:38:55 UTC (rev 135)
@@ -893,10 +893,10 @@
if ( checksumFailed )
{
IceUtil::Time t = IceUtil::Time::now();
- cout << "WARN(messages.cpp): " << t.toDateTime() << ": Checksum failed at buf pos " <<bytesParsed << endl;
- cout<<"TRACE(messages.cpp): checksum was over: " << toHexString( &(buffer[bytesParsed]), telegramLength ) << endl;
+ // cout << "WARN(messages.cpp): " << t.toDateTime() << ": Checksum failed at buf pos " <<bytesParsed << endl;
+ // cout<<"TRACE(messages.cpp): checksum was over: " << toHexString( &(buffer[bytesParsed]), telegramLength ) << endl;
bytesParsed++;
- cout<<"TRACE(messages.cpp): returning after failed checksum, with bytesParsed = " << bytesParsed << endl;
+ // cout<<"TRACE(messages.cpp): returning after failed checksum, with bytesParsed = " << bytesParsed << endl;
continue;
}
else
Modified: gearbox/trunk/src/gbxsickacfr/serialhandler.h
===================================================================
--- gearbox/trunk/src/gbxsickacfr/serialhandler.h 2008-05-01 00:05:33 UTC (rev 134)
+++ gearbox/trunk/src/gbxsickacfr/serialhandler.h 2008-05-04 07:38:55 UTC (rev 135)
@@ -68,8 +68,8 @@
public:
SerialHandler( const std::string &dev,
- gbxutilacfr::Tracer &tracer,
- gbxutilacfr::Status &status );
+ gbxutilacfr::Tracer &tracer,
+ gbxutilacfr::Status &status );
~SerialHandler();
void send( const std::vector<uChar> &telegram )
@@ -99,7 +99,7 @@
private:
- ResponseParser responseParser_;
+ ResponseParser responseParser_;
gbxserialacfr::Serial serialPort_;
gbxserialdeviceacfr::SerialDeviceHandler *serialDeviceHandler_;
// Keep a smart pointer to the SerialDeviceHandler as a thread, for stop/start purposes
Modified: gearbox/trunk/src/gbxsickacfr/test/test.cpp
===================================================================
--- gearbox/trunk/src/gbxsickacfr/test/test.cpp 2008-05-01 00:05:33 UTC (rev 134)
+++ gearbox/trunk/src/gbxsickacfr/test/test.cpp 2008-05-04 07:38:55 UTC (rev 135)
@@ -31,9 +31,11 @@
int opt;
int baud = 38400;
string port = "/dev/ttyS0";
+ bool debug = false;
+ bool showScan = false;
// Get some options from the command line
- while ((opt = getopt(argc, argv, "p:b:")) != -1)
+ while ((opt = getopt(argc, argv, "p:b:vs")) != -1)
{
switch ( opt )
{
@@ -43,10 +45,16 @@
case 'b':
baud = atoi( optarg );
break;
+ case 'v':
+ debug = true;
+ break;
+ case 's':
+ showScan = true;
+ break;
default:
- cout << "Usage: " << argv[0] << " [-p port] [-b baud]" << endl << endl
+ cout << "Usage: " << argv[0] << " [-p port] [-b baud] [-v(erbose)] [-s(how scan)]" << endl << endl
<< "-p port\tPort the laser scanner is connected to. E.g. /dev/ttyS0" << endl
- << "-b baud\tBaud rate to connect at (9600, 19200, 38400, oro 500000)." << endl;
+ << "-b baud\tBaud rate to connect at (9600, 19200, 38400, or 500000)." << endl;
return 1;
}
}
@@ -67,7 +75,6 @@
cout << "Using configuration: " << config.toString() << endl;
// Instantiate objects to handle messages from the driver
- const bool debug=false;
gbxsickacfr::gbxutilacfr::TrivialTracer tracer( debug );
gbxsickacfr::gbxutilacfr::TrivialStatus status( tracer );
@@ -99,14 +106,16 @@
device->read( data );
cout<<"Test: Got scan "<<i+1<<" of "<<numReads<<endl;
- for ( int i=0; i < config.numberOfSamples; i++ )
+ if ( showScan )
{
- const double angle = config.startAngle + i*config.fieldOfView/(double)(config.numberOfSamples-1);
- cout << " " << i << ": angle=" << angle*180.0/M_PI
- << "deg, range=" << data.ranges[i]
- << ", intensity=" << data.intensities[i] << endl;
+ for ( int i=0; i < config.numberOfSamples; i++ )
+ {
+ const double angle = config.startAngle + i*config.fieldOfView/(double)(config.numberOfSamples-1);
+ cout << " " << i << ": angle=" << angle*180.0/M_PI
+ << "deg, range=" << data.ranges[i]
+ << ", intensity=" << data.intensities[i] << endl;
+ }
}
-
if ( data.haveWarnings )
cout << "got warnings: " << data.warnings << endl;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2008-05-01 00:05:26
|
Revision: 134
http://gearbox.svn.sourceforge.net/gearbox/?rev=134&view=rev
Author: borax00
Date: 2008-04-30 17:05:33 -0700 (Wed, 30 Apr 2008)
Log Message:
-----------
Modified Paths:
--------------
gearbox/trunk/src/gbxserialacfr/serial.h
Modified: gearbox/trunk/src/gbxserialacfr/serial.h
===================================================================
--- gearbox/trunk/src/gbxserialacfr/serial.h 2008-04-30 07:37:29 UTC (rev 133)
+++ gearbox/trunk/src/gbxserialacfr/serial.h 2008-05-01 00:05:33 UTC (rev 134)
@@ -106,7 +106,7 @@
//!
int readStringUntil( std::string &str, char termchar );
- //! Short-hand for "readStringUntil(buf,count,'\n');"
+ //! Short-hand for "readStringUntil(str,'\n');"
//! Reads everything up to and including the '\n'.
int readLine( std::string &str )
{ return readStringUntil(str,'\n'); }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2008-04-30 13:00:41
|
Revision: 133
http://gearbox.svn.sourceforge.net/gearbox/?rev=133&view=rev
Author: borax00
Date: 2008-04-30 00:37:29 -0700 (Wed, 30 Apr 2008)
Log Message:
-----------
cleanup.
Modified Paths:
--------------
gearbox/trunk/src/gbxserialacfr/serial.cpp
gearbox/trunk/src/gbxserialacfr/serial.h
Modified: gearbox/trunk/src/gbxserialacfr/serial.cpp
===================================================================
--- gearbox/trunk/src/gbxserialacfr/serial.cpp 2008-04-30 05:42:43 UTC (rev 132)
+++ gearbox/trunk/src/gbxserialacfr/serial.cpp 2008-04-30 07:37:29 UTC (rev 133)
@@ -618,7 +618,6 @@
return got; //The number of bytes that we read.
}
-
int
Serial::readStringUntil( std::string &str, char termchar )
{
@@ -673,69 +672,6 @@
return str.size();
}
-// int
-// Serial::readUntil(void *buf, int count, char termchar)
-// {
-// if ( debugLevel_ > 0 ){
-// cout<<"TRACE(serial.cpp): "<<__func__<<"(): ";
-// if(timeoutsEnabled()){
-// cout << "timeouts enabled"<<endl;
-// }else{
-// cout << "timeouts not enabled"<<endl;
-// }
-// }
-
-// // There must be at least room for a terminating char and NULL terminator!
-// assert (count >= 2);
-
-// char* dataPtr = static_cast<char*>(buf);
-// const char* bufPtr = static_cast<char*>(buf);
-// char nextChar = 0;
-
-// do {
-// // Check for buf overrun Must leave room for NULL terminator
-// if ( dataPtr >= bufPtr + (count - 1) )
-// {
-// stringstream ss;
-// ss << "Serial::"<<__func__<<": Not enough room in buffer";
-// throw SerialException( ss.str() );
-// }
-
-// int ret = ::read( portFd_, &nextChar, 1 );
-// if (ret == 1)
-// {
-// *(dataPtr++) = nextChar; //got data let's store it...
-// }
-// else
-// {
-// // If timeouts enabled and no data, wait and then go again
-// if( timeoutsEnabled() && (ret == -1) && (errno == EAGAIN) )
-// {
-// if( waitForDataOrTimeout() == DATA_AVAILABLE )
-// {
-// continue;
-// }else{
-// *dataPtr = 0x00; // Timed out. terminate string just incase it's used anyway
-// return -1;
-// }
-// }
-
-// // If we get here then it was a more serious error
-// stringstream ss;
-// ss << "Serial::"<<__func__<<"(): "<<strerror(errno);
-// throw SerialException( ss.str() );
-// }
-
-// } while (nextChar != termchar);
-
-// // It's a string. It must be NULL terminated...
-// *dataPtr = 0x00;
-
-// // Return the number of chars not including the NULL
-// return ( (int) (dataPtr - bufPtr) );
-// }
-
-
int
Serial::bytesAvailable()
{
Modified: gearbox/trunk/src/gbxserialacfr/serial.h
===================================================================
--- gearbox/trunk/src/gbxserialacfr/serial.h 2008-04-30 05:42:43 UTC (rev 132)
+++ gearbox/trunk/src/gbxserialacfr/serial.h 2008-04-30 07:37:29 UTC (rev 133)
@@ -106,7 +106,7 @@
//!
int readStringUntil( std::string &str, char termchar );
- //! Short-hand for "readUntil(buf,count,'\n');"
+ //! Short-hand for "readStringUntil(buf,count,'\n');"
//! Reads everything up to and including the '\n'.
int readLine( std::string &str )
{ return readStringUntil(str,'\n'); }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|