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: <bo...@us...> - 2008-02-25 12:32:06
|
Revision: 82
http://gearbox.svn.sourceforge.net/gearbox/?rev=82&view=rev
Author: borax00
Date: 2008-02-25 04:32:07 -0800 (Mon, 25 Feb 2008)
Log Message:
-----------
Modified Paths:
--------------
gearbox/trunk/submitted/gbxserialacfr/doc.dox
gearbox/trunk/submitted/gbxsickacfr/doc.dox
gearbox/trunk/submitted/gbxsickacfr/driver.cpp
gearbox/trunk/submitted/gbxsickacfr/driver.h
gearbox/trunk/submitted/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.h
gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/trivialstatus.h
gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/trivialtracer.h
gearbox/trunk/submitted/gbxsickacfr/test/test.cpp
Modified: gearbox/trunk/submitted/gbxserialacfr/doc.dox
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/doc.dox 2008-02-25 12:00:58 UTC (rev 81)
+++ gearbox/trunk/submitted/gbxserialacfr/doc.dox 2008-02-25 12:32:07 UTC (rev 82)
@@ -50,6 +50,9 @@
@par Responsible Developer
Alex Brooks
+@par License
+ LGPL
+
*/
/*!
Modified: gearbox/trunk/submitted/gbxsickacfr/doc.dox
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/doc.dox 2008-02-25 12:00:58 UTC (rev 81)
+++ gearbox/trunk/submitted/gbxsickacfr/doc.dox 2008-02-25 12:32:07 UTC (rev 82)
@@ -29,12 +29,18 @@
@par Style
See http://orca-robotics.sourceforge.net/orca/orca_doc_style.html
+@par Units and Coordinate System
+ See http://orca-robotics.sourceforge.net/orca/orca_doc_units.html
+
@par Copyright
Alex Brooks, Alexei Makarenko, Tobias Kaupp
@par Responsible Developer
Alex Brooks
+@par License
+ LGPL
+
@par Dependencies
- libIceUtil (for timing/threads/mutexes)
Modified: gearbox/trunk/submitted/gbxsickacfr/driver.cpp
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/driver.cpp 2008-02-25 12:00:58 UTC (rev 81)
+++ gearbox/trunk/submitted/gbxsickacfr/driver.cpp 2008-02-25 12:32:07 UTC (rev 82)
@@ -72,8 +72,7 @@
bool
Config::validate() const
{
- // baudRate ???
- // device ???
+ // Don't bother verifying baudRate or device, the user will find out soon enough when the Driver bitches.
if ( minRange < 0.0 ) return false;
if ( maxRange <= 0.0 ) return false;
if ( fieldOfView <= 0.0 || fieldOfView > DEG2RAD(360.0) ) return false;
@@ -227,7 +226,7 @@
else
{
stringstream ss;
- ss << "Weird return code from getAndPopNext: " << ret;
+ ss << "Weird return code from serialHandler_->getNextResponse: " << ret;
throw gbxutilacfr::Exception( ERROR_INFO, ss.str() );
}
}
@@ -310,7 +309,7 @@
// help with dazzle (ie sunlight interfering with the laser).
// I haven't had a chance to test it though, so I'm not game
// to set it.
- cout<<"TRACE(sickacfrdriver.cpp): TODO: set availability?" << endl;
+ cout<<"TRACE(driver.cpp): TODO: set availability?" << endl;
// c.availability = 0x01;
return c;
Modified: gearbox/trunk/submitted/gbxsickacfr/driver.h
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/driver.h 2008-02-25 12:00:58 UTC (rev 81)
+++ gearbox/trunk/submitted/gbxsickacfr/driver.h 2008-02-25 12:32:07 UTC (rev 82)
@@ -69,8 +69,8 @@
//! Constructor
Driver( const Config &config, gbxutilacfr::Tracer& tracer, gbxutilacfr::Status& status );
- //! Blocks till new data is available, but shouldn't occupy the thread indefinitely.
- //! Ranges and intensities can be expected to have been pre-sized correctly.
+ //! Blocks till new data is available, but not for longer than timeoutMs.
+ //! The ranges and intensities in 'data' are expected to have been pre-sized correctly.
//! Throws exceptions on un-recoverable faults.
//!
//! The default timeout is greater than the scan inter-arrival time for all baudrates.
Modified: gearbox/trunk/submitted/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.h
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.h 2008-02-25 12:00:58 UTC (rev 81)
+++ gearbox/trunk/submitted/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.h 2008-02-25 12:32:07 UTC (rev 82)
@@ -18,7 +18,7 @@
namespace gbxsickacfr {
namespace gbxserialdeviceacfr {
-// @brief A generic Response: a message received from the device
+//! @brief A generic Response: a message received from the device
class IResponse : public IceUtil::Shared
{
public:
@@ -34,7 +34,7 @@
};
typedef IceUtil::Handle<IResponse> IResponsePtr;
-// Response plus a timeStamp: a simple container to keep the two together
+//! Response plus a timeStamp: a simple container to keep the two together
class TimedResponse {
public:
@@ -48,10 +48,10 @@
IResponsePtr response;
};
-//
-// The implementation of this class needs to be provided by the user.
-// It parses buffers to produce discrete messages (responses form the device)
-//
+//!
+//! The implementation of this class needs to be provided by the user.
+//! It parses buffers to produce discrete messages (responses form the device)
+//!
class IResponseParser {
public:
@@ -72,19 +72,19 @@
};
-//
-// @brief Handles the serial port.
-//
-// This thread waits for new messags to arrive from the device, parses
-// them and sticks them into a buffer for someone else to grab.
-//
-// Read in this separate loop so we can hopefully grab the messages
-// as soon as they arrive, without relying on an external poller
-// which may be busy doing other stuff.
-// This will hopefully give us accurate timestamps.
-//
-// @author Alex Brooks
-//
+//!
+//! @brief Handles the serial port.
+//!
+//! This thread waits for new messags to arrive from the device, parses
+//! them and sticks them into a buffer for someone else to grab.
+//!
+//! Read in this separate loop so we can hopefully grab the messages
+//! as soon as they arrive, without relying on an external poller
+//! which may be busy doing other stuff.
+//! This will hopefully give us accurate timestamps.
+//!
+//! @author Alex Brooks
+//!
class SerialDeviceHandler : public gbxiceutilacfr::SubsystemThread
{
Modified: gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/trivialstatus.h
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/trivialstatus.h 2008-02-25 12:00:58 UTC (rev 81)
+++ gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/trivialstatus.h 2008-02-25 12:32:07 UTC (rev 82)
@@ -18,6 +18,11 @@
namespace gbxutilacfr {
+//!
+//! @brief A trivial implementation of the status API which prints to cout.
+//!
+//! @see Status
+//!
class TrivialStatus : public Status
{
public:
Modified: gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/trivialtracer.h
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/trivialtracer.h 2008-02-25 12:00:58 UTC (rev 81)
+++ gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/trivialtracer.h 2008-02-25 12:32:07 UTC (rev 82)
@@ -16,6 +16,11 @@
namespace gbxsickacfr {
namespace gbxutilacfr {
+//!
+//! @brief A simple implementation of the tracer API which prints to cout.
+//!
+//! @see Tracer
+//!
class TrivialTracer : public Tracer
{
public:
Modified: gearbox/trunk/submitted/gbxsickacfr/test/test.cpp
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/test/test.cpp 2008-02-25 12:00:58 UTC (rev 81)
+++ gearbox/trunk/submitted/gbxsickacfr/test/test.cpp 2008-02-25 12:32:07 UTC (rev 82)
@@ -35,19 +35,19 @@
// Get some options from the command line
while ((opt = getopt (argc, argv, "p:b:")) != -1)
{
- switch (opt)
+ switch ( opt )
{
- case 'p':
- port = optarg;
- break;
- case 'b':
- baud = atoi (optarg);
- break;
- default:
- cout << "Usage: " << argv[0] << " [-p port] [-b baud]" << endl << endl
- << "-p port\tPort the laser scanner is connected to. E.g. /dev/ttyS0" << endl
- << "-b baud\tBaud rate to connect at (19200, 57600 or 115200)." << endl;
- return 1;
+ case 'p':
+ port = optarg;
+ break;
+ case 'b':
+ baud = atoi( optarg );
+ break;
+ default:
+ cout << "Usage: " << argv[0] << " [-p port] [-b baud]" << endl << endl
+ << "-p port\tPort the laser scanner is connected to. E.g. /dev/ttyS0" << endl
+ << "-b baud\tBaud rate to connect at (19200, 57600 or 115200)." << endl;
+ return 1;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2008-02-25 12:00:54
|
Revision: 81
http://gearbox.svn.sourceforge.net/gearbox/?rev=81&view=rev
Author: borax00
Date: 2008-02-25 04:00:58 -0800 (Mon, 25 Feb 2008)
Log Message:
-----------
applied geoff's review.
Modified Paths:
--------------
gearbox/trunk/submitted/gbxserialacfr/lockfile/lockfile.h
gearbox/trunk/submitted/gbxserialacfr/serial.cpp
gearbox/trunk/submitted/gbxserialacfr/serial.h
gearbox/trunk/submitted/gbxserialacfr/test/CMakeLists.txt
gearbox/trunk/submitted/gbxserialacfr/test/serialechotest.cpp
gearbox/trunk/submitted/gbxserialacfr/test/serialloopbacktest.cpp
gearbox/trunk/submitted/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.cpp
gearbox/trunk/submitted/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.h
gearbox/trunk/submitted/gbxsickacfr/serialhandler.cpp
Added Paths:
-----------
gearbox/trunk/submitted/gbxserialacfr/test/example.cmake.in
gearbox/trunk/submitted/gbxserialacfr/test/example.readme
Modified: gearbox/trunk/submitted/gbxserialacfr/lockfile/lockfile.h
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/lockfile/lockfile.h 2008-02-25 08:15:29 UTC (rev 80)
+++ gearbox/trunk/submitted/gbxserialacfr/lockfile/lockfile.h 2008-02-25 12:00:58 UTC (rev 81)
@@ -16,9 +16,9 @@
namespace gbxserialacfr {
namespace lockfile {
-//
-// @brief Exception thrown by lockfile functions
-//
+//!
+//! @brief Exception thrown by lockfile functions
+//!
class LockFileException : public std::exception
{
std::string message_;
@@ -31,17 +31,19 @@
virtual const char* what() const throw() { return message_.c_str(); }
};
-//
-// Creates a lock-file which can be used to prevent multiple access to
-// a unique resource (eg "/dev/xxx").
-// Stores the PID of the locking process (lockPid), so it can check for stale lock-files.
-//
-// Throws LockFileException's on errors (including 'device locked').
-//
-// The destructor removes the lock-file (guarantees that no exceptions are thrown).
-//
-// For more info, see: http://tldp.org/HOWTO/Serial-HOWTO-14.html
-//
+//!
+//! Creates a lock-file (in /var/lock) which can be used to prevent multiple access to
+//! a unique resource (eg "/dev/xxx").
+//! Stores the PID of the locking process (lockPid), so it can check for stale lock-files.
+//!
+//! Throws LockFileException's on errors (including 'device locked').
+//!
+//! The destructor removes the lock-file (guarantees that no exceptions are thrown).
+//!
+//! For more info, see: http://tldp.org/HOWTO/Serial-HOWTO-14.html
+//!
+//! @author Alex Brooks
+//!
class LockFile {
public:
Modified: gearbox/trunk/submitted/gbxserialacfr/serial.cpp
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/serial.cpp 2008-02-25 08:15:29 UTC (rev 80)
+++ gearbox/trunk/submitted/gbxserialacfr/serial.cpp 2008-02-25 12:00:58 UTC (rev 81)
@@ -31,11 +31,8 @@
// FIONREAD
# include <sys/filio.h>
#endif
-// Ensure we have strnlen
-// #include <hydroportability/strnlen.h>
-
-// copy the contents of this file below
-// start of <hydroportability/strnlen.h>
+
+// Ensure we have strnlen
// eg. Solaris doesn't define strnlen in string.h, so define it here.
#if !HAVE_STRNLEN
@@ -56,12 +53,7 @@
return ((p - s) + 1);
}
#endif
-// end of <hydroportability/strnlen.h>
-// define for a debug compile
-#define DEBUG
-
-
using namespace std;
namespace gbxserialacfr {
@@ -343,15 +335,13 @@
//////////////////////////////////////////////////////////////////////
Serial::Serial( const std::string &dev,
- int baudRate,
- bool enableTimeouts,
- int debuglevel,
- bool useLockFile )
+ int baudRate,
+ const Timeout &timeout,
+ int debuglevel,
+ bool useLockFile )
: dev_(dev),
portFd_(-1),
- timeoutSec_(1),
- timeoutUSec_(1),
- timeoutsEnabled_(enableTimeouts),
+ timeout_(timeout),
debugLevel_(debuglevel)
{
if ( useLockFile )
@@ -389,20 +379,21 @@
}
void
-Serial::setTimeout(int sec, int usec)
-{
- if ( !timeoutsEnabled_ )
+Serial::setTimeout( const Timeout &timeout )
+{
+ bool newTimeoutsEnabled = !( timeout.sec == 0 && timeout.usec == 0 );
+ if ( timeoutsEnabled() != newTimeoutsEnabled )
{
- stringstream s;
- s << "setTimeout() called for port" << dev_ <<" but timeouts not enabled!";
- throw SerialException( s.str() );
+ stringstream ss;
+ ss << "setTimeout() for port " << dev_
+ <<" tried to change enabled state of timeouts! Timeouts previously enabled: " << timeoutsEnabled();
+ throw SerialException( ss.str() );
}
-
- timeoutSec_=sec; timeoutUSec_=usec;
+ timeout_ = timeout;
}
void
-Serial::close()
+Serial::close() throw()
{
if ( debugLevel_ > 0 )
{
@@ -463,7 +454,8 @@
if ( strstr( dev_.c_str(), "USB" ) == 0 )
{
//
- // AlexB: For reasons I don't fully understand, this chunk is required to make the
+ // AlexB: TODO: fix this properly:
+ // For reasons I don't fully understand, this chunk is required to make the
// laser work at standard baud rates.
//
struct serial_struct serinfo;
@@ -499,7 +491,7 @@
{
struct termios localOptions;
- if ( timeoutsEnabled_ )
+ if ( timeoutsEnabled() )
flags |= O_NONBLOCK;
portFd_ = ::open(dev_.c_str(), flags|O_RDWR|O_NOCTTY);
@@ -606,7 +598,7 @@
got += ret;
}
- else if (timeoutsEnabled_ && (errno == EAGAIN) )
+ else if (timeoutsEnabled() && (errno == EAGAIN) )
{
if ( waitForDataOrTimeout() == TIMED_OUT )
{
@@ -635,21 +627,21 @@
{
if ( debugLevel_ > 0 ){
cout<<"TRACE(serial.cpp): "<<__func__<<"(): ";
- if(timeoutsEnabled_){
+ 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!
+ // 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{
+ do {
//Check for buf overrun Must leave room for NULL terminator
if ( dataPtr >= bufPtr + (count - 1) )
{
@@ -665,8 +657,8 @@
}
else
{
- //If timeouts enabled and no data, wait and then go again
- if( timeoutsEnabled_ && (ret == -1) && (errno == EAGAIN) )
+ // If timeouts enabled and no data, wait and then go again
+ if( timeoutsEnabled() && (ret == -1) && (errno == EAGAIN) )
{
if(waitForDataOrTimeout() == GOT_DATA)
{
@@ -728,8 +720,8 @@
struct timeval tv;
FD_ZERO(&rfds);
FD_SET(portFd_, &rfds);
- tv.tv_sec = timeoutSec_;
- tv.tv_usec = timeoutUSec_;
+ tv.tv_sec = timeout_.sec;
+ tv.tv_usec = timeout_.usec;
int selval = select(portFd_+1, &rfds, NULL, NULL, &tv);
if(selval==0)
{
Modified: gearbox/trunk/submitted/gbxserialacfr/serial.h
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/serial.h 2008-02-25 08:15:29 UTC (rev 80)
+++ gearbox/trunk/submitted/gbxserialacfr/serial.h 2008-02-25 12:00:58 UTC (rev 81)
@@ -46,16 +46,25 @@
{
public:
+ struct Timeout {
+ Timeout( int s, int us )
+ : sec(s), usec(us)
+ {}
+ int sec;
+ int usec;
+ };
+
//! Opens a device @ref dev.
- //! Throws exceptions on error.
- //! If timeouts are enabled, they default to 1sec.
+ //! Throws SerialException's or LockFileException's (both derive from std::exception) on error.
+ //! Timeouts control the various read functions below.
+ //! A timeout value of (sec=0,usec=0) indicates 'timeouts disabled'.
//! If useLockFile is set to true, Serial will use the file-system to
//! prevent concurrent access to a serial device by multiple instances of Serial.
Serial( const std::string &dev,
- int baudRate,
- bool enableTimeouts,
- int debuglevel = 0,
- bool useLockFile = true );
+ int baudRate,
+ const Timeout &timeout,
+ int debuglevel = 0,
+ bool useLockFile = true );
//! Destructor closes serial port
~Serial();
@@ -66,8 +75,9 @@
//! Sets the baud rate. Flushes any data.
void setBaudRate(int baud);
- //! Sets timeout (timeouts must be enabled)
- void setTimeout(int sec, int usec);
+ //! Sets timeout. Can be used to change the value of timeouts if they're set,
+ //! but can't set the {en|dis}abled state of timeouts.
+ void setTimeout( const Timeout &timeout );
//! Reads up to @ref count bytes into buffer @ref buf.
//! Returns the number of bytes read, or '-1' on timeout (if timeouts are enabled).
@@ -150,13 +160,15 @@
void open(int flags=0);
// Won't throw exceptions.
- void close();
+ void close() throw();
+ bool timeoutsEnabled() const
+ { return !( timeout_.sec == 0 && timeout_.usec == 0 ); }
+
const std::string dev_;
int portFd_;
- int timeoutSec_;
- int timeoutUSec_;
- bool timeoutsEnabled_;
+
+ Timeout timeout_;
int debugLevel_;
Modified: gearbox/trunk/submitted/gbxserialacfr/test/CMakeLists.txt
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/test/CMakeLists.txt 2008-02-25 08:15:29 UTC (rev 80)
+++ gearbox/trunk/submitted/gbxserialacfr/test/CMakeLists.txt 2008-02-25 12:00:58 UTC (rev 81)
@@ -4,3 +4,6 @@
GBX_ADD_EXECUTABLE( serialechotest serialechotest.cpp )
GBX_ADD_EXECUTABLE( serialloopbacktest serialloopbacktest.cpp )
+
+MESSAGE( "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}" )
+GBX_ADD_EXAMPLE( gbxserialacfr example.cmake.in example.cmake serialechotest.cpp serialloopbacktest.cpp )
\ No newline at end of file
Added: gearbox/trunk/submitted/gbxserialacfr/test/example.cmake.in
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/test/example.cmake.in (rev 0)
+++ gearbox/trunk/submitted/gbxserialacfr/test/example.cmake.in 2008-02-25 12:00:58 UTC (rev 81)
@@ -0,0 +1,17 @@
+PROJECT( gbxserialacfr_example )
+
+INCLUDE_DIRECTORIES( @CMAKE_INSTALL_PREFIX@/include/gearbox )
+
+ADD_EXECUTABLE( serialechotest serialechotest.cpp )
+TARGET_LINK_LIBRARIES( serialechotest GbxSerialAcfr )
+SET_TARGET_PROPERTIES( serialechotest PROPERTIES
+ LINK_FLAGS "-L@CMAKE_INSTALL_PREFIX@/lib/gearbox"
+ INSTALL_RPATH "${INSTALL_RPATH};@CMAKE_INSTALL_PREFIX@/lib/gearbox"
+ BUILD_WITH_INSTALL_RPATH TRUE )
+
+ADD_EXECUTABLE( serialloopbacktest serialloopbacktest.cpp )
+TARGET_LINK_LIBRARIES( serialloopbacktest GbxSerialAcfr )
+SET_TARGET_PROPERTIES( serialloopbacktest PROPERTIES
+ LINK_FLAGS "-L@CMAKE_INSTALL_PREFIX@/lib/gearbox"
+ INSTALL_RPATH "${INSTALL_RPATH};@CMAKE_INSTALL_PREFIX@/lib/gearbox"
+ BUILD_WITH_INSTALL_RPATH TRUE )
Added: gearbox/trunk/submitted/gbxserialacfr/test/example.readme
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/test/example.readme (rev 0)
+++ gearbox/trunk/submitted/gbxserialacfr/test/example.readme 2008-02-25 12:00:58 UTC (rev 81)
@@ -0,0 +1,12 @@
+Building
+--------
+
+The example can be built by making a directory (anywhere on your system where
+you have write permissions will do), changing to that directory and executing
+CMake with the example's source directory as an argument. For example, if you
+have installed GearBox into /usr/local, you could do the following:
+
+$ cd ~
+$ mkdir urg_nz_example
+$ cd urg_nz_example
+$ ccmake /usr/local/share/gearbox/gbxserialacfr
Modified: gearbox/trunk/submitted/gbxserialacfr/test/serialechotest.cpp
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/test/serialechotest.cpp 2008-02-25 08:15:29 UTC (rev 80)
+++ gearbox/trunk/submitted/gbxserialacfr/test/serialechotest.cpp 2008-02-25 12:00:58 UTC (rev 81)
@@ -35,9 +35,7 @@
exit(1);
}
- const bool enableTimeouts = true;
- gbxserialacfr::Serial serial( argv[1], atoi(argv[2]), enableTimeouts );
- serial.setTimeout( 1, 0 );
+ gbxserialacfr::Serial serial( argv[1], atoi(argv[2]), gbxserialacfr::Serial::Timeout(1,0) );
std::vector<unsigned char> data;
while ( true )
Modified: gearbox/trunk/submitted/gbxserialacfr/test/serialloopbacktest.cpp
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/test/serialloopbacktest.cpp 2008-02-25 08:15:29 UTC (rev 80)
+++ gearbox/trunk/submitted/gbxserialacfr/test/serialloopbacktest.cpp 2008-02-25 12:00:58 UTC (rev 81)
@@ -39,9 +39,7 @@
exit(1);
}
- const bool enableTimeouts = true;
- gbxserialacfr::Serial serial( argv[1], atoi(argv[2]), enableTimeouts );
- serial.setTimeout( 1, 0 );
+ gbxserialacfr::Serial serial( argv[1], atoi(argv[2]), gbxserialacfr::Serial::Timeout(1,0) );
const uint NUM_CHARS = 1000;
std::vector<std::string> stringList = getStringList();
Modified: gearbox/trunk/submitted/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.cpp
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.cpp 2008-02-25 08:15:29 UTC (rev 80)
+++ gearbox/trunk/submitted/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.cpp 2008-02-25 12:00:58 UTC (rev 81)
@@ -41,14 +41,12 @@
//////////////////////////////////////////////////////////////////////
-SerialDeviceHandler::SerialDeviceHandler( const std::string &subsysName,
- gbxserialacfr::Serial &serialPort,
- IResponseParser &responseParser,
- gbxutilacfr::Tracer &tracer,
- gbxutilacfr::Status &status,
- int serialTimeoutSec,
- int serialTimeoutUsec,
- int unparsedBytesWarnThreshold )
+SerialDeviceHandler::SerialDeviceHandler( const std::string &subsysName,
+ gbxserialacfr::Serial &serialPort,
+ IResponseParser &responseParser,
+ gbxutilacfr::Tracer &tracer,
+ gbxutilacfr::Status &status,
+ int unparsedBytesWarnThreshold )
: gbxiceutilacfr::SubsystemThread( tracer, status, subsysName ),
serial_(serialPort),
responseParser_(responseParser),
@@ -59,8 +57,6 @@
tracer_(tracer),
status_(status)
{
- serial_.setTimeout( serialTimeoutSec, serialTimeoutUsec );
-
status_.setMaxHeartbeatInterval( subsysName, 60 );
status_.initialising( subsysName );
}
Modified: gearbox/trunk/submitted/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.h
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.h 2008-02-25 08:15:29 UTC (rev 80)
+++ gearbox/trunk/submitted/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.h 2008-02-25 12:00:58 UTC (rev 81)
@@ -97,14 +97,12 @@
// - 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,
- gbxutilacfr::Tracer &tracer,
- gbxutilacfr::Status &status,
- int serialTimeoutSec=0,
- int serialTimeoutUsec=200000,
- int unparsedBytesWarnThreshold=20000 );
+ SerialDeviceHandler( const std::string &subsysName,
+ gbxserialacfr::Serial &serialPort,
+ IResponseParser &responseParser,
+ gbxutilacfr::Tracer &tracer,
+ gbxutilacfr::Status &status,
+ int unparsedBytesWarnThreshold = 20000 );
~SerialDeviceHandler();
Modified: gearbox/trunk/submitted/gbxsickacfr/serialhandler.cpp
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/serialhandler.cpp 2008-02-25 08:15:29 UTC (rev 80)
+++ gearbox/trunk/submitted/gbxsickacfr/serialhandler.cpp 2008-02-25 12:00:58 UTC (rev 81)
@@ -18,10 +18,10 @@
SerialHandler::SerialHandler( const std::string &dev,
gbxutilacfr::Tracer &tracer,
gbxutilacfr::Status &status )
- : serialPort_( dev.c_str(), 9600, true ),
+ : serialPort_( dev.c_str(), 9600, gbxserialacfr::Serial::Timeout( 0, 200000 ) ),
serialDeviceHandler_(
new gbxserialdeviceacfr::SerialDeviceHandler( "LaserSerialHandler",
- serialPort_, responseParser_, tracer, status ) ),
+ serialPort_, responseParser_, tracer, status ) ),
serialDeviceHandlerThreadPtr_( serialDeviceHandler_ )
{
serialDeviceHandler_->start();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gb...@us...> - 2008-02-25 08:15:24
|
Revision: 80
http://gearbox.svn.sourceforge.net/gearbox/?rev=80&view=rev
Author: gbiggs
Date: 2008-02-25 00:15:29 -0800 (Mon, 25 Feb 2008)
Log Message:
-----------
Added code to force ENABLE_* variables to off in ccmake UI if dependencies aren't met.
Modified Paths:
--------------
gearbox/trunk/cmake/internal/DependencyUtils.cmake
Modified: gearbox/trunk/cmake/internal/DependencyUtils.cmake
===================================================================
--- gearbox/trunk/cmake/internal/DependencyUtils.cmake 2008-02-25 07:45:51 UTC (rev 79)
+++ gearbox/trunk/cmake/internal/DependencyUtils.cmake 2008-02-25 08:15:29 UTC (rev 80)
@@ -1,3 +1,23 @@
+MACRO( GBX_MAKE_OPTION_NAME option_name module_type module_name )
+
+ STRING ( COMPARE EQUAL ${module_type} "EXE" is_exe )
+ STRING ( COMPARE EQUAL ${module_type} "LIB" is_lib )
+ IF ( NOT is_exe AND NOT is_lib )
+ MESSAGE ( FATAL_ERROR "In macro GBX_MAKE_OPTION_NAME, module_type must be either 'EXE' or 'LIB'" )
+ ENDIF ( NOT is_exe AND NOT is_lib )
+ IF ( is_exe AND is_lib )
+ MESSAGE ( FATAL_ERROR "In macro GBX_MAKE_OPTION_NAME, module_type must be either 'EXE' or 'LIB'" )
+ ENDIF ( is_exe AND is_lib )
+
+ STRING( TOUPPER ${module_name} module_name_upper )
+ IF ( is_exe )
+ SET( option_name "ENABLE_${module_name_upper}" )
+ ELSE ( is_exe )
+ SET( option_name "ENABLE_LIB_${module_name_upper}" )
+ ENDIF ( is_exe )
+
+ENDMACRO( GBX_MAKE_OPTION_NAME option_name module_name )
+
#
# GBX_REQUIRE_OPTION( cumulative_var [EXE | LIB] module_name default_option_value [option_name] [OPTION DESCRIPTION] )
#
@@ -77,10 +97,10 @@
STRING ( COMPARE EQUAL ${module_type} "EXE" is_exe )
STRING ( COMPARE EQUAL ${module_type} "LIB" is_lib )
IF ( NOT is_exe AND NOT is_lib )
- MESSAGE ( FATAL_ERROR "In macro GBX_REQUIRE_OPTION, module_type must be either 'EXE' or 'LIB'" )
+ MESSAGE ( FATAL_ERROR "In macro GBX_REQUIRE_VAR, module_type must be either 'EXE' or 'LIB'" )
ENDIF ( NOT is_exe AND NOT is_lib )
IF ( is_exe AND is_lib )
- MESSAGE ( FATAL_ERROR "In macro GBX_REQUIRE_OPTION, module_type must be either 'EXE' or 'LIB'" )
+ MESSAGE ( FATAL_ERROR "In macro GBX_REQUIRE_VAR, module_type must be either 'EXE' or 'LIB'" )
ENDIF ( is_exe AND is_lib )
# must dereference both var names once (!) and IF will evaluate their values
@@ -112,10 +132,10 @@
STRING ( COMPARE EQUAL ${module_type} "EXE" is_exe )
STRING ( COMPARE EQUAL ${module_type} "LIB" is_lib )
IF ( NOT is_exe AND NOT is_lib )
- MESSAGE ( FATAL_ERROR "In macro GBX_REQUIRE_OPTION, module_type must be either 'EXE' or 'LIB'" )
+ MESSAGE ( FATAL_ERROR "In macro GBX_REQUIRE_TARGET, module_type must be either 'EXE' or 'LIB'" )
ENDIF ( NOT is_exe AND NOT is_lib )
IF ( is_exe AND is_lib )
- MESSAGE ( FATAL_ERROR "In macro GBX_REQUIRE_OPTION, module_type must be either 'EXE' or 'LIB'" )
+ MESSAGE ( FATAL_ERROR "In macro GBX_REQUIRE_TARGET, module_type must be either 'EXE' or 'LIB'" )
ENDIF ( is_exe AND is_lib )
IF ( ${ARGC} GREATER 5 )
@@ -129,10 +149,13 @@
# must dereference both var and option names once (!) and IF will evaluate their values
IF ( ${cumulative_var} AND NOT target_location )
SET( ${cumulative_var} FALSE )
+ GBX_MAKE_OPTION_NAME( option_name ${module_type} ${module_name} )
IF ( is_exe )
GBX_NOT_ADD_EXECUTABLE( ${module_name} ${reason} )
+ SET( ${option_name} OFF CACHE BOOL "Try to build ${module_name}" FORCE )
ELSE ( is_exe )
GBX_NOT_ADD_LIBRARY( ${module_name} ${reason} )
+ SET( ${option_name} OFF CACHE BOOL "Try to build lib${module_name} library" FORCE )
ENDIF ( is_exe )
ENDIF ( ${cumulative_var} AND NOT target_location )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rum...@us...> - 2008-02-25 07:45:52
|
Revision: 79
http://gearbox.svn.sourceforge.net/gearbox/?rev=79&view=rev
Author: rumataxyz
Date: 2008-02-24 23:45:51 -0800 (Sun, 24 Feb 2008)
Log Message:
-----------
stopped building docs for submitted
Modified Paths:
--------------
gearbox/trunk/doc/doxyfile
Modified: gearbox/trunk/doc/doxyfile
===================================================================
--- gearbox/trunk/doc/doxyfile 2008-02-22 06:29:52 UTC (rev 78)
+++ gearbox/trunk/doc/doxyfile 2008-02-25 07:45:51 UTC (rev 79)
@@ -72,8 +72,8 @@
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = . \
- ../src \
- ../submitted
+ ../src #\
+ #../submitted #uncomment this if you want to see docs for submitted librarys
FILE_PATTERNS = *.cpp \
*.cxx \
*.hpp \
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2008-02-22 06:29:46
|
Revision: 78
http://gearbox.svn.sourceforge.net/gearbox/?rev=78&view=rev
Author: borax00
Date: 2008-02-21 22:29:52 -0800 (Thu, 21 Feb 2008)
Log Message:
-----------
applied comments from Micahel's review.
Modified Paths:
--------------
gearbox/trunk/submitted/gbxsickacfr/doc.dox
gearbox/trunk/submitted/gbxsickacfr/driver.cpp
gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/buffer.h
gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/thread.cpp
gearbox/trunk/submitted/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.cpp
gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/status.h
gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/tracer.h
gearbox/trunk/submitted/gbxsickacfr/test/test.cpp
Modified: gearbox/trunk/submitted/gbxsickacfr/doc.dox
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/doc.dox 2008-02-22 02:58:17 UTC (rev 77)
+++ gearbox/trunk/submitted/gbxsickacfr/doc.dox 2008-02-22 06:29:52 UTC (rev 78)
@@ -43,8 +43,7 @@
@par Limitations
- This is a Linux-only implementation.
-- It has not been tested at 500k baud.
-- It has only been tested on the LMS-291
+- It works with those serial devices which @ref gbx_library_gbxserialacfr supports.
*/
Modified: gearbox/trunk/submitted/gbxsickacfr/driver.cpp
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/driver.cpp 2008-02-22 02:58:17 UTC (rev 77)
+++ gearbox/trunk/submitted/gbxsickacfr/driver.cpp 2008-02-22 06:29:52 UTC (rev 78)
@@ -357,7 +357,7 @@
{
stringstream ss;
ss << "Driver: Trying to connect at " << baudRates[baudRateI] << " baud.";
- tracer_.debug( ss.str() );
+ tracer_.info( ss.str() );
serialHandler_->setBaudRate( baudRates[baudRateI] );
Modified: gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/buffer.h
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/buffer.h 2008-02-22 02:58:17 UTC (rev 77)
+++ gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/buffer.h 2008-02-22 06:29:52 UTC (rev 78)
@@ -87,7 +87,7 @@
//! Returns buffer type.
BufferType type() const;
- //! Returns TRUE if there's something in the buffer.
+ //! Returns FALSE if there's something in the buffer.
bool isEmpty() const;
//! Returns the number of items in the buffer.
Modified: gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/thread.cpp
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/thread.cpp 2008-02-22 02:58:17 UTC (rev 77)
+++ gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/thread.cpp 2008-02-22 06:29:52 UTC (rev 78)
@@ -92,31 +92,5 @@
}
}
-// void gbxiceutilacfr::stopAndJoin( const std::vector<gbxiceutilacfr::Thread *> &threads )
-// {
-// std::vector<IceUtil::ThreadControl*> tc;
-// for ( uint i=0; i < threads.size(); i++ )
-// {
-// if ( !threads[i] )
-// {
-// tc[i] = NULL;
-// continue;
-// }
-
-// tc[i] = new IceUtil::ThreadControl( threads[i]->getThreadControl() );
-// threads[i]->stop();
-// }
-
-// for ( uint i=0; i < threads.size(); i++ )
-// {
-// if ( tc[i] == NULL )
-// continue;
-
-// tc[i]->join();
-
-// delete tc[i];
-// }
-// }
-
}
} // namespace
Modified: gearbox/trunk/submitted/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.cpp
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.cpp 2008-02-22 02:58:17 UTC (rev 77)
+++ gearbox/trunk/submitted/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.cpp 2008-02-22 06:29:52 UTC (rev 78)
@@ -126,6 +126,9 @@
tracer_.debug( "SerialDeviceHandler: Changing baud rate and flushing." );
baudRateChangePending_ = false;
serial_.setBaudRate( newBaudRate_ );
+ // TODO: AlexB: not entirely sure if these are
+ // necessary, they should either be removed or
+ // added to the setBaudRate function.
serial_.flush();
serial_.drain();
}
Modified: gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/status.h
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/status.h 2008-02-22 02:58:17 UTC (rev 77)
+++ gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/status.h 2008-02-22 06:29:52 UTC (rev 78)
@@ -21,10 +21,11 @@
@par Overview
-Status provides a machine-readable interface such that other components can
-monitor this component's status. A single Status object is meant to be shared by all
-threads in the component so the implementation must be thread-safe. The idea is that Status
-tracks the state of a number of subsystems (most often one per thread).
+Status provides a machine-readable interface such that tools external
+to the library can monitor its status. A single Status object is meant
+to be shared by all threads in the library, so the implementation must
+be thread-safe. The idea is that Status tracks the state of a number
+of subsystems (most often one per thread).
Each subsystem should first call addSubsystem(), to make the
Status engine aware that it exists. If any other function is called before
@@ -35,37 +36,19 @@
longer than maxHeartbeatIntervalSec, it is assumed that the
subsystem has stalled (hung).
-The initial default state of Initialising. As soon as initialisation of the
-subsystem is finished, you should call ok(). This maybe used by external tools
-as an indication that your subsystem is in "normal" working state.
+The initial default state is Initialising. As soon as initialisation
+of the subsystem is finished, you should call ok(). This maybe used by
+external tools as an indication that your subsystem is in "normal"
+working state.
-Status will publish the entire status of every subsystem whenever
-anything changes, or every @c Orca.Status.PublishPeriod, whichever
-occurs first.
-
@par Local Calls
-After registering with setMaxHeartbeatInterval, components set
-their subsystems' status with the various calls. Each of the calls
-is sufficient to let the Status engine know that the subsystem is alive.
-The special call 'heartbeat' lets Status know that the subsystem is
- alive without modifying its status.
+After registering with setMaxHeartbeatInterval, set the subsystems'
+status with the various calls. Each of the calls is sufficient to let
+the Status engine know that the subsystem is alive. The special call
+'heartbeat' lets Status know that the subsystem is alive without
+modifying its status.
-@par Configuration parameters
-
-- @c Orca.Status.RequireIceStorm (bool)
- - gbxutilacfr::Component sets up a status and tries to connect to an
- IceStorm server on the same host in order to publish component's
- status messages. This parameter determines what happens if no server
- is found. If set to 0, the startup continues with status messages not
- published remotely. If set to 1, the application exits.
- - Default: 0
-
-- @c Orca.Status.PublishPeriod (double)
- - The minimum interval, in seconds, between remote publishing of status messages.
- The actual interval will be less if status changes.
- - Default: 30
-
@sa Tracer
*/
class Status
@@ -92,7 +75,7 @@
subsystem is left unchanged and warning trace is produced.
May also specify the maximum expected interval between heartbeats.
- When time since last heartbeat exceeds this, alarm is raised. Heartbeat interval is normally
+ When time since last heartbeat exceeds this, an alarm is raised. Heartbeat interval is normally
positive, measured in seconds. Negative interval means infinite interval, this is the default behavior.
The initial state of the subsystem is Initialising.
@@ -104,10 +87,10 @@
// Throws gbxutilacfr::Exception if the subsystem does not exist.
virtual void removeSubsystem( const std::string& subsystem )=0;
- // Modifies maximum expected interval between heartbeats.
+ // 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 interval )=0;
+ 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.
Modified: gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/tracer.h
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/tracer.h 2008-02-22 02:58:17 UTC (rev 77)
+++ gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/tracer.h 2008-02-22 06:29:52 UTC (rev 78)
@@ -19,17 +19,15 @@
//
// @brief Local and remote tracing.
//
-// Orca Tracer is similar to the Ice Logger interface. We call it Tracer because
-// we use it to log trace statements, e.g. warnings, error messages, etc (not data).
+// 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 all threads in the component so the
+// 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
-// Tracer* tracer = context().tracer();
// std::string s = "something is wrong";
// tracer->error( s );
// @endverbatim
@@ -48,33 +46,10 @@
// }
// @endverbatim
//
-//
-// @par Tracer Configuration
-//
-// - @c Orca.Tracer.RequireIceStorm (bool)
-// - gbxutilacfr::Component sets up a tracer and tries to connect to an
-// IceStorm server on the same host in order to publish component's
-// trace messages. This parameter determines what happens if no server
-// is found. If set to 0, the startup continues with trace messages not
-// published remotely. If set to 1, the application exits.
-// - Default: 0
-//
-// - @c Orca.Tracer.Filename (string)
-// - The name of the output file to which trace statements are
-// saved. Each component creates its own file. If you want several
-// component to write trace files and they execute in the same
-// directory you have to set this property to unique file names in the
-// component config file.
-// - Default: "orca_component_trace.txt"
-//
-// - @c Orca.Tracer.Timestamp (bool)
-// - Print timestamp before all trace statements.
-// - Default: 1
-//
// 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 as follows:
+// 10 (everything). The built-in defaults are as follows:
// @verbatim
// ToDisplay ToNetwork ToLog ToFile
// Info 1 0 0 0
@@ -83,34 +58,8 @@
// Debug 0 0 0 0
// @endverbatim
//
-// The Tracer interface allows components to subscribe for tracing with the following functions:
-// - subscribeForComponentMessages
-// - subscribeForPlatformInfoMessages
-// - subscribeForPlatformWarningMessages
-// - subscribeForPlatformErrorMessages
-//
-// The first will get all messages sent ToNetwork by this component.
-// The last three will get all info/warning/error messages sent by components on this platform.
-//
-//
-// For ToNetwork tracing, any messages are sent to the component's topic,
-// something like: 'tracer/*@platformName/componentName'.
-//
-// In addition, Tracer aggregates all ToNetwork info/warning/error messages for a
-// platform, sending them to the following topics:
-// - */info@platformName/*
-// - */warning@platformName/*
-// - */error@platformName/*
-//
-// A sample configuration file which sets all parameters to sensible defaults is shown here.
-//
-// @include libs/orcaice/orcarc
-// *
// @see Status
//
-//
-// implem notes:
-// - The local API of this class could also be defined as a local interface in Slice.
class Tracer
{
public:
@@ -141,9 +90,9 @@
enum DestinationType {
// Write to stardard display
ToDisplay=0,
- // Send over the network to an IceStorm topic
+ // Send over the network, details specific to Tracer implementation
ToNetwork,
- // Write to SysLog on Unix, EventLog on windows (currently only SysLog implemented)
+ // Write to SysLog on Unix, EventLog on windows
ToLog,
// Write to a file
ToFile,
@@ -160,10 +109,6 @@
int verbosity[NumberOfTraceTypes][NumberOfDestinationTypes];
// affects only the printout to stdout. Remote messages always have a timestamp.
bool addTimestamp;
- // If the message and source are identical, ignore this message
-// bool ignoreRepeatedWarnings;
- // If the message and source are identical, ignore this message
-// bool ignoreRepeatedErrors;
};
// LOCAL INTERFACE
Modified: gearbox/trunk/submitted/gbxsickacfr/test/test.cpp
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/test/test.cpp 2008-02-22 02:58:17 UTC (rev 77)
+++ gearbox/trunk/submitted/gbxsickacfr/test/test.cpp 2008-02-22 06:29:52 UTC (rev 78)
@@ -96,16 +96,23 @@
try
{
device->read( data );
+
+ cout<<"Test: Got scan "<<i+1<<" of "<<numReads<<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;
}
catch ( const std::exception& e )
{
cout <<"Test: Failed to read scan: "<<e.what()<<endl;
- }
-
- cout<<"Test: Got scan "<<i+1<<" of "<<numReads<<endl;
-
- if ( data.haveWarnings )
- cout << "got warnings: " << data.warnings << endl;
+ }
}
delete device;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2008-02-22 02:58:15
|
Revision: 77
http://gearbox.svn.sourceforge.net/gearbox/?rev=77&view=rev
Author: borax00
Date: 2008-02-21 18:58:17 -0800 (Thu, 21 Feb 2008)
Log Message:
-----------
Applied changes from Michael's review.
Modified Paths:
--------------
gearbox/trunk/submitted/gbxserialacfr/doc.dox
gearbox/trunk/submitted/gbxserialacfr/lockfile/lockfile.cpp
gearbox/trunk/submitted/gbxserialacfr/serial.cpp
gearbox/trunk/submitted/gbxserialacfr/serial.h
gearbox/trunk/submitted/gbxserialacfr/test/serialechotest.cpp
gearbox/trunk/submitted/gbxsickacfr/doc.dox
Modified: gearbox/trunk/submitted/gbxserialacfr/doc.dox
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/doc.dox 2008-02-20 00:45:24 UTC (rev 76)
+++ gearbox/trunk/submitted/gbxserialacfr/doc.dox 2008-02-22 02:58:17 UTC (rev 77)
@@ -25,6 +25,11 @@
#include <gbxserialacfr/serial.h>
@endverbatim
+@par Example
+ See:
+ - test/serialechotest.cpp
+ - test/serialloopbacktest.cpp
+
@par Other serial libraries
- http://libserial.sourceforge.net (GPL)
@@ -33,14 +38,18 @@
@par Tested On
- rs232 only (ie not rs422)
+ - Not tested at 500k baud
- For USB-to-serial devices, tested on FTDI-based devices only
+@par Style
+ See http://orca-robotics.sourceforge.net/orca/orca_doc_style.html
+
@par Copyright
Alex Brooks, Mathew Ridley
@par Responsible Developer
Alex Brooks
-
+
*/
/*!
Modified: gearbox/trunk/submitted/gbxserialacfr/lockfile/lockfile.cpp
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/lockfile/lockfile.cpp 2008-02-20 00:45:24 UTC (rev 76)
+++ gearbox/trunk/submitted/gbxserialacfr/lockfile/lockfile.cpp 2008-02-22 02:58:17 UTC (rev 77)
@@ -110,7 +110,7 @@
stringstream ss; ss << "device " << dev << " is already locked by process PID " << pidOfLocker;
throw LockFileException( ss.str() );
}
- else
+ else if ( errno == ESRCH )
{
// The process which owns the lock no longer exists. Clean up.
ret = unlink( lbuf );
@@ -130,7 +130,13 @@
throw LockFileException( ss.str() );
}
}
- }
+ else
+ {
+ stringstream ss;
+ ss << "lock_dev: Don't expect to see this errno after kill: " << strerror(errno);
+ throw LockFileException( ss.str() );
+ }
+ }
ret = unlink(pbuf);
if ( ret < 0 )
@@ -176,7 +182,11 @@
LockFile::~LockFile()
{
- unlock_dev( dev_.c_str(), lockPid_ );
+ // Don't allow exceptions from destructor
+ try {
+ unlock_dev( dev_.c_str(), lockPid_ );
+ }
+ catch ( ... ) {}
}
}
Modified: gearbox/trunk/submitted/gbxserialacfr/serial.cpp
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/serial.cpp 2008-02-20 00:45:24 UTC (rev 76)
+++ gearbox/trunk/submitted/gbxserialacfr/serial.cpp 2008-02-22 02:58:17 UTC (rev 77)
@@ -8,6 +8,7 @@
*
*/
+#include <termios.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/ioctl.h>
@@ -142,7 +143,7 @@
#endif
default:
stringstream ss;
- ss << "Serial::baud() Invalid baud rate: " << baudRate;
+ ss << "Serial::"<<__func__<<"() Invalid baud rate: " << baudRate;
throw SerialException( ss.str() );
}
}
@@ -215,7 +216,7 @@
return 4000000;
default:
stringstream ss;
- ss << "Serial::baud() Invalid baud rate: " << baudRate;
+ ss << "Serial::"<<__func__<<"() Invalid baud rate: " << baudRate;
throw SerialException( ss.str() );
}
}
@@ -371,7 +372,7 @@
setBaudRate( baudRate );
if(debugLevel_ > 2){
- cout << "At end of Serial::Serial: " << getStatusString();
+ cout << "At end of Serial::Serial(): " << getStatusString();
}
}
catch ( const SerialException &e )
@@ -404,17 +405,27 @@
Serial::close()
{
if ( debugLevel_ > 0 )
- cout<<"TRACE(serial.cpp): close()" << endl;
+ {
+ // AlexB: Not sure if cout::operator<< can throw, be careful just in case.
+ try {
+ cout<<"TRACE(serial.cpp): "<<__func__<<"()" << endl;
+ }
+ catch ( ... ) {}
+ }
assert( portFd_ != -1 );
if(tcdrain(portFd_))
{
- perror("Serial::close():tcdrain()");
+ stringstream ss;
+ ss << "Serial::"<<__func__<<"():tcdrain()";
+ perror(ss.str().c_str());
}
if (::close(portFd_))
{
- perror("Serial::close():close()");
+ stringstream ss;
+ ss << "Serial::"<<__func__<<"():close()";
+ perror(ss.str().c_str());
}
// Make sure that we force this back to an invalid state
@@ -427,16 +438,18 @@
struct termios localOptions;
if ( debugLevel_ > 0 )
- cout<<"TRACE(serial.cpp): setBaudRate("<<baud<<")" << endl;
+ cout<<"TRACE(serial.cpp): "<<__func__<<"("<<baud<<")" << endl;
if(portFd_==-1)
{
- throw SerialException( "Serial:baud() no valid device open" );
+ stringstream ss;
+ ss << "Serial::"<<__func__<<"(): no valid device open";
+ throw SerialException( ss.str() );
}
if(tcgetattr(portFd_, &localOptions) == -1)
{
stringstream ss;
- ss << "Serial::baud():tcgetattr() Error reading attr: " << strerror(errno);
+ ss << "Serial::"<<__func__<<"():tcgetattr() Error reading attr: " << strerror(errno);
throw SerialException( ss.str() );
}
@@ -458,7 +471,7 @@
if (ioctl(portFd_, TIOCGSERIAL, &serinfo) < 0)
{
stringstream ss;
- ss << "Serial::setBaudRate("<<baud<<"): error calling 'ioctl(portFd_, TIOCGSERIAL, &serinfo)': "<<strerror(errno);
+ ss << "Serial::"<<__func__<<"("<<baud<<"): error calling 'ioctl(portFd_, TIOCGSERIAL, &serinfo)': "<<strerror(errno);
throw SerialException( ss.str() );
}
@@ -468,7 +481,7 @@
if (ioctl(portFd_, TIOCSSERIAL, &serinfo) < 0)
{
stringstream ss;
- ss << "Serial::setBaudRate("<<baud<<"): error calling 'ioctl(portFd_, TIOCSSERIAL, &serinfo)': "<<strerror(errno);
+ ss << "Serial::"<<__func__<<"("<<baud<<"): error calling 'ioctl(portFd_, TIOCSSERIAL, &serinfo)': "<<strerror(errno);
throw SerialException( ss.str() );
}
}
@@ -476,7 +489,7 @@
if ( tcsetattr(portFd_, TCSAFLUSH, &localOptions) == -1 )
{
stringstream ss;
- ss << "Serial::baud():tcsetattr() Error setting attr: " << strerror(errno);
+ ss << "Serial::"<<__func__<<"():tcsetattr() Error setting attr: " << strerror(errno);
throw SerialException( ss.str() );
}
}
@@ -493,7 +506,7 @@
if ( portFd_ == -1 )
{
stringstream ss;
- ss << "Serial::open(): failed to open '"<<dev_<<"': "<<strerror(errno);
+ ss << "Serial::"<<__func__<<"(): failed to open '"<<dev_<<"': "<<strerror(errno);
throw SerialException( ss.str() );
}
@@ -502,16 +515,14 @@
{
close();
stringstream ss;
- ss << "Serial::open(): tcgetattr() failed for '"<<dev_<<"': "<<strerror(errno);
+ ss << "Serial::"<<__func__<<"(): tcgetattr() failed for '"<<dev_<<"': "<<strerror(errno);
throw SerialException( ss.str() );
}
if(debugLevel_ > 2){
- cout << "At beginning of open(): "<<getStatusString()<<endl;
+ cout << "At beginning of "<<__func__<<"(): "<<getStatusString()<<endl;
}
-
-
// enable receiver & ignore control lines
localOptions.c_cflag |= (CLOCAL | CREAD) ;
@@ -541,31 +552,32 @@
{
close();
stringstream ss;
- ss << "Serial::open(): tcsetattr() failed for '"<<dev_<<"': "<<strerror(errno);
+ ss << "Serial::"<<__func__<<"(): tcsetattr() failed for '"<<dev_<<"': "<<strerror(errno);
throw SerialException( ss.str() );
}
if ( debugLevel_ > 2 ){
- cout << "At end of open():" << getStatusString();
+ cout << "At end of "<<__func__<<"():" << getStatusString();
}
-
}
int
Serial::read(void *buf, int count)
{
if ( debugLevel_ > 0 )
- cout<<"TRACE(serial.cpp): read()" << endl;
+ cout<<"TRACE(serial.cpp): "<<__func__<<"()" << endl;
int got = ::read(portFd_, buf, count);
if ( got < 0 )
{
- throw SerialException( string("Serial::read(): ") + strerror(errno) );
+ stringstream ss;
+ ss << "Serial::"<<__func__<<"(): " << strerror(errno);
+ throw SerialException( ss.str() );
}
if ( debugLevel_ > 1 )
{
- cout<<"TRACE(serial.cpp): read: '";
+ cout<<"TRACE(serial.cpp): just read: '";
for ( int i=0; i < count; i++ )
cout << ((char*)(buf))[i];
cout << "'" << endl;
@@ -580,7 +592,7 @@
Serial::readFull(void *buf, int count)
{
if ( debugLevel_ > 0 )
- cout<<"TRACE(serial.cpp): readFull(): count=" << count << endl;
+ cout<<"TRACE(serial.cpp): "<<__func__<<"(): count=" << count << endl;
char* bufPtr = static_cast<char*>(buf);
@@ -605,7 +617,9 @@
else
{
- throw SerialException( std::string("Serial::readFullWithTimeout: read(): ")+strerror(errno) );
+ stringstream ss;
+ ss << "Serial::"<<__func__<<": read(): "<<strerror(errno);
+ throw SerialException( ss.str() );
}
}
@@ -620,7 +634,7 @@
Serial::readLine(void *buf, int count, char termchar)
{
if ( debugLevel_ > 0 ){
- cout<<"TRACE(serial.cpp): readLine ";
+ cout<<"TRACE(serial.cpp): "<<__func__<<"(): ";
if(timeoutsEnabled_){
cout << "timeouts enabled"<<endl;
}else{
@@ -639,7 +653,9 @@
//Check for buf overrun Must leave room for NULL terminator
if ( dataPtr >= bufPtr + (count - 1) )
{
- throw SerialException( "Serial::readLine: Not enough room in buffer" );
+ stringstream ss;
+ ss << "Serial::"<<__func__<<": Not enough room in buffer";
+ throw SerialException( ss.str() );
}
int ret = ::read( portFd_, &nextChar, 1 );
@@ -662,7 +678,9 @@
}
//If we get here then it was a more serious error
- throw SerialException( std::string( "Serial::readLine(): ")+strerror(errno) );
+ stringstream ss;
+ ss << "Serial::"<<__func__<<"(): "<<strerror(errno);
+ throw SerialException( ss.str() );
}
} while (nextChar != termchar);
@@ -685,7 +703,9 @@
if(ret==-1)
{
- throw SerialException( std::string("Serial::bytesAvailable(): ")+strerror(errno) );
+ stringstream ss;
+ ss << "Serial::"<<__func__<<": "<< strerror(errno);
+ throw SerialException( ss.str() );
}
return n_read;
}
@@ -718,7 +738,9 @@
}
if(selval<0)
{
- throw SerialException( std::string("Serial::waitForTimeout: select(): ")+strerror(errno) );
+ stringstream ss;
+ ss << "Serial::"<<__func__<<": select(): "<<strerror(errno);
+ throw SerialException( ss.str() );
}
return GOT_DATA;
@@ -729,24 +751,28 @@
Serial::writeString(const char *str)
{
if ( debugLevel_ > 0 )
- cout<<"TRACE(serial.cpp): writeString(): writing '"<<str<<"'" << endl;
+ cout<<"TRACE(serial.cpp): "<<__func__<<"(): writing '"<<str<<"'" << endl;
int put;
put = ::write(portFd_, str, strlen(str) );
if ( put < 0 )
{
- throw SerialException( string("Serial::write(): ")+strerror(errno) );
+ stringstream ss;
+ ss << "Serial::"<<__func__<<"(): " << strerror(errno);
+ throw SerialException( ss.str() );
}
else if ( put == 0 )
{
- throw SerialException( "Serial::writeString(): ::write() returned 0" );
+ stringstream ss;
+ ss << "Serial::"<<__func__<<"(): ::write() returned 0";
+ throw SerialException( ss.str() );
}
else if ( put < (int)(strlen(str)) )
{
// AlexB: Not sure what to do here... This can happen eg if the buffer is full.
// I'm not convinced that we want to throw an exception, but chances are
// lots of users won't check the return code.
- cout << "WARNING: Serial::writeString: only wrote " << put << " of " << strlen(str) << " bytes." << endl;
+ cout << "WARNING: Serial::"<<__func__<<": only wrote " << put << " of " << strlen(str) << " bytes." << endl;
}
if ( debugLevel_ > 1 )
@@ -765,7 +791,9 @@
if(tcgetattr(portFd_, &status) == -1)
{
close();
- throw SerialException( std::string("Serial::getStatusString(): tcgetattr():")+strerror(errno) );
+ stringstream ss;
+ ss << "Serial::"<<__func__<<"(): tcgetattr():"<<strerror(errno);
+ throw SerialException( ss.str() );
}
stringstream ss;
@@ -778,7 +806,7 @@
if (ioctl(portFd_, TIOCGSERIAL, &serinfo) < 0)
{
stringstream ss;
- ss << "Serial::getStatusString(): error calling 'ioctl(portFd_, TIOCGSERIAL, &serinfo)': "<<strerror(errno);
+ ss << "Serial::"<<__func__<<"(): error calling 'ioctl(portFd_, TIOCGSERIAL, &serinfo)': "<<strerror(errno);
throw SerialException( ss.str() );
}
ss << serinfo;
@@ -793,7 +821,9 @@
int ret = tcflush(portFd_,TCIOFLUSH);
if ( ret < 0 )
{
- throw SerialException( std::string("Serial::flush(): ")+strerror(errno) );
+ stringstream ss;
+ ss << "Serial::"<<__func__<<"(): "<<strerror(errno);
+ throw SerialException( ss.str() );
}
}
@@ -803,7 +833,9 @@
// wait till all output sent
if(tcdrain(portFd_))
{
- throw SerialException( std::string("Serial::drain(): tcdrain: ")+strerror(errno) );
+ stringstream ss;
+ ss << "Serial::"<<__func__<<"(): tcdrain: "<<strerror(errno);
+ throw SerialException( ss.str() );
}
}
@@ -811,19 +843,27 @@
Serial::write(const void *buf, int count)
{
if ( debugLevel_ > 0 )
- cout<<"TRACE(serial.cpp): write()" << endl;
+ cout<<"TRACE(serial.cpp): "<<__func__<<"()" << endl;
if ( count == 0 )
- throw SerialException( "Serial::write() was called with zero bytes" );
+ {
+ stringstream ss;
+ ss << "Serial:: "<<__func__<<"() was called with zero bytes";
+ throw SerialException( ss.str() );
+ }
int put = ::write(portFd_, buf, count);
if ( put < 0 )
{
- throw SerialException( string("Serial::write(): ")+strerror(errno) );
+ stringstream ss;
+ ss << "Serial:: "<<__func__<<"(): "<<strerror(errno);
+ throw SerialException( ss.str() );
}
else if ( put == 0 )
{
- throw SerialException( "Serial::write(): ::write() returned 0" );
+ stringstream ss;
+ ss << "Serial::"<<__func__<<"(): ::write() returned 0";
+ throw SerialException( ss.str() );
}
if ( debugLevel_ > 1 )
{
Modified: gearbox/trunk/submitted/gbxserialacfr/serial.h
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/serial.h 2008-02-20 00:45:24 UTC (rev 76)
+++ gearbox/trunk/submitted/gbxserialacfr/serial.h 2008-02-22 02:58:17 UTC (rev 77)
@@ -10,9 +10,6 @@
#ifndef GBXSERIALACFR_SERIAL_H
#define GBXSERIALACFR_SERIAL_H
-#include <termios.h>
-#include <sys/types.h>
-#include <fcntl.h>
#include <string>
#include <gbxserialacfr/uncopyable.h>
#include <gbxserialacfr/lockfile/lockfile.h>
@@ -63,7 +60,7 @@
//! Destructor closes serial port
~Serial();
- //! turn on/off debug messages
+ //! Debug messages are printed to stdout. debugLevel should be in the range [0,3].
void setDebugLevel( int debugLevel ) { debugLevel_ = debugLevel; }
//! Sets the baud rate. Flushes any data.
@@ -73,10 +70,8 @@
void setTimeout(int sec, int usec);
//! Reads up to @ref count bytes into buffer @ref buf.
- //! Returns the number of bytes read.
- //! Will never return <0 -- throws exceptions instead.
+ //! Returns the number of bytes read, or '-1' on timeout (if timeouts are enabled).
//! If timeouts are not enabled, blocks till it gets something.
- //! If timeouts are enabled, throws an exception if data isn't available.
int read(void *buf, int count);
//! Tries to read exactly @ref count bytes into @ref buf.
@@ -99,7 +94,7 @@
//! char buf[6];
//! serial.readLine( buf, 6 );
//!
- //! where the two extra characters are for the '\n' and the terminating '\0'.
+ //! where the two extra characters are for the "\n" and the terminating "\0".
//!
//! If timeouts are not enabled we might block forever, waiting for the number of bytes we want or an error.
//!
@@ -122,7 +117,7 @@
//! Writes some data. Returns the number of bytes written.
int write(const void *buf, int count);
- //! Writes a ('\0'-terminated) string.
+ //! Writes a ("\0"-terminated) string.
//! Returns the number of bytes written.
int writeString(const char *buf);
inline int writeString(const std::string &s) {
Modified: gearbox/trunk/submitted/gbxserialacfr/test/serialechotest.cpp
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/test/serialechotest.cpp 2008-02-20 00:45:24 UTC (rev 76)
+++ gearbox/trunk/submitted/gbxserialacfr/test/serialechotest.cpp 2008-02-22 02:58:17 UTC (rev 77)
@@ -5,6 +5,7 @@
#include <sstream>
#include <vector>
#include <iomanip>
+#include <assert.h>
using namespace std;
@@ -57,7 +58,9 @@
// cout<<"TRACE(serialechotest.cpp): &(data[0]): " << (int)(&(data[0])) << endl;
// cout<<"TRACE(serialechotest.cpp): data[0]: " << (int)(data[0]) << endl;
- serial.read( &(data[0]), nBytes );
+ int numRead = serial.read( &(data[0]), nBytes );
+ // There were nBytes available, we should be able to read them all
+ assert( numRead == (int)nBytes );
cout << "got data: " << toHexString( data ) << endl;
}
Modified: gearbox/trunk/submitted/gbxsickacfr/doc.dox
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/doc.dox 2008-02-20 00:45:24 UTC (rev 76)
+++ gearbox/trunk/submitted/gbxsickacfr/doc.dox 2008-02-22 02:58:17 UTC (rev 77)
@@ -26,6 +26,9 @@
@par Example
See test/test.cpp
+@par Style
+ See http://orca-robotics.sourceforge.net/orca/orca_doc_style.html
+
@par Copyright
Alex Brooks, Alexei Makarenko, Tobias Kaupp
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rus...@us...> - 2008-02-20 00:45:24
|
Revision: 76
http://gearbox.svn.sourceforge.net/gearbox/?rev=76&view=rev
Author: russo2503v
Date: 2008-02-19 16:45:24 -0800 (Tue, 19 Feb 2008)
Log Message:
-----------
Modified Paths:
--------------
gearbox/trunk/submitted/gbxsickacfr/test/test.cpp
Modified: gearbox/trunk/submitted/gbxsickacfr/test/test.cpp
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/test/test.cpp 2008-02-20 00:44:59 UTC (rev 75)
+++ gearbox/trunk/submitted/gbxsickacfr/test/test.cpp 2008-02-20 00:45:24 UTC (rev 76)
@@ -66,7 +66,8 @@
cout << "Using configuration: " << config.toString() << endl;
// Instantiate objects to handle messages from the driver
- gbxsickacfr::gbxutilacfr::TrivialTracer tracer;
+ const bool debug=false;
+ gbxsickacfr::gbxutilacfr::TrivialTracer tracer( debug );
gbxsickacfr::gbxutilacfr::TrivialStatus status( tracer );
// Instantiate the driver itself
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rus...@us...> - 2008-02-20 00:44:56
|
Revision: 75
http://gearbox.svn.sourceforge.net/gearbox/?rev=75&view=rev
Author: russo2503v
Date: 2008-02-19 16:44:59 -0800 (Tue, 19 Feb 2008)
Log Message:
-----------
fixed timeout issue.
Modified Paths:
--------------
gearbox/trunk/submitted/gbxserialacfr/serial.cpp
gearbox/trunk/submitted/gbxserialacfr/serial.h
Modified: gearbox/trunk/submitted/gbxserialacfr/serial.cpp
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/serial.cpp 2008-02-20 00:35:19 UTC (rev 74)
+++ gearbox/trunk/submitted/gbxserialacfr/serial.cpp 2008-02-20 00:44:59 UTC (rev 75)
@@ -348,8 +348,8 @@
bool useLockFile )
: dev_(dev),
portFd_(-1),
- timeoutSec_(0),
- timeoutUSec_(0),
+ timeoutSec_(1),
+ timeoutUSec_(1),
timeoutsEnabled_(enableTimeouts),
debugLevel_(debuglevel)
{
Modified: gearbox/trunk/submitted/gbxserialacfr/serial.h
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/serial.h 2008-02-20 00:35:19 UTC (rev 74)
+++ gearbox/trunk/submitted/gbxserialacfr/serial.h 2008-02-20 00:44:59 UTC (rev 75)
@@ -51,6 +51,7 @@
//! Opens a device @ref dev.
//! Throws exceptions on error.
+ //! If timeouts are enabled, they default to 1sec.
//! If useLockFile is set to true, Serial will use the file-system to
//! prevent concurrent access to a serial device by multiple instances of Serial.
Serial( const std::string &dev,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2008-02-20 00:35:14
|
Revision: 74
http://gearbox.svn.sourceforge.net/gearbox/?rev=74&view=rev
Author: borax00
Date: 2008-02-19 16:35:19 -0800 (Tue, 19 Feb 2008)
Log Message:
-----------
Modified Paths:
--------------
gearbox/trunk/submitted/gbxsickacfr/test/test.cpp
Modified: gearbox/trunk/submitted/gbxsickacfr/test/test.cpp
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/test/test.cpp 2008-02-20 00:32:37 UTC (rev 73)
+++ gearbox/trunk/submitted/gbxsickacfr/test/test.cpp 2008-02-20 00:35:19 UTC (rev 74)
@@ -33,7 +33,7 @@
string port = "/dev/ttyS0";
// Get some options from the command line
- while ((opt = getopt (argc, argv, "p:c:")) != -1)
+ while ((opt = getopt (argc, argv, "p:b:")) != -1)
{
switch (opt)
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2008-02-20 00:32:48
|
Revision: 73
http://gearbox.svn.sourceforge.net/gearbox/?rev=73&view=rev
Author: borax00
Date: 2008-02-19 16:32:37 -0800 (Tue, 19 Feb 2008)
Log Message:
-----------
rolling back accidental commit
Modified Paths:
--------------
gearbox/trunk/src/urg_nz/example.cmake
Modified: gearbox/trunk/src/urg_nz/example.cmake
===================================================================
--- gearbox/trunk/src/urg_nz/example.cmake 2008-02-20 00:30:13 UTC (rev 72)
+++ gearbox/trunk/src/urg_nz/example.cmake 2008-02-20 00:32:37 UTC (rev 73)
@@ -1,10 +1,10 @@
PROJECT( urg_nz_example )
-INCLUDE_DIRECTORIES( /usr/local )
+INCLUDE_DIRECTORIES( @CMAKE_INSTALL_PREFIX@ )
ADD_EXECUTABLE( urg_nz_example example.cpp )
TARGET_LINK_LIBRARIES( urg_nz_example urg_nz )
SET_TARGET_PROPERTIES( urg_nz_example PROPERTIES
- LINK_FLAGS "-L/usr/local/lib/gearbox"
- INSTALL_RPATH "${INSTALL_RPATH};/usr/local/lib/gearbox"
+ LINK_FLAGS "-L@CMAKE_INSTALL_PREFIX@/lib/gearbox"
+ INSTALL_RPATH "${INSTALL_RPATH};@CMAKE_INSTALL_PREFIX@/lib/gearbox"
BUILD_WITH_INSTALL_RPATH TRUE )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2008-02-20 00:30:08
|
Revision: 72
http://gearbox.svn.sourceforge.net/gearbox/?rev=72&view=rev
Author: borax00
Date: 2008-02-19 16:30:13 -0800 (Tue, 19 Feb 2008)
Log Message:
-----------
Modified Paths:
--------------
gearbox/trunk/src/urg_nz/example.cmake
gearbox/trunk/submitted/gbxserialacfr/serial.cpp
gearbox/trunk/submitted/gbxsickacfr/driver.cpp
Modified: gearbox/trunk/src/urg_nz/example.cmake
===================================================================
--- gearbox/trunk/src/urg_nz/example.cmake 2008-02-19 06:15:55 UTC (rev 71)
+++ gearbox/trunk/src/urg_nz/example.cmake 2008-02-20 00:30:13 UTC (rev 72)
@@ -1,10 +1,10 @@
PROJECT( urg_nz_example )
-INCLUDE_DIRECTORIES( @CMAKE_INSTALL_PREFIX@ )
+INCLUDE_DIRECTORIES( /usr/local )
ADD_EXECUTABLE( urg_nz_example example.cpp )
TARGET_LINK_LIBRARIES( urg_nz_example urg_nz )
SET_TARGET_PROPERTIES( urg_nz_example PROPERTIES
- LINK_FLAGS "-L@CMAKE_INSTALL_PREFIX@/lib/gearbox"
- INSTALL_RPATH "${INSTALL_RPATH};@CMAKE_INSTALL_PREFIX@/lib/gearbox"
- BUILD_WITH_INSTALL_RPATH TRUE )
\ No newline at end of file
+ LINK_FLAGS "-L/usr/local/lib/gearbox"
+ INSTALL_RPATH "${INSTALL_RPATH};/usr/local/lib/gearbox"
+ BUILD_WITH_INSTALL_RPATH TRUE )
Modified: gearbox/trunk/submitted/gbxserialacfr/serial.cpp
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/serial.cpp 2008-02-19 06:15:55 UTC (rev 71)
+++ gearbox/trunk/submitted/gbxserialacfr/serial.cpp 2008-02-20 00:30:13 UTC (rev 72)
@@ -417,7 +417,7 @@
perror("Serial::close():close()");
}
- //Make sure that we force this back to an invalid state
+ // Make sure that we force this back to an invalid state
portFd_ = -1;
}
Modified: gearbox/trunk/submitted/gbxsickacfr/driver.cpp
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/driver.cpp 2008-02-19 06:15:55 UTC (rev 71)
+++ gearbox/trunk/submitted/gbxsickacfr/driver.cpp 2008-02-20 00:30:13 UTC (rev 72)
@@ -87,7 +87,7 @@
Config::toString() const
{
std::stringstream ss;
- ss << "Laser driver config: minr="<<minRange<<" maxr="<<maxRange<<" fov="<<RAD2DEG(fieldOfView)<<"deg start="<<RAD2DEG(startAngle)<<"deg num="<<numberOfSamples;
+ ss << "Laser driver config: device="<<device<<", baudRate="<<baudRate<<", minr="<<minRange<<", maxr="<<maxRange<<", fov="<<RAD2DEG(fieldOfView)<<"deg, start="<<RAD2DEG(startAngle)<<"deg, num="<<numberOfSamples;
return ss.str();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <to...@us...> - 2008-02-19 06:15:53
|
Revision: 71
http://gearbox.svn.sourceforge.net/gearbox/?rev=71&view=rev
Author: tobasco
Date: 2008-02-18 22:15:55 -0800 (Mon, 18 Feb 2008)
Log Message:
-----------
added dashboard again
Modified Paths:
--------------
gearbox/trunk/doc/header.html
Modified: gearbox/trunk/doc/header.html
===================================================================
--- gearbox/trunk/doc/header.html 2008-02-19 00:32:01 UTC (rev 70)
+++ gearbox/trunk/doc/header.html 2008-02-19 06:15:55 UTC (rev 71)
@@ -58,7 +58,7 @@
<!--
<strong><a href="gbx_doc_faq.html" style="text-decoration:none">FAQ</a></strong><br>
-->
-<!--<strong><a href="http://129.78.210.237:8081/gearbox/Dashboard/" style="text-decoration:none">Dashboard</a></strong><br>-->
+<strong><a href="http://129.78.210.237:8081/gearbox/Dashboard/" style="text-decoration:none">Dashboard</a></strong><br>
<!--<strong><a href="http://wiki2.cas.edu.au/orca">Wiki</a></strong><br>
login/pass: orca/orca<br>-->
<br>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2008-02-19 00:31:58
|
Revision: 70
http://gearbox.svn.sourceforge.net/gearbox/?rev=70&view=rev
Author: borax00
Date: 2008-02-18 16:32:01 -0800 (Mon, 18 Feb 2008)
Log Message:
-----------
docco only.
Modified Paths:
--------------
gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/buffer.h
Modified: gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/buffer.h
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/buffer.h 2008-02-17 00:13:01 UTC (rev 69)
+++ gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/buffer.h 2008-02-19 00:32:01 UTC (rev 70)
@@ -43,13 +43,17 @@
double data;
while (1)
{
+ int ret = 0;
try {
buffer.getAndPop( data );
}
catch ( const gbxutilacfr::Exception & e ) {
- buffer.getAndPopNext( data );
+ ret = buffer.getAndPopNext( data, TIMEOUT_MS );
}
- // do something with data
+ if ( ret == 0 )
+ {
+ // do something with data
+ }
}
@endverbatim
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2008-02-17 00:13:00
|
Revision: 69
http://gearbox.svn.sourceforge.net/gearbox/?rev=69&view=rev
Author: borax00
Date: 2008-02-16 16:13:01 -0800 (Sat, 16 Feb 2008)
Log Message:
-----------
clean up memory.
Modified Paths:
--------------
gearbox/trunk/submitted/gbxsickacfr/test/test.cpp
Modified: gearbox/trunk/submitted/gbxsickacfr/test/test.cpp
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/test/test.cpp 2008-02-16 14:27:34 UTC (rev 68)
+++ gearbox/trunk/submitted/gbxsickacfr/test/test.cpp 2008-02-17 00:13:01 UTC (rev 69)
@@ -107,5 +107,6 @@
cout << "got warnings: " << data.warnings << endl;
}
+ delete device;
return 0;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rus...@us...> - 2008-02-16 14:27:30
|
Revision: 68
http://gearbox.svn.sourceforge.net/gearbox/?rev=68&view=rev
Author: russo2503v
Date: 2008-02-16 06:27:34 -0800 (Sat, 16 Feb 2008)
Log Message:
-----------
added publications page. added to project goals. replaced earlier announcement text with actual one
Modified Paths:
--------------
gearbox/trunk/doc/announce.dox
gearbox/trunk/doc/header.html
gearbox/trunk/doc/overview.dox
Added Paths:
-----------
gearbox/trunk/doc/publications.dox
Modified: gearbox/trunk/doc/announce.dox
===================================================================
--- gearbox/trunk/doc/announce.dox 2008-02-16 08:13:25 UTC (rev 67)
+++ gearbox/trunk/doc/announce.dox 2008-02-16 14:27:34 UTC (rev 68)
@@ -12,45 +12,55 @@
@page gbx_doc_announce Project Announcement
-The world is not sure yet about the best way to design a robot software
-framework, or even if there is a 'best' way (i.e. it probably depends on
-specific requirements). Whatever decisions you make regarding
-frameworks, you should minimise your risk by disassociating your
-algorithms/drivers as much as possible from framework code. In other
-words, you should submit algorithms/drivers to a non-framework project
-which is likely to accumulate high-quality code that is easy to find and
-use. Then you should use/write a thin framework to wrap the
-drivers/algorithms that you (and others) wrote.
+Much of the FOSS efforts in robotics have revolved around building
+software frameworks. Player, Orocos, Carmen, Orca, and others are all
+results of these efforts: all looking for a way (the "best" way?) to
+build a complete robotic system.
-GearBox is a new project that we have recently launched which fits this
-approach. It is a collection of peer-reviewed independent libraries
-aiming to provide functional robot software. There is no framework
-linking the libraries together (although some libraries may depend on
-others). It doesn't aim to replace any frameworks.
+Despite all the efforts, the community has not yet come to a conclusion
+on the best way to design a robot software framework, or even if there
+is a "best" way (i.e. it probably depends on specific requirements).
+Whatever decisions you make regarding frameworks, it would be wise to
+minimise your risk by disassociating your algorithms/drivers as much as
+possible from framework code. In other words, keep your
+algorithms/drivers in a form which does not tie it to a particular
+framework. These ideas are not new and many agree that it makes perfect
+sense. So what's new?
-Libraries can be submitted by anyone and are peer-reviewed before being
-accepted into the collection. They must meet certain criteria, detailed
-on the website. The review process is conducted on a public mailing
-list; anyone is welcome to provide comments on submitted libraries.
-Libraries accepted into GearBox remain the ultimate responsibility of
+GearBox is a brand-new project which puts this approach into practice.
+It is a collection of peer-reviewed independent libraries aiming to
+provide functional robot software. There is no framework linking the
+libraries together (although some libraries may depend on others). It
+doesn't aim to replace any frameworks. Rather, the vision is that the
+current and future robotic frameworks will compete with each other in
+how well they can integrate GearBox libraries into complete and diverse
+robotic systems.
+
+Libraries can be submitted by anyone and are peer-reviewed before being
+accepted into the collection. They must meet certain criteria, detailed
+on the website. The review process is conducted on a public mailing
+list; anyone is welcome to provide comments on submitted libraries.
+Libraries accepted into GearBox remain the ultimate responsibility of
the library developer; we won't try to steal your library from you.
-GearBox is still an infant project. It currently only has one accepted
-library, a Hokuyo URG laser scanner driver based on the urglaser driver
-from Player (the peer review of this library is mostly available in the
-mailing list archives). A SICK laser scanner driver has been submitted
-by the Orca project for peer review and will be going through the review
-process shortly. While we have developed a project constitution of sorts
-and outlined the project goals, including the submissions process, we
-are still and always will welcome any comments on improving these.
+GearBox is still an infant project. It currently only has one accepted
+library, a Hokuyo URG laser scanner driver based on the urglaser driver
+from Player (the review of this library is available in the mailing list
+archives). A SICK laser scanner driver has been submitted by the Orca
+project for peer review and will be going through the review process
+shortly. While we have developed a project principles and outlined the
+project goals, including the submissions process, we are still and
+always will welcome any comments on improving these.
-What GearBox needs now is more libraries. Hardware drivers and software
-algorithms are both equally welcome. The more libraries GearBox gains,
-the greater the benefits to the wider robotics community. So check out
-the project page, and if you have software you think would be beneficial
+What GearBox needs now is more libraries. Hardware drivers and software
+algorithms are both equally welcome. The more libraries GearBox gains,
+the greater the benefits to the wider robotics community. So check out
+the project page, and if you have software you think would be beneficial
to the robotics community, submit it for review.
+
The GearBox Developers
+
08-Feb-2008
*/
Modified: gearbox/trunk/doc/header.html
===================================================================
--- gearbox/trunk/doc/header.html 2008-02-16 08:13:25 UTC (rev 67)
+++ gearbox/trunk/doc/header.html 2008-02-16 14:27:34 UTC (rev 68)
@@ -42,7 +42,7 @@
<strong><a href="gbx_doc_getting.html" style="text-decoration:none">Download and Install</a></strong><br>
<!-- <strong><a href="gbx_doc_quickstart.html" style="text-decoration:none">Quick Start</a></strong><br> -->
<strong><a href="gbx_doc_documentation.html" style="text-decoration:none">Documentation</a></strong><br>
-<!-- <strong><a href="gbx_doc_publications.html" style="text-decoration:none">Publications</a></strong><br> -->
+<strong><a href="gbx_doc_publications.html" style="text-decoration:none">Publications</a></strong><br>
<br>
<strong>REPOSITORY</strong><br>
Modified: gearbox/trunk/doc/overview.dox
===================================================================
--- gearbox/trunk/doc/overview.dox 2008-02-16 08:13:25 UTC (rev 67)
+++ gearbox/trunk/doc/overview.dox 2008-02-16 14:27:34 UTC (rev 68)
@@ -16,6 +16,12 @@
Provide software tools which could be integrated into complete systems with one of many software integration frameworks.
+GearBox is not a framework. It does not contain any "glue" code to help you assemble a complete system.
+
+GearBox does not compete with any existing or future frameworks. Frameworks are still and will continue to be required to customize the available software to a particular application. But the task of designing and implementing a framework is hard enough without having to worry about the nitty-gritty of algorithm and driver implemention.
+
+More on the rationale and the objectives for the project can be found in @ref gbx_doc_publications "GearBox Publications".
+
@par Licence
The GearBox project does not, as a policy, require code to conform to any
Added: gearbox/trunk/doc/publications.dox
===================================================================
--- gearbox/trunk/doc/publications.dox (rev 0)
+++ gearbox/trunk/doc/publications.dox 2008-02-16 14:27:34 UTC (rev 68)
@@ -0,0 +1,20 @@
+/*
+ * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
+ * http://gearbox.sf.net/
+ * Copyright (c) 2008 GearBox Team
+ *
+ * This copy of GearBox is licensed to you under the terms described in the
+ * the LICENSE file included in this distribution.
+ *
+ */
+
+/*!
+
+@page gbx_doc_publications Publications
+
+On project's rationale and objectives:
+
+- A.Makarenko, A.Brooks, T.Kaupp. <a href="http://www.cas.edu.au/content.php/237.html?publicationid=403">On the Benefits of Making Robotic Software Frameworks Thin</a>. IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS 2007). Workshop on Evaluation of Middleware and Architectures.
+
+
+*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2008-02-16 08:13:20
|
Revision: 67
http://gearbox.svn.sourceforge.net/gearbox/?rev=67&view=rev
Author: borax00
Date: 2008-02-16 00:13:25 -0800 (Sat, 16 Feb 2008)
Log Message:
-----------
general clean-up.
Modified Paths:
--------------
gearbox/trunk/submitted/gbxserialacfr/doc.dox
gearbox/trunk/submitted/gbxserialacfr/gbxserialacfr.h
gearbox/trunk/submitted/gbxserialacfr/lockfile/lockfile.cpp
gearbox/trunk/submitted/gbxserialacfr/lockfile/lockfile.h
gearbox/trunk/submitted/gbxserialacfr/lockfile/test/CMakeLists.txt
gearbox/trunk/submitted/gbxserialacfr/lockfile/test/locktest.cpp
gearbox/trunk/submitted/gbxserialacfr/serial.cpp
gearbox/trunk/submitted/gbxserialacfr/serial.h
gearbox/trunk/submitted/gbxserialacfr/test/CMakeLists.txt
gearbox/trunk/submitted/gbxserialacfr/test/serialechotest.cpp
gearbox/trunk/submitted/gbxserialacfr/test/serialloopbacktest.cpp
gearbox/trunk/submitted/gbxserialacfr/uncopyable.h
gearbox/trunk/submitted/gbxsickacfr/CMakeLists.txt
gearbox/trunk/submitted/gbxsickacfr/doc.dox
gearbox/trunk/submitted/gbxsickacfr/driver.cpp
gearbox/trunk/submitted/gbxsickacfr/driver.h
gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/buffer.h
gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/gbxiceutilacfr.h
gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/subsystemthread.cpp
gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/subsystemthread.h
gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/thread.cpp
gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/thread.h
gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/timer.cpp
gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/timer.h
gearbox/trunk/submitted/gbxsickacfr/gbxserialdeviceacfr/gbxserialdeviceacfr.h
gearbox/trunk/submitted/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.cpp
gearbox/trunk/submitted/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.h
gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/exceptions.cpp
gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/exceptions.h
gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/gbxutilacfr.h
gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/mathdefs.h
gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/status.h
gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/substatus.h
gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/tracer.h
gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/trivialstatus.cpp
gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/trivialstatus.h
gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/trivialtracer.cpp
gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/trivialtracer.h
gearbox/trunk/submitted/gbxsickacfr/messages.cpp
gearbox/trunk/submitted/gbxsickacfr/messages.h
gearbox/trunk/submitted/gbxsickacfr/serialhandler.cpp
gearbox/trunk/submitted/gbxsickacfr/serialhandler.h
gearbox/trunk/submitted/gbxsickacfr/test/test.cpp
Modified: gearbox/trunk/submitted/gbxserialacfr/doc.dox
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/doc.dox 2008-02-16 06:56:16 UTC (rev 66)
+++ gearbox/trunk/submitted/gbxserialacfr/doc.dox 2008-02-16 08:13:25 UTC (rev 67)
@@ -1,12 +1,13 @@
/*
- * Orca-Robotics Project: Components for robotics
- * http://orca-robotics.sf.net/
- * Copyright (c) 2004-2008 Mathew Ridley, Alex Brooks
+ * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
+ * http://gearbox.sf.net/
+ * Copyright (c) 2004-2008 Alex Brooks, Mathew Ridley
*
* This distribution is licensed to you under the terms described in
* the LICENSE file included in this distribution.
*
*/
+
/*!
@ingroup gbx_libs
@ingroup gbx_cpp
@@ -18,22 +19,27 @@
C++ class wrapping a serial port. For a full list of functions and classes see @ref gbxserialacfr.
-Header file:
+@par Header file
+
@verbatim
#include <gbxserialacfr/serial.h>
@endverbatim
-Other serial libraries:
-- http://libserial.sourceforge.net (GPL)
-- http://qextserialport.sourceforge.net (requires Qt)
+@par Other serial libraries
+ - http://libserial.sourceforge.net (GPL)
+ - http://qextserialport.sourceforge.net (requires Qt)
+
@par Tested On
- rs232 only (ie not rs422)
- For USB-to-serial devices, tested on FTDI-based devices only
+@par Copyright
+ Alex Brooks, Mathew Ridley
+
@par Responsible Developer
-Alex Brooks
+ Alex Brooks
*/
Modified: gearbox/trunk/submitted/gbxserialacfr/gbxserialacfr.h
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/gbxserialacfr.h 2008-02-16 06:56:16 UTC (rev 66)
+++ gearbox/trunk/submitted/gbxserialacfr/gbxserialacfr.h 2008-02-16 08:13:25 UTC (rev 67)
@@ -1,7 +1,7 @@
/*
- * Orca-Robotics Project: Components for robotics
- * http://orca-robotics.sf.net/
- * Copyright (c) 2004-2008 Mathew Ridley, Alex Brooks
+ * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
+ * http://gearbox.sf.net/
+ * Copyright (c) 2004-2008 Alex Brooks, Mathew Ridley
*
* This distribution is licensed to you under the terms described in
* the LICENSE file included in this distribution.
Modified: gearbox/trunk/submitted/gbxserialacfr/lockfile/lockfile.cpp
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/lockfile/lockfile.cpp 2008-02-16 06:56:16 UTC (rev 66)
+++ gearbox/trunk/submitted/gbxserialacfr/lockfile/lockfile.cpp 2008-02-16 08:13:25 UTC (rev 67)
@@ -1,6 +1,6 @@
/*
- * Orca-Robotics Project: Components for robotics
- * http://orca-robotics.sf.net/
+ * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
+ * http://gearbox.sf.net/
* Copyright (c) 2004-2008 Alex Brooks
*
* This distribution is licensed to you under the terms described in
Modified: gearbox/trunk/submitted/gbxserialacfr/lockfile/lockfile.h
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/lockfile/lockfile.h 2008-02-16 06:56:16 UTC (rev 66)
+++ gearbox/trunk/submitted/gbxserialacfr/lockfile/lockfile.h 2008-02-16 08:13:25 UTC (rev 67)
@@ -1,6 +1,6 @@
/*
- * Orca-Robotics Project: Components for robotics
- * http://orca-robotics.sf.net/
+ * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
+ * http://gearbox.sf.net/
* Copyright (c) 2004-2008 Alex Brooks
*
* This distribution is licensed to you under the terms described in
Modified: gearbox/trunk/submitted/gbxserialacfr/lockfile/test/CMakeLists.txt
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/lockfile/test/CMakeLists.txt 2008-02-16 06:56:16 UTC (rev 66)
+++ gearbox/trunk/submitted/gbxserialacfr/lockfile/test/CMakeLists.txt 2008-02-16 08:13:25 UTC (rev 67)
@@ -2,3 +2,4 @@
ADD_EXECUTABLE( locktest locktest.cpp )
TARGET_LINK_LIBRARIES( locktest GbxLockFileAcfr )
+GBX_ADD_TEST( GbxLockFileAcfr locktest )
\ No newline at end of file
Modified: gearbox/trunk/submitted/gbxserialacfr/lockfile/test/locktest.cpp
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/lockfile/test/locktest.cpp 2008-02-16 06:56:16 UTC (rev 66)
+++ gearbox/trunk/submitted/gbxserialacfr/lockfile/test/locktest.cpp 2008-02-16 08:13:25 UTC (rev 67)
@@ -1,3 +1,13 @@
+/*
+ * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
+ * http://gearbox.sf.net/
+ * Copyright (c) 2004-2008 Alex Brooks
+ *
+ * This distribution is licensed to you under the terms described in
+ * the LICENSE file included in this distribution.
+ *
+ */
+
#include <iostream>
#include <cstdlib>
#include <gbxserialacfr/lockfile/lockfile.h>
Modified: gearbox/trunk/submitted/gbxserialacfr/serial.cpp
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/serial.cpp 2008-02-16 06:56:16 UTC (rev 66)
+++ gearbox/trunk/submitted/gbxserialacfr/serial.cpp 2008-02-16 08:13:25 UTC (rev 67)
@@ -1,7 +1,7 @@
/*
- * Orca-Robotics Project: Components for robotics
- * http://orca-robotics.sf.net/
- * Copyright (c) 2004-2008 Mathew Ridley, Alex Brooks
+ * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
+ * http://gearbox.sf.net/
+ * Copyright (c) 2004-2008 Alex Brooks, Mathew Ridley
*
* This distribution is licensed to you under the terms described in
* the LICENSE file included in this distribution.
Modified: gearbox/trunk/submitted/gbxserialacfr/serial.h
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/serial.h 2008-02-16 06:56:16 UTC (rev 66)
+++ gearbox/trunk/submitted/gbxserialacfr/serial.h 2008-02-16 08:13:25 UTC (rev 67)
@@ -1,7 +1,7 @@
/*
- * Orca-Robotics Project: Components for robotics
- * http://orca-robotics.sf.net/
- * Copyright (c) 2004-2008 Mathew Ridley, Alex Brooks
+ * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
+ * http://gearbox.sf.net/
+ * Copyright (c) 2004-2008 Alex Brooks, Mathew Ridley
*
* This distribution is licensed to you under the terms described in
* the LICENSE file included in this distribution.
Modified: gearbox/trunk/submitted/gbxserialacfr/test/CMakeLists.txt
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/test/CMakeLists.txt 2008-02-16 06:56:16 UTC (rev 66)
+++ gearbox/trunk/submitted/gbxserialacfr/test/CMakeLists.txt 2008-02-16 08:13:25 UTC (rev 67)
@@ -3,5 +3,4 @@
LINK_LIBRARIES( GbxSerialAcfr )
GBX_ADD_EXECUTABLE( serialechotest serialechotest.cpp )
-
GBX_ADD_EXECUTABLE( serialloopbacktest serialloopbacktest.cpp )
Modified: gearbox/trunk/submitted/gbxserialacfr/test/serialechotest.cpp
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/test/serialechotest.cpp 2008-02-16 06:56:16 UTC (rev 66)
+++ gearbox/trunk/submitted/gbxserialacfr/test/serialechotest.cpp 2008-02-16 08:13:25 UTC (rev 67)
@@ -10,6 +10,7 @@
//
// A simple utility program for testing serial ports.
+// Listens for incoming data, echoes it to the terminal.
//
std::string
Modified: gearbox/trunk/submitted/gbxserialacfr/test/serialloopbacktest.cpp
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/test/serialloopbacktest.cpp 2008-02-16 06:56:16 UTC (rev 66)
+++ gearbox/trunk/submitted/gbxserialacfr/test/serialloopbacktest.cpp 2008-02-16 08:13:25 UTC (rev 67)
@@ -11,6 +11,8 @@
//
// A simple utility program for testing serial ports in loopback.
+// Put the port in loopback (ie connect pins 2 & 3), then type stuff.
+// It should be echoed back on the terminal.
//
std::vector<std::string>
Modified: gearbox/trunk/submitted/gbxserialacfr/uncopyable.h
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/uncopyable.h 2008-02-16 06:56:16 UTC (rev 66)
+++ gearbox/trunk/submitted/gbxserialacfr/uncopyable.h 2008-02-16 08:13:25 UTC (rev 67)
@@ -1,7 +1,7 @@
/*
- * Orca-Robotics Project: Components for robotics
- * http://orca-robotics.sf.net/
- * Copyright (c) 2004-2008 Alex Brooks, Alexei Makarenko, Tobias Kaupp
+ * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
+ * http://gearbox.sf.net/
+ * Copyright (c) 2004-2008 Alex Brooks
*
* This distribution is licensed to you under the terms described in
* the LICENSE file included in this distribution.
Modified: gearbox/trunk/submitted/gbxsickacfr/CMakeLists.txt
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/CMakeLists.txt 2008-02-16 06:56:16 UTC (rev 66)
+++ gearbox/trunk/submitted/gbxsickacfr/CMakeLists.txt 2008-02-16 08:13:25 UTC (rev 67)
@@ -15,15 +15,13 @@
SET( int_libs GbxUtilAcfr GbxIceUtilAcfr GbxSerialDeviceAcfr )
IF ( build )
- # allow subdir's to include themselves and each other
-# INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR} )
ADD_SUBDIRECTORY( gbxutilacfr )
ADD_SUBDIRECTORY( gbxiceutilacfr )
ADD_SUBDIRECTORY( gbxserialdeviceacfr )
INCLUDE( ${GBX_CMAKE_DIR}/UseBasicRules.cmake )
-# INCLUDE( ${GBX_CMAKE_DIR}/UseIceUtil.cmake )
+ INCLUDE( ${GBX_CMAKE_DIR}/UseIceUtil.cmake )
FILE( GLOB hdrs *.h )
FILE( GLOB srcs *.cpp )
Modified: gearbox/trunk/submitted/gbxsickacfr/doc.dox
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/doc.dox 2008-02-16 06:56:16 UTC (rev 66)
+++ gearbox/trunk/submitted/gbxsickacfr/doc.dox 2008-02-16 08:13:25 UTC (rev 67)
@@ -1,6 +1,6 @@
/*
- * Orca-Robotics Project: Components for robotics
- * http://orca-robotics.sf.net/
+ * 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
@@ -9,31 +9,48 @@
*/
/*!
-@ingroup hydro_drivers_laserscanner2d
-@ingroup hydro_cpp
-@ingroup hydro_linux
-@defgroup hydro_driver_laserscanner2dsickacfr LaserScanner2dSickAcfr
+@ingroup gbx_drivers_laserscanner2d
+@ingroup gbx_cpp
+@ingroup gbx_linux
+@defgroup gbx_driver_laserscanner2dsickacfr LaserScanner2dSickAcfr
@brief ACFR driver for SICK laser range-finder.
Drives SICK hardware, directly connected to the computer.
+@par Header file
+
+@verbatim
+#include <gbxsickacfr/driver.h>
+@endverbatim
+
+@par Example
+ See test/test.cpp
+
+@par Copyright
+ Alex Brooks, Alexei Makarenko, Tobias Kaupp
+
+@par Responsible Developer
+ Alex Brooks
+
@par Dependencies
- libIceUtil (for timing/threads/mutexes)
-- libHydroSerial and libHydroSerialDevice
+- libGbxSerialAcfr
@par Limitations
-
+
- This is a Linux-only implementation.
- It has not been tested at 500k baud.
+- It has only been tested on the LMS-291
-@par Extra configuration
+*/
-- @c SickAcfr.Device (string)
- - The unix device to use
- - Default: "/dev/ttyS0"
-- @c SickAcfr.Baudrate (int) [bps]
- - Valid Values: { 9600, 19200, 38400, 500000 }
- - Default: 38400
+/*!
+@brief SICK laser driver
+@namespace gbxsickacfr
-*/
+This namespace is part of a SICK laser driver
+
+@see @ref gbx_library_gbxsickacfr
+
+*/
\ No newline at end of file
Modified: gearbox/trunk/submitted/gbxsickacfr/driver.cpp
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/driver.cpp 2008-02-16 06:56:16 UTC (rev 66)
+++ gearbox/trunk/submitted/gbxsickacfr/driver.cpp 2008-02-16 08:13:25 UTC (rev 67)
@@ -1,6 +1,6 @@
/*
- * Orca-Robotics Project: Components for robotics
- * http://orca-robotics.sf.net/
+ * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
+ * http://gearbox.sf.net/
* Copyright (c) 2004-2008 Alex Brooks
*
* This distribution is licensed to you under the terms described in
Modified: gearbox/trunk/submitted/gbxsickacfr/driver.h
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/driver.h 2008-02-16 06:56:16 UTC (rev 66)
+++ gearbox/trunk/submitted/gbxsickacfr/driver.h 2008-02-16 08:13:25 UTC (rev 67)
@@ -1,6 +1,6 @@
/*
- * Orca-Robotics Project: Components for robotics
- * http://orca-robotics.sf.net/
+ * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
+ * http://gearbox.sf.net/
* Copyright (c) 2004-2008 Alex Brooks
*
* This distribution is licensed to you under the terms described in
Modified: gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/buffer.h
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/buffer.h 2008-02-16 06:56:16 UTC (rev 66)
+++ gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/buffer.h 2008-02-16 08:13:25 UTC (rev 67)
@@ -1,6 +1,6 @@
/*
- * Orca-Robotics Project: Components for robotics
- * http://orca-robotics.sf.net/
+ * 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
Modified: gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/gbxiceutilacfr.h
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/gbxiceutilacfr.h 2008-02-16 06:56:16 UTC (rev 66)
+++ gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/gbxiceutilacfr.h 2008-02-16 08:13:25 UTC (rev 67)
@@ -1,6 +1,6 @@
/*
- * Orca-Robotics Project: Components for robotics
- * http://orca-robotics.sf.net/
+ * 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
Modified: gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/subsystemthread.cpp
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/subsystemthread.cpp 2008-02-16 06:56:16 UTC (rev 66)
+++ gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/subsystemthread.cpp 2008-02-16 08:13:25 UTC (rev 67)
@@ -1,6 +1,6 @@
/*
- * Orca-Robotics Project: Components for robotics
- * http://orca-robotics.sf.net/
+ * 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
Modified: gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/subsystemthread.h
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/subsystemthread.h 2008-02-16 06:56:16 UTC (rev 66)
+++ gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/subsystemthread.h 2008-02-16 08:13:25 UTC (rev 67)
@@ -1,10 +1,10 @@
/*
-Orca Project: Components for robotics
- http://orca-robotics.sf.net/
-Copyright (c) 2004-2007 Alex Brooks, Alexei Makarenko, Tobias Kaupp
+ * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
+ * http://gearbox.sf.net/
+ * Copyright (c) 2004-2008 Alex Brooks, Alexei Makarenko, Tobias Kaupp
*
-This copy of Orca is licensed to you under the terms described in the
-ORCA_LICENSE file included in this distribution.
+ * This distribution is licensed to you under the terms described in
+ * the LICENSE file included in this distribution.
*
*/
Modified: gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/thread.cpp
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/thread.cpp 2008-02-16 06:56:16 UTC (rev 66)
+++ gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/thread.cpp 2008-02-16 08:13:25 UTC (rev 67)
@@ -1,6 +1,6 @@
/*
- * Orca-Robotics Project: Components for robotics
- * http://orca-robotics.sf.net/
+ * 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
Modified: gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/thread.h
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/thread.h 2008-02-16 06:56:16 UTC (rev 66)
+++ gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/thread.h 2008-02-16 08:13:25 UTC (rev 67)
@@ -1,10 +1,10 @@
/*
-Orca Project: Components for robotics
- http://orca-robotics.sf.net/
-Copyright (c) 2004-2007 Alex Brooks, Alexei Makarenko, Tobias Kaupp
+ * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
+ * http://gearbox.sf.net/
+ * Copyright (c) 2004-2008 Alex Brooks, Alexei Makarenko, Tobias Kaupp
*
-This copy of Orca is licensed to you under the terms described in the
-ORCA_LICENSE file included in this distribution.
+ * This distribution is licensed to you under the terms described in
+ * the LICENSE file included in this distribution.
*
*/
Modified: gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/timer.cpp
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/timer.cpp 2008-02-16 06:56:16 UTC (rev 66)
+++ gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/timer.cpp 2008-02-16 08:13:25 UTC (rev 67)
@@ -1,6 +1,6 @@
/*
- * Orca-Robotics Project: Components for robotics
- * http://orca-robotics.sf.net/
+ * 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
Modified: gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/timer.h
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/timer.h 2008-02-16 06:56:16 UTC (rev 66)
+++ gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/timer.h 2008-02-16 08:13:25 UTC (rev 67)
@@ -1,6 +1,6 @@
/*
- * Orca-Robotics Project: Components for robotics
- * http://orca-robotics.sf.net/
+ * 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
Modified: gearbox/trunk/submitted/gbxsickacfr/gbxserialdeviceacfr/gbxserialdeviceacfr.h
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/gbxserialdeviceacfr/gbxserialdeviceacfr.h 2008-02-16 06:56:16 UTC (rev 66)
+++ gearbox/trunk/submitted/gbxsickacfr/gbxserialdeviceacfr/gbxserialdeviceacfr.h 2008-02-16 08:13:25 UTC (rev 67)
@@ -1,6 +1,6 @@
/*
- * Orca-Robotics Project: Components for robotics
- * http://orca-robotics.sf.net/
+ * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
+ * http://gearbox.sf.net/
* Copyright (c) 2004-2008 Alex Brooks
*
* This distribution is licensed to you under the terms described in
Modified: gearbox/trunk/submitted/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.cpp
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.cpp 2008-02-16 06:56:16 UTC (rev 66)
+++ gearbox/trunk/submitted/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.cpp 2008-02-16 08:13:25 UTC (rev 67)
@@ -1,6 +1,6 @@
/*
- * Orca-Robotics Project: Components for robotics
- * http://orca-robotics.sf.net/
+ * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
+ * http://gearbox.sf.net/
* Copyright (c) 2004-2008 Alex Brooks
*
* This distribution is licensed to you under the terms described in
Modified: gearbox/trunk/submitted/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.h
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.h 2008-02-16 06:56:16 UTC (rev 66)
+++ gearbox/trunk/submitted/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.h 2008-02-16 08:13:25 UTC (rev 67)
@@ -1,6 +1,6 @@
/*
- * Orca-Robotics Project: Components for robotics
- * http://orca-robotics.sf.net/
+ * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
+ * http://gearbox.sf.net/
* Copyright (c) 2004-2008 Alex Brooks
*
* This distribution is licensed to you under the terms described in
Modified: gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/exceptions.cpp
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/exceptions.cpp 2008-02-16 06:56:16 UTC (rev 66)
+++ gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/exceptions.cpp 2008-02-16 08:13:25 UTC (rev 67)
@@ -1,6 +1,6 @@
/*
- * Orca-Robotics Project: Components for robotics
- * http://orca-robotics.sf.net/
+ * 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
Modified: gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/exceptions.h
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/exceptions.h 2008-02-16 06:56:16 UTC (rev 66)
+++ gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/exceptions.h 2008-02-16 08:13:25 UTC (rev 67)
@@ -1,6 +1,6 @@
/*
- * Orca-Robotics Project: Components for robotics
- * http://orca-robotics.sf.net/
+ * 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
@@ -22,7 +22,7 @@
#define ERROR_MACROS_HPP_
#if defined(STRINGIZE_HELPER) || defined(STRINGIZE) || defined(ERROR_INFO)
-# error HydroUtil error macros have already been defined elsewhere
+# error GbxUtilAcfr error macros have already been defined elsewhere
#endif
#define STRINGIZE_HELPER(exp) #exp
@@ -39,7 +39,7 @@
namespace gbxutilacfr {
/*!
-@brief Base class for all Hydro exceptions.
+@brief Base class for all GbxUtilAcfr exceptions.
Can be caught as a std::exception due to inheritance.
Modified: gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/gbxutilacfr.h
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/gbxutilacfr.h 2008-02-16 06:56:16 UTC (rev 66)
+++ gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/gbxutilacfr.h 2008-02-16 08:13:25 UTC (rev 67)
@@ -1,6 +1,6 @@
/*
- * Orca-Robotics Project: Components for robotics
- * http://orca-robotics.sf.net/
+ * 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
Modified: gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/mathdefs.h
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/mathdefs.h 2008-02-16 06:56:16 UTC (rev 66)
+++ gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/mathdefs.h 2008-02-16 08:13:25 UTC (rev 67)
@@ -1,6 +1,6 @@
/*
- * Orca-Robotics Project: Components for robotics
- * http://orca-robotics.sf.net/
+ * 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
Modified: gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/status.h
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/status.h 2008-02-16 06:56:16 UTC (rev 66)
+++ gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/status.h 2008-02-16 08:13:25 UTC (rev 67)
@@ -1,6 +1,6 @@
/*
- * Orca-Robotics Project: Components for robotics
- * http://orca-robotics.sf.net/
+ * 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
Modified: gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/substatus.h
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/substatus.h 2008-02-16 06:56:16 UTC (rev 66)
+++ gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/substatus.h 2008-02-16 08:13:25 UTC (rev 67)
@@ -1,6 +1,6 @@
/*
- * Orca-Robotics Project: Components for robotics
- * http://orca-robotics.sf.net/
+ * 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
Modified: gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/tracer.h
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/tracer.h 2008-02-16 06:56:16 UTC (rev 66)
+++ gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/tracer.h 2008-02-16 08:13:25 UTC (rev 67)
@@ -1,6 +1,6 @@
/*
- * Orca-Robotics Project: Components for robotics
- http://orca-robotics.sf.net/
+ * 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
Modified: gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/trivialstatus.cpp
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/trivialstatus.cpp 2008-02-16 06:56:16 UTC (rev 66)
+++ gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/trivialstatus.cpp 2008-02-16 08:13:25 UTC (rev 67)
@@ -1,6 +1,6 @@
/*
- * Orca-Robotics Project: Components for robotics
- * http://orca-robotics.sf.net/
+ * 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
Modified: gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/trivialstatus.h
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/trivialstatus.h 2008-02-16 06:56:16 UTC (rev 66)
+++ gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/trivialstatus.h 2008-02-16 08:13:25 UTC (rev 67)
@@ -1,6 +1,6 @@
/*
- * Orca-Robotics Project: Components for robotics
- * http://orca-robotics.sf.net/
+ * 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
Modified: gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/trivialtracer.cpp
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/trivialtracer.cpp 2008-02-16 06:56:16 UTC (rev 66)
+++ gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/trivialtracer.cpp 2008-02-16 08:13:25 UTC (rev 67)
@@ -1,6 +1,6 @@
/*
- * Orca-Robotics Project: Components for robotics
- * http://orca-robotics.sf.net/
+ * 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
Modified: gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/trivialtracer.h
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/trivialtracer.h 2008-02-16 06:56:16 UTC (rev 66)
+++ gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/trivialtracer.h 2008-02-16 08:13:25 UTC (rev 67)
@@ -1,6 +1,6 @@
/*
- * Orca-Robotics Project: Components for robotics
- http://orca-robotics.sf.net/
+ * 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
Modified: gearbox/trunk/submitted/gbxsickacfr/messages.cpp
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/messages.cpp 2008-02-16 06:56:16 UTC (rev 66)
+++ gearbox/trunk/submitted/gbxsickacfr/messages.cpp 2008-02-16 08:13:25 UTC (rev 67)
@@ -1,12 +1,13 @@
/*
- * Orca-Robotics Project: Components for robotics
- * http://orca-robotics.sf.net/
+ * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
+ * http://gearbox.sf.net/
* Copyright (c) 2004-2008 Alex Brooks
*
* This distribution is licensed to you under the terms described in
* the LICENSE file included in this distribution.
*
*/
+
#include "messages.h"
#include <cstring>
#include <iostream>
Modified: gearbox/trunk/submitted/gbxsickacfr/messages.h
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/messages.h 2008-02-16 06:56:16 UTC (rev 66)
+++ gearbox/trunk/submitted/gbxsickacfr/messages.h 2008-02-16 08:13:25 UTC (rev 67)
@@ -1,12 +1,13 @@
/*
- * Orca-Robotics Project: Components for robotics
- * http://orca-robotics.sf.net/
+ * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
+ * http://gearbox.sf.net/
* Copyright (c) 2004-2008 Alex Brooks
*
* This distribution is licensed to you under the terms described in
* the LICENSE file included in this distribution.
*
*/
+
#ifndef SICK_ACFR_DRIVER_MESSAGES_H
#define SICK_ACFR_DRIVER_MESSAGES_H
Modified: gearbox/trunk/submitted/gbxsickacfr/serialhandler.cpp
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/serialhandler.cpp 2008-02-16 06:56:16 UTC (rev 66)
+++ gearbox/trunk/submitted/gbxsickacfr/serialhandler.cpp 2008-02-16 08:13:25 UTC (rev 67)
@@ -1,12 +1,13 @@
/*
- * Orca-Robotics Project: Components for robotics
- * http://orca-robotics.sf.net/
+ * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
+ * http://gearbox.sf.net/
* Copyright (c) 2004-2008 Alex Brooks
*
* This distribution is licensed to you under the terms described in
* the LICENSE file included in this distribution.
*
*/
+
#include "serialhandler.h"
#include <iostream>
Modified: gearbox/trunk/submitted/gbxsickacfr/serialhandler.h
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/serialhandler.h 2008-02-16 06:56:16 UTC (rev 66)
+++ gearbox/trunk/submitted/gbxsickacfr/serialhandler.h 2008-02-16 08:13:25 UTC (rev 67)
@@ -1,12 +1,13 @@
/*
- * Orca-Robotics Project: Components for robotics
- * http://orca-robotics.sf.net/
+ * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
+ * http://gearbox.sf.net/
* Copyright (c) 2004-2008 Alex Brooks
*
* This distribution is licensed to you under the terms described in
* the LICENSE file included in this distribution.
*
*/
+
#ifndef SICK_ACFR_SERIALHANDLER_H
#define SICK_ACFR_SERIALHANDLER_H
Modified: gearbox/trunk/submitted/gbxsickacfr/test/test.cpp
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/test/test.cpp 2008-02-16 06:56:16 UTC (rev 66)
+++ gearbox/trunk/submitted/gbxsickacfr/test/test.cpp 2008-02-16 08:13:25 UTC (rev 67)
@@ -1,3 +1,13 @@
+/*
+ * 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 <math.h>
#include <stdio.h>
#include <stdlib.h>
@@ -13,14 +23,14 @@
using namespace std;
-
+//
+// Instantiates the laser driver, reads a few scans
+//
int main( int argc, char **argv )
{
int opt;
-// int baud = 115200;
-// bool useSerial = false;
+ int baud = 38400;
string port = "/dev/ttyS0";
- int maxCount = 1;
// Get some options from the command line
while ((opt = getopt (argc, argv, "p:c:")) != -1)
@@ -28,53 +38,38 @@
switch (opt)
{
case 'p':
-// strncpy (port, optarg, 256);
port = optarg;
break;
- case 'c':
- maxCount = atoi( optarg );
+ case 'b':
+ baud = atoi (optarg);
break;
-// case 'b':
-// baud = atoi (optarg);
-// if (baud != 19200 && baud != 57600 && baud != 115200)
-// {
-// printf ("Baud rate must be one of 19200, 57600 or 115200.\n");
-// return 1;
-// }
-// break;
-// case 's':
-// useSerial = true;
-// break;
default:
- printf ("Usage: %s [-p port] [-b baud] [-s]\n\n"
- "-p port\tPort the laser scanner is connected to. E.g. /dev/ttyS0\n"
- "-b baud\tBaud rate to connect at (19200, 57600 or 115200).\t"
- "-s\tUse RS232 connection instead of USB.\n", argv[0]);
+ cout << "Usage: " << argv[0] << " [-p port] [-b baud]" << endl << endl
+ << "-p port\tPort the laser scanner is connected to. E.g. /dev/ttyS0" << endl
+ << "-b baud\tBaud rate to connect at (19200, 57600 or 115200)." << endl;
return 1;
}
}
-
+ // Set up the laser's configuration
gbxsickacfr::Config config;
-
config.minRange = 0.0;
config.maxRange = 80.0;
config.fieldOfView = 180.0*DEG2RAD_RATIO;
config.startAngle = -90.0*DEG2RAD_RATIO;
config.numberOfSamples = 181;
- config.baudRate = 38400;
+ config.baudRate = baud;
config.device = port;
+ if ( !config.validate() ) {
+ cout << "Test: Invalid laser configuration: " << config.toString() << endl;
+ }
+ cout << "Using configuration: " << config.toString() << endl;
+ // Instantiate objects to handle messages from the driver
gbxsickacfr::gbxutilacfr::TrivialTracer tracer;
gbxsickacfr::gbxutilacfr::TrivialStatus status( tracer );
- if ( !config.validate() ) {
- tracer.error( "Test: Failed to validate laser configuration. "+config.toString() );
- }
-
- tracer.info( "Validated configuration structure: "+config.toString() );
-
- // initialize
+ // Instantiate the driver itself
gbxsickacfr::Driver* device;
try
{
@@ -82,47 +77,34 @@
}
catch ( const std::exception& e )
{
- stringstream ss; ss<<"Test: Failed to init device: "<<e.what();
- tracer.error( ss.str() );
+ cout <<"Test: Failed to init device: "<<e.what() << endl;
return 1;
}
- // allocated data storage
- vector<float> ranges;
- vector<unsigned char> intensities;
- ranges.resize( config.numberOfSamples );
- intensities.resize( config.numberOfSamples );
-
- // create data structure
+ // Create data structure to store sensor data
+ vector<float> ranges( config.numberOfSamples );
+ vector<unsigned char> intensities( config.numberOfSamples );
gbxsickacfr::Data data;
data.ranges = &(ranges[0]);
data.intensities = &(intensities[0]);
- int count = 0;
- while ( count < maxCount )
+ // Read a few times
+ const int numReads = 3;
+ for ( int i=0; i < numReads; i++ )
{
- // catch exceptions!!!
try
{
- // using default timeout of 1000ms
device->read( data );
}
catch ( const std::exception& e )
{
- stringstream ss; ss<<"Test: Failed to read scan: "<<e.what();
- tracer.error( ss.str() );
+ cout <<"Test: Failed to read scan: "<<e.what()<<endl;
}
- // data.timeStampSec;
- // data.timeStampUsec;
-
- stringstream ss; ss<<"Test: Got scan "<<count+1<<" of "<<maxCount;
- tracer.info( ss.str() );
+ cout<<"Test: Got scan "<<i+1<<" of "<<numReads<<endl;
if ( data.haveWarnings )
- tracer.warning( "got warnings: "+data.warnings );
-
- count++;
+ cout << "got warnings: " << data.warnings << endl;
}
return 0;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2008-02-16 06:56:12
|
Revision: 66
http://gearbox.svn.sourceforge.net/gearbox/?rev=66&view=rev
Author: borax00
Date: 2008-02-15 22:56:16 -0800 (Fri, 15 Feb 2008)
Log Message:
-----------
docco only.
Modified Paths:
--------------
gearbox/trunk/submitted/gbxsickacfr/doc.dox
Modified: gearbox/trunk/submitted/gbxsickacfr/doc.dox
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/doc.dox 2008-02-16 06:50:53 UTC (rev 65)
+++ gearbox/trunk/submitted/gbxsickacfr/doc.dox 2008-02-16 06:56:16 UTC (rev 66)
@@ -19,7 +19,7 @@
@par Dependencies
-- libIceUtil (for timing)
+- libIceUtil (for timing/threads/mutexes)
- libHydroSerial and libHydroSerialDevice
@par Limitations
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2008-02-16 06:50:49
|
Revision: 65
http://gearbox.svn.sourceforge.net/gearbox/?rev=65&view=rev
Author: borax00
Date: 2008-02-15 22:50:53 -0800 (Fri, 15 Feb 2008)
Log Message:
-----------
docco only
Modified Paths:
--------------
gearbox/trunk/submitted/gbxserialacfr/doc.dox
Modified: gearbox/trunk/submitted/gbxserialacfr/doc.dox
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/doc.dox 2008-02-16 06:25:42 UTC (rev 64)
+++ gearbox/trunk/submitted/gbxserialacfr/doc.dox 2008-02-16 06:50:53 UTC (rev 65)
@@ -27,6 +27,11 @@
- http://libserial.sourceforge.net (GPL)
- http://qextserialport.sourceforge.net (requires Qt)
+@par Tested On
+
+ - rs232 only (ie not rs422)
+ - For USB-to-serial devices, tested on FTDI-based devices only
+
@par Responsible Developer
Alex Brooks
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rus...@us...> - 2008-02-16 06:25:38
|
Revision: 64
http://gearbox.svn.sourceforge.net/gearbox/?rev=64&view=rev
Author: russo2503v
Date: 2008-02-15 22:25:42 -0800 (Fri, 15 Feb 2008)
Log Message:
-----------
oops
Removed Paths:
-------------
gearbox/trunk/submitted/gbxserialacfr/test/serialloopbacktest
Deleted: gearbox/trunk/submitted/gbxserialacfr/test/serialloopbacktest
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rus...@us...> - 2008-02-16 06:25:12
|
Revision: 63
http://gearbox.svn.sourceforge.net/gearbox/?rev=63&view=rev
Author: russo2503v
Date: 2008-02-15 22:25:16 -0800 (Fri, 15 Feb 2008)
Log Message:
-----------
serial and sick submit
Modified Paths:
--------------
gearbox/trunk/submitted/CMakeLists.txt
Added Paths:
-----------
gearbox/trunk/submitted/gbxserialacfr/
gearbox/trunk/submitted/gbxserialacfr/CMakeLists.txt
gearbox/trunk/submitted/gbxserialacfr/doc.dox
gearbox/trunk/submitted/gbxserialacfr/gbxserialacfr.h
gearbox/trunk/submitted/gbxserialacfr/lockfile/
gearbox/trunk/submitted/gbxserialacfr/lockfile/CMakeLists.txt
gearbox/trunk/submitted/gbxserialacfr/lockfile/lockfile.cpp
gearbox/trunk/submitted/gbxserialacfr/lockfile/lockfile.h
gearbox/trunk/submitted/gbxserialacfr/lockfile/test/
gearbox/trunk/submitted/gbxserialacfr/lockfile/test/CMakeLists.txt
gearbox/trunk/submitted/gbxserialacfr/lockfile/test/locktest.cpp
gearbox/trunk/submitted/gbxserialacfr/serial.cpp
gearbox/trunk/submitted/gbxserialacfr/serial.h
gearbox/trunk/submitted/gbxserialacfr/test/
gearbox/trunk/submitted/gbxserialacfr/test/CMakeLists.txt
gearbox/trunk/submitted/gbxserialacfr/test/serialechotest.cpp
gearbox/trunk/submitted/gbxserialacfr/test/serialloopbacktest
gearbox/trunk/submitted/gbxserialacfr/test/serialloopbacktest.cpp
gearbox/trunk/submitted/gbxserialacfr/uncopyable.h
gearbox/trunk/submitted/gbxsickacfr/
gearbox/trunk/submitted/gbxsickacfr/CMakeLists.txt
gearbox/trunk/submitted/gbxsickacfr/doc.dox
gearbox/trunk/submitted/gbxsickacfr/driver.cpp
gearbox/trunk/submitted/gbxsickacfr/driver.h
gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/
gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/CMakeLists.txt
gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/buffer.h
gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/gbxiceutilacfr.h
gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/subsystemthread.cpp
gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/subsystemthread.h
gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/thread.cpp
gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/thread.h
gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/timer.cpp
gearbox/trunk/submitted/gbxsickacfr/gbxiceutilacfr/timer.h
gearbox/trunk/submitted/gbxsickacfr/gbxserialdeviceacfr/
gearbox/trunk/submitted/gbxsickacfr/gbxserialdeviceacfr/CMakeLists.txt
gearbox/trunk/submitted/gbxsickacfr/gbxserialdeviceacfr/gbxserialdeviceacfr.h
gearbox/trunk/submitted/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.cpp
gearbox/trunk/submitted/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.h
gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/
gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/CMakeLists.txt
gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/exceptions.cpp
gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/exceptions.h
gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/gbxutilacfr.h
gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/mathdefs.h
gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/status.h
gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/substatus.h
gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/tracer.h
gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/trivialstatus.cpp
gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/trivialstatus.h
gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/trivialtracer.cpp
gearbox/trunk/submitted/gbxsickacfr/gbxutilacfr/trivialtracer.h
gearbox/trunk/submitted/gbxsickacfr/messages.cpp
gearbox/trunk/submitted/gbxsickacfr/messages.h
gearbox/trunk/submitted/gbxsickacfr/serialhandler.cpp
gearbox/trunk/submitted/gbxsickacfr/serialhandler.h
gearbox/trunk/submitted/gbxsickacfr/sickdefines.cpp
gearbox/trunk/submitted/gbxsickacfr/sickdefines.h
gearbox/trunk/submitted/gbxsickacfr/test/
gearbox/trunk/submitted/gbxsickacfr/test/CMakeLists.txt
gearbox/trunk/submitted/gbxsickacfr/test/test.cpp
Modified: gearbox/trunk/submitted/CMakeLists.txt
===================================================================
--- gearbox/trunk/submitted/CMakeLists.txt 2008-02-12 02:02:21 UTC (rev 62)
+++ gearbox/trunk/submitted/CMakeLists.txt 2008-02-16 06:25:16 UTC (rev 63)
@@ -10,7 +10,7 @@
# When adding new directories, please maintain order of inter-dependencies.
# Otherwise, maintain alphabetical order.
-# ADD_SUBDIRECTORY( gbxserialacfr )
-# ADD_SUBDIRECTORY( gbxsickacfr )
+ ADD_SUBDIRECTORY( gbxserialacfr )
+ ADD_SUBDIRECTORY( gbxsickacfr )
ENDIF ( GBX_BUILD_SUBMITTED )
\ No newline at end of file
Added: gearbox/trunk/submitted/gbxserialacfr/CMakeLists.txt
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/CMakeLists.txt (rev 0)
+++ gearbox/trunk/submitted/gbxserialacfr/CMakeLists.txt 2008-02-16 06:25:16 UTC (rev 63)
@@ -0,0 +1,34 @@
+SET ( lib_name GbxSerialAcfr )
+GBX_ADD_LICENSE( LGPL )
+
+SET ( build TRUE )
+GBX_REQUIRE_OPTION( build LIB ${lib_name} ON )
+GBX_REQUIRE_VAR( build LIB ${lib_name} GBX_OS_LINUX "only Linux OS is supported" )
+
+SET( dep_libs GbxLockFileAcfr )
+# this is currently internal, so we don't have to check it
+# GBX_REQUIRE_TARGETS( build LIB ${lib_name} ${dep_libs} )
+
+IF ( build )
+
+ ADD_SUBDIRECTORY( lockfile )
+
+ INCLUDE( ${GBX_CMAKE_DIR}/UseBasicRules.cmake )
+
+ # for config.h
+ INCLUDE_DIRECTORIES( ${PROJECT_BINARY_DIR} )
+
+ FILE( GLOB hdrs *.h )
+ FILE( GLOB srcs *.cpp )
+
+ GBX_ADD_LIBRARY( ${lib_name} SHARED ${srcs} )
+ TARGET_LINK_LIBRARIES( ${lib_name} ${dep_libs} )
+
+ GBX_ADD_HEADERS( gbxserialacfr ${hdrs} )
+
+ IF ( GBX_BUILD_TESTS )
+ ADD_SUBDIRECTORY ( test )
+ ENDIF ( GBX_BUILD_TESTS )
+
+ENDIF ( build )
+
Added: gearbox/trunk/submitted/gbxserialacfr/doc.dox
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/doc.dox (rev 0)
+++ gearbox/trunk/submitted/gbxserialacfr/doc.dox 2008-02-16 06:25:16 UTC (rev 63)
@@ -0,0 +1,43 @@
+/*
+ * Orca-Robotics Project: Components for robotics
+ * http://orca-robotics.sf.net/
+ * Copyright (c) 2004-2008 Mathew Ridley, Alex Brooks
+ *
+ * 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_gbxserialacfr libGbxSerialAcfr
+@brief Simple serial port interface
+
+@par General notes
+
+C++ class wrapping a serial port. For a full list of functions and classes see @ref gbxserialacfr.
+
+Header file:
+@verbatim
+#include <gbxserialacfr/serial.h>
+@endverbatim
+
+Other serial libraries:
+- http://libserial.sourceforge.net (GPL)
+- http://qextserialport.sourceforge.net (requires Qt)
+
+@par Responsible Developer
+Alex Brooks
+
+*/
+
+/*!
+@brief Simple serial port interface
+@namespace gbxserialacfr
+
+This namespace is part of a library which contains C++ class for wrapping a serial port.
+
+@see @ref gbx_library_gbxserialacfr
+
+*/
\ No newline at end of file
Added: gearbox/trunk/submitted/gbxserialacfr/gbxserialacfr.h
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/gbxserialacfr.h (rev 0)
+++ gearbox/trunk/submitted/gbxserialacfr/gbxserialacfr.h 2008-02-16 06:25:16 UTC (rev 63)
@@ -0,0 +1,15 @@
+/*
+ * Orca-Robotics Project: Components for robotics
+ * http://orca-robotics.sf.net/
+ * Copyright (c) 2004-2008 Mathew Ridley, Alex Brooks
+ *
+ * This distribution is licensed to you under the terms described in
+ * the LICENSE file included in this distribution.
+ *
+ */
+#ifndef GBXSERIALACFR_SERIAL_GBXSERIALACFR_SERIAL_H_
+#define GBXSERIALACFR_SERIAL_GBXSERIALACFR_SERIAL_H_
+
+#include <gbxserialacfr/serial.h>
+
+#endif
Added: gearbox/trunk/submitted/gbxserialacfr/lockfile/CMakeLists.txt
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/lockfile/CMakeLists.txt (rev 0)
+++ gearbox/trunk/submitted/gbxserialacfr/lockfile/CMakeLists.txt 2008-02-16 06:25:16 UTC (rev 63)
@@ -0,0 +1,26 @@
+SET ( lib_name GbxLockFileAcfr )
+GBX_ADD_LICENSE( LGPL )
+
+SET ( build TRUE )
+# don't give user an option
+# GBX_REQUIRE_OPTION( build LIB ${lib_name} ON )
+# this was already tested in the dir above
+# GBX_REQUIRE_VAR( build LIB ${lib_name} GBX_OS_LINUX "only Linux OS is supported" )
+
+IF ( build )
+
+ INCLUDE( ${GBX_CMAKE_DIR}/UseBasicRules.cmake )
+
+ FILE( GLOB hdrs *.h )
+ FILE( GLOB srcs *.cpp )
+
+ GBX_ADD_LIBRARY( ${lib_name} SHARED ${srcs} )
+ TARGET_LINK_LIBRARIES( ${lib_name} ${dep_libs} )
+
+ GBX_ADD_HEADERS( gbxserialacfr/lockfile ${hdrs} )
+
+ IF ( GBX_BUILD_TESTS )
+ ADD_SUBDIRECTORY ( test )
+ ENDIF ( GBX_BUILD_TESTS )
+
+ENDIF ( build )
Added: gearbox/trunk/submitted/gbxserialacfr/lockfile/lockfile.cpp
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/lockfile/lockfile.cpp (rev 0)
+++ gearbox/trunk/submitted/gbxserialacfr/lockfile/lockfile.cpp 2008-02-16 06:25:16 UTC (rev 63)
@@ -0,0 +1,183 @@
+/*
+ * Orca-Robotics Project: Components for robotics
+ * http://orca-robotics.sf.net/
+ * Copyright (c) 2004-2008 Alex Brooks
+ *
+ * This distribution is licensed to you under the terms described in
+ * the LICENSE file included in this distribution.
+ *
+ */
+#include "lockfile.h"
+#include <cstring>
+#include <cstdlib>
+#include <iostream>
+#include <signal.h>
+#include <sys/types.h>
+#include <errno.h>
+#include <sstream>
+#include <libgen.h>
+
+using namespace std;
+
+namespace gbxserialacfr {
+namespace lockfile {
+
+namespace {
+
+ const char *LOCK_DIR = "/var/lock";
+
+ // This function is inefficient, but avoids
+ // all the weirdness of basename().
+ std::string getBasename( const char *path )
+ {
+ char *pathCopy = strdup( path );
+ char *base = basename( pathCopy );
+ std::string baseString = base;
+ free( pathCopy );
+ return baseString;
+ }
+
+ void
+ lock_dev(const char *dev, int lpid)
+ {
+ FILE *fd;
+ char pbuf[260], lbuf[260];
+ int ret;
+
+ std::string devBase = getBasename( dev );
+
+ sprintf(pbuf, "%s/PID..%d", LOCK_DIR, getpid());
+ sprintf(lbuf, "%s/LCK..%s", LOCK_DIR, devBase.c_str());
+
+ // Create a file with our PID
+ fd = fopen(pbuf, "w");
+ if (fd == 0)
+ {
+ stringstream ss;
+ ss << "Failed to open file '"<<pbuf<<"' for writing: "<<strerror(errno);
+ throw LockFileException( ss.str() );
+ }
+ fprintf(fd, "%10d\n", lpid);
+ ret = fclose(fd);
+ if ( ret != 0 )
+ {
+ stringstream ss; ss << "Problem closing lockfile '"<<pbuf<<"': " << strerror(errno);
+ throw LockFileException( ss.str() );
+ }
+
+ // Create a file for the device
+ if (link(pbuf, lbuf) < 0)
+ {
+ // A file already exists for the device... Have a look at the PID
+ fd = fopen(lbuf, "r");
+ if ( fd == 0 )
+ {
+ unlink(pbuf);
+ stringstream ss;
+ ss << "Couldn't open file '"<<lbuf<<"' for reading: " << strerror(errno);
+ throw LockFileException( ss.str() );
+ }
+
+ // Read the PID of the locker
+ int pidOfLocker;
+ ret = fscanf( fd, "%d", &pidOfLocker );
+ fclose(fd);
+
+ if ( ret != 1 )
+ {
+ unlink(pbuf);
+ throw LockFileException( "Couldn't read PID of locker" );
+ }
+ if ( pidOfLocker <= 0 )
+ {
+ unlink(pbuf);
+ stringstream ss; ss << "Invalid PID of locker: " << pidOfLocker;
+ throw LockFileException( ss.str() );
+ }
+
+ if ( pidOfLocker == lpid )
+ {
+ // I'm the locker ?!?!
+ unlink(pbuf);
+ stringstream ss; ss << "device " << dev << " is already locked by me! (pid "<<lpid<<")";
+ throw LockFileException( ss.str() );
+ }
+
+ // Look for the process which owns the lock
+ if ( kill(pidOfLocker, 0) == 0 || errno == EPERM)
+ {
+ unlink(pbuf);
+ stringstream ss; ss << "device " << dev << " is already locked by process PID " << pidOfLocker;
+ throw LockFileException( ss.str() );
+ }
+ else
+ {
+ // The process which owns the lock no longer exists. Clean up.
+ ret = unlink( lbuf );
+ if ( ret != 0 )
+ {
+ unlink(pbuf);
+ stringstream ss; ss << "Couldn't unlink " << lbuf << ": " << strerror(errno);
+ throw LockFileException( ss.str() );
+ }
+
+ // Now create our own
+ ret = link( pbuf, lbuf );
+ if ( ret < 0 )
+ {
+ unlink(pbuf);
+ stringstream ss; ss << "Couldn't link("<<pbuf<<","<<lbuf<<"): " << strerror(errno);
+ throw LockFileException( ss.str() );
+ }
+ }
+ }
+
+ ret = unlink(pbuf);
+ if ( ret < 0 )
+ {
+ stringstream ss;
+ ss << "Couldn't unlink pbuf: " << strerror(errno);
+ throw LockFileException( ss.str() );
+ }
+ }
+
+ void
+ unlock_dev(const char *dev, int lpid)
+ {
+ FILE *fd;
+ char lbuf[260];
+ int pidOfLocker = 0;
+ char *p;
+
+ if ((p = strrchr(dev, '/')))
+ dev = p + 1;
+ sprintf(lbuf, "%s/LCK..%s", LOCK_DIR, dev);
+
+ fd = fopen(lbuf, "r");
+ if (fd && fscanf(fd, "%d", &pidOfLocker) == 1 && pidOfLocker == lpid)
+ {
+ fclose(fd);
+ unlink(lbuf);
+ }
+ else if (fd)
+ fclose(fd);
+ }
+}
+
+//////////////////////////////////////////////////////////////////////
+
+LockFile::LockFile( const std::string &dev,
+ int lockPid )
+ : dev_(dev),
+ lockPid_(lockPid)
+{
+ lock_dev( dev_.c_str(), lockPid_ );
+}
+
+LockFile::~LockFile()
+{
+ unlock_dev( dev_.c_str(), lockPid_ );
+}
+
+}
+}
Added: gearbox/trunk/submitted/gbxserialacfr/lockfile/lockfile.h
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/lockfile/lockfile.h (rev 0)
+++ gearbox/trunk/submitted/gbxserialacfr/lockfile/lockfile.h 2008-02-16 06:25:16 UTC (rev 63)
@@ -0,0 +1,61 @@
+/*
+ * Orca-Robotics Project: Components for robotics
+ * http://orca-robotics.sf.net/
+ * Copyright (c) 2004-2008 Alex Brooks
+ *
+ * This distribution is licensed to you under the terms described in
+ * the LICENSE file included in this distribution.
+ *
+ */
+#ifndef GBXSERIALACFR_LOCKFILE_H
+#define GBXSERIALACFR_LOCKFILE_H
+
+#include <exception>
+#include <string>
+
+namespace gbxserialacfr {
+namespace lockfile {
+
+//
+// @brief Exception thrown by lockfile functions
+//
+class LockFileException : public std::exception
+{
+ std::string message_;
+public:
+ LockFileException(const char *message)
+ : message_(message) {}
+ LockFileException(const std::string &message)
+ : message_(message) {}
+ ~LockFileException()throw(){}
+ virtual const char* what() const throw() { return message_.c_str(); }
+};
+
+//
+// Creates a lock-file which can be used to prevent multiple access to
+// a unique resource (eg "/dev/xxx").
+// Stores the PID of the locking process (lockPid), so it can check for stale lock-files.
+//
+// Throws LockFileException's on errors (including 'device locked').
+//
+// The destructor removes the lock-file (guarantees that no exceptions are thrown).
+//
+// For more info, see: http://tldp.org/HOWTO/Serial-HOWTO-14.html
+//
+class LockFile {
+public:
+
+ LockFile( const std::string &dev,
+ int lockPid = getpid() );
+ ~LockFile();
+
+private:
+
+ const std::string dev_;
+ const int lockPid_;
+
+};
+
+}
+}
+#endif
Added: gearbox/trunk/submitted/gbxserialacfr/lockfile/test/CMakeLists.txt
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/lockfile/test/CMakeLists.txt (rev 0)
+++ gearbox/trunk/submitted/gbxserialacfr/lockfile/test/CMakeLists.txt 2008-02-16 06:25:16 UTC (rev 63)
@@ -0,0 +1,4 @@
+INCLUDE( ${GBX_CMAKE_DIR}/UseBasicRules.cmake )
+
+ADD_EXECUTABLE( locktest locktest.cpp )
+TARGET_LINK_LIBRARIES( locktest GbxLockFileAcfr )
Added: gearbox/trunk/submitted/gbxserialacfr/lockfile/test/locktest.cpp
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/lockfile/test/locktest.cpp (rev 0)
+++ gearbox/trunk/submitted/gbxserialacfr/lockfile/test/locktest.cpp 2008-02-16 06:25:16 UTC (rev 63)
@@ -0,0 +1,37 @@
+#include <iostream>
+#include <cstdlib>
+#include <gbxserialacfr/lockfile/lockfile.h>
+
+using namespace std;
+
+int main( int argc, char **argv )
+{
+ const char *dev = "/dev/ttyS0";
+
+ gbxserialacfr::lockfile::LockFile *lock;
+
+ try {
+ lock = new gbxserialacfr::lockfile::LockFile( dev );
+ }
+ catch ( const std::exception &e )
+ {
+ cout<<"TRACE(locktest.cpp): Failed to lock: " << e.what() << endl;
+ exit(1);
+ }
+
+ try {
+ gbxserialacfr::lockfile::LockFile secondLock( dev );
+
+ cerr << "Error: double-lock succeeded.";
+ exit(1);
+ }
+ catch ( const std::exception &e )
+ {
+ cout<<"TRACE(locktest.cpp): Correctly caught exception: " << e.what() << endl;
+ }
+
+ delete lock;
+
+ cout<<"TRACE(locktest.cpp): test PASSED!" << endl;
+ return 0;
+}
Added: gearbox/trunk/submitted/gbxserialacfr/serial.cpp
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/serial.cpp (rev 0)
+++ gearbox/trunk/submitted/gbxserialacfr/serial.cpp 2008-02-16 06:25:16 UTC (rev 63)
@@ -0,0 +1,838 @@
+/*
+ * Orca-Robotics Project: Components for robotics
+ * http://orca-robotics.sf.net/
+ * Copyright (c) 2004-2008 Mathew Ridley, Alex Brooks
+ *
+ * This distribution is licensed to you under the terms described in
+ * the LICENSE file included in this distribution.
+ *
+ */
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <unistd.h> // read and write to ports
+#include <string.h>
+#include <iostream>
+#include <iomanip>
+#include <sstream>
+#include <assert.h>
+#include "serial.h"
+
+#if __linux
+# include <linux/serial.h>
+#endif
+
+#include <config.h>
+#if HAVE_FILIO_H
+// FIONREAD
+# include <sys/filio.h>
+#endif
+// Ensure we have strnlen
+// #include <hydroportability/strnlen.h>
+
+// copy the contents of this file below
+// start of <hydroportability/strnlen.h>
+// 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
+// end of <hydroportability/strnlen.h>
+
+// define for a debug compile
+#define DEBUG
+
+
+using namespace std;
+
+namespace gbxserialacfr {
+
+ namespace {
+
+ //Used for calls to waitForDataOrTimeout()
+ enum{TIMED_OUT=-1, GOT_DATA};
+
+
+ // Converts an integer baud-rate into a c-style '#define'd baudrate
+ int cBaudrate( int baudRate )
+ {
+ switch(baudRate)
+ {
+ case 0:
+ return B0;
+ case 50:
+ return B50;
+ case 75:
+ return B75;
+ case 110:
+ return B110;
+ case 134:
+ return B134;
+ case 150:
+ return B150;
+ case 200:
+ return B200;
+ case 300:
+ return B300;
+ case 600:
+ return B600;
+ case 1200:
+ return B1200;
+ case 1800:
+ return B1800;
+ case 2400:
+ return B2400;
+ case 4800:
+ return B4800;
+ case 9600:
+ return B9600;
+ case 19200:
+ return B19200;
+ case 38400:
+ return B38400;
+ case 57600:
+ return B57600;
+ case 115200:
+ return B115200;
+#ifdef __linux
+ case 230400:
+ return B230400;
+ case 460800:
+ return B460800;
+ case 500000:
+ return B500000;
+ case 576000:
+ return B576000;
+ case 921600:
+ return B921600;
+ case 1000000:
+ return B1000000;
+ case 1152000:
+ return B1152000;
+ case 1500000:
+ return B1500000;
+ case 2000000:
+ return B2000000;
+ case 2500000:
+ return B2500000;
+ case 3000000:
+ return B3000000;
+ case 3500000:
+ return B3500000;
+ case 4000000:
+ return B4000000;
+#endif
+ default:
+ stringstream ss;
+ ss << "Serial::baud() Invalid baud rate: " << baudRate;
+ throw SerialException( ss.str() );
+ }
+ }
+
+ int iBaudrate( int baudRate )
+ {
+ switch(baudRate)
+ {
+ case B0:
+ return 0;
+ case B50:
+ return 50;
+ case B75:
+ return 75;
+ case B110:
+ return 110;
+ case B134:
+ return 134;
+ case B150:
+ return 150;
+ case B200:
+ return 200;
+ case B300:
+ return 300;
+ case B600:
+ return 600;
+ case B1200:
+ return 1200;
+ case B1800:
+ return 1800;
+ case B2400:
+ return 2400;
+ case B4800:
+ return 4800;
+ case B9600:
+ return 9600;
+ case B19200:
+ return 19200;
+ case B38400:
+ return 38400;
+ case B57600:
+ return 57600;
+ case B115200:
+ return 115200;
+ case B230400:
+ return 230400;
+ case B460800:
+ return 460800;
+ case B500000:
+ return 500000;
+ case B576000:
+ return 576000;
+ case B921600:
+ return 921600;
+ case B1000000:
+ return 1000000;
+ case B1152000:
+ return 1152000;
+ case B1500000:
+ return 1500000;
+ case B2000000:
+ return 2000000;
+ case B2500000:
+ return 2500000;
+ case B3000000:
+ return 3000000;
+ case B3500000:
+ return 3500000;
+ case B4000000:
+ return 4000000;
+ default:
+ stringstream ss;
+ ss << "Serial::baud() Invalid baud rate: " << baudRate;
+ throw SerialException( ss.str() );
+ }
+ }
+
+ //Allow streaming of the term status structure type
+ std::ostream &operator<<( std::ostream &s, struct termios &stat )
+ {
+ s.setf(ios::hex,ios::basefield);
+ s.fill('0');
+
+ s << "c_iflag -> 0x" << setw(4) << stat.c_iflag << endl;
+ s << "c_oflag -> 0x" << setw(4) << stat.c_oflag << endl;
+ s << "c_cflag -> 0x" << setw(4) << stat.c_cflag << endl;
+ s << "c_lflag -> 0x" << setw(4) << stat.c_lflag << endl;
+
+ s << "c_cc_array ->" << endl;
+ s << "VINTR 0x" << setw(2) << static_cast<int>(stat.c_cc[VINTR])
+ << ", VQUIT 0x" << setw(2) << static_cast<int>(stat.c_cc[VQUIT])
+ << ", VERASE 0x" << setw(2) << static_cast<int>(stat.c_cc[VERASE])
+ << ", VKILL 0x" << setw(2) << static_cast<int>(stat.c_cc[VKILL]) << endl ;
+ s << "VEOF 0x" << setw(2) << static_cast<int>(stat.c_cc[VEOF])
+ << ", VEOL 0x" << setw(2) << static_cast<int>(stat.c_cc[VEOL])
+ << ", VEOL2 0x" << setw(2) << static_cast<int>(stat.c_cc[VEOL2])
+ << ", VSTART 0x" << setw(2) << static_cast<int>(stat.c_cc[VSTART]) << endl ;
+ s << "VSTOP 0x" << setw(2) << static_cast<int>(stat.c_cc[VSTOP])
+ << ", VSUSP 0x" << setw(2) << static_cast<int>(stat.c_cc[VSUSP])
+ << ", VREPRINT 0x" << setw(2) << static_cast<int>(stat.c_cc[VREPRINT])
+ << ", VLNEXT 0x" << setw(2) << static_cast<int>(stat.c_cc[VLNEXT]) << endl;
+ s << "VMIN 0x" << setw(2) << static_cast<int>(stat.c_cc[VMIN])
+ << ", VTIME 0x" << setw(2) << static_cast<int>(stat.c_cc[VTIME]) << endl;
+
+
+ s << "c_iflag, Bits set" << endl;
+ if (stat.c_iflag & IGNBRK) { s << "IGNBRK,";}
+ if (stat.c_iflag & BRKINT) { s << "BRKINT,";}
+ if (stat.c_iflag & IGNPAR) { s << "IGNPAR,";}
+ if (stat.c_iflag & PARMRK) { s << "PARMRK,";}
+ if (stat.c_iflag & INPCK) { s << "INPCK,";}
+ if (stat.c_iflag & ISTRIP) { s << "ISTRIP,";}
+ if (stat.c_iflag & INLCR) { s << "INLCR,";}
+ if (stat.c_iflag & IGNCR) { s << "IGNCR,";}
+ if (stat.c_iflag & ICRNL) { s << "ICRNL,";}
+ if (stat.c_iflag & IUCLC) { s << "IUCLC,";}
+ if (stat.c_iflag & IXON) { s << "IXON,";}
+ if (stat.c_iflag & IXANY) { s << "IXANY,";}
+ if (stat.c_iflag & IXOFF) { s << "IXOFF,";}
+ if (stat.c_iflag & IMAXBEL){ s << "IMAXBEL,";}
+ s << endl;
+
+ s << "c_oflag, Bits set" << endl;
+ if (stat.c_oflag & OPOST){ s << "OPOST,";}
+ if (stat.c_oflag & OLCUC){ s << "OLCUC,";}
+ if (stat.c_oflag & ONLCR){ s << "ONLCR,";}
+ if (stat.c_oflag & OCRNL){ s << "OCRNL,";}
+ if (stat.c_oflag & ONOCR){ s << "ONOCR,";}
+ if (stat.c_oflag & ONLRET){ s << "ONLRET,";}
+ if (stat.c_oflag & OFILL){ s << "OFILL,";}
+ if (stat.c_oflag & OFDEL){ s << "OFDEL,";}
+ if (stat.c_oflag & NLDLY){ s << "NLDLY,";}
+ if (stat.c_oflag & CRDLY){ s << "CRDLY,";}
+ if (stat.c_oflag & TABDLY){ s << "TABDLY,";}
+ if (stat.c_oflag & BSDLY){ s << "BSDLY,";}
+ if (stat.c_oflag & VTDLY){ s << "VTDLY,";}
+ if (stat.c_oflag & FFDLY){ s << "FFDLY,";}
+ s << endl;
+
+ s << "c_cflag, Bits set" << endl;
+ if (stat.c_cflag & CSTOPB){ s << "CSTOPB,";}
+ if (stat.c_cflag & CREAD){ s << "CREAD,";}
+ if (stat.c_cflag & PARENB){ s << "PARENB,";}
+ if (stat.c_cflag & PARODD){ s << "PARODD,";}
+ if (stat.c_cflag & HUPCL){ s << "HUPCL,";}
+ if (stat.c_cflag & CLOCAL){ s << "CLOCAL,";}
+ if (stat.c_cflag & CIBAUD){ s << "CIBAUD,";}
+ s << endl;
+
+
+ s << "c_lflag, Bits set" << endl;
+ if (stat.c_lflag & ISIG){ s << "ISIG,";}
+ if (stat.c_lflag & ICANON){ s << "ICANON,";}
+ if (stat.c_lflag & PARENB){ s << "PARENB,";}
+ if (stat.c_lflag & XCASE){ s << "XCASE,";}
+ if (stat.c_lflag & NOFLSH){ s << "NOFLSH,";}
+ if (stat.c_lflag & FLUSHO){ s << "FLUSHO,";}
+ if (stat.c_lflag & PENDIN){ s << "PENDIN,";}
+ if (stat.c_lflag & IEXTEN){ s << "IEXTEN,";}
+ if (stat.c_lflag & TOSTOP){ s << "TOSTOP,";}
+ if (stat.c_lflag & ECHO){ s << "ECHO,";}
+ if (stat.c_lflag & ECHOE){ s << "ECHOE,";}
+ if (stat.c_lflag & ECHOPRT){ s << "ECHOPRT,";}
+ if (stat.c_lflag & ECHOKE){ s << "ECHOKE,";}
+ if (stat.c_lflag & NOFLSH){ s << "ECHONL,";}
+ if (stat.c_lflag & FLUSHO){ s << "ECHOCTL,";}
+ s << endl;
+
+ s << endl;
+ s.setf(ios::dec,ios::basefield);
+ return s;
+ }
+
+
+ std::ostream &operator<<( std::ostream &s, struct serial_struct &serinfo )
+ {
+ s.setf(ios::hex,ios::basefield);
+
+ s << "TIOCGSERIAL:-> " << endl;
+ s << "Flags: 0x" << setw(2) << serinfo.flags
+ << ", Type: 0x" << setw(2) << serinfo.type
+ << ", Line: 0x" << setw(2) << serinfo.line << endl;
+ s << "Port: 0x" << setw(2) << serinfo.port
+ << ", IRQ: 0x" << setw(2) << serinfo.irq
+ << ", xmit_fifo_size: 0x" << setw(2) << serinfo.xmit_fifo_size << endl;
+ s << "Baud_base: 0x" << setw(2) << serinfo.baud_base
+ << ", Custom_divisor: 0x" << setw(2) << serinfo.custom_divisor
+ << ", Io_type: 0x" << setw(2) << serinfo.io_type << endl;
+
+ s.setf(ios::dec,ios::basefield);
+ return s;
+ }
+
+ }
+
+//////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////
+
+Serial::Serial( const std::string &dev,
+ int baudRate,
+ bool enableTimeouts,
+ int debuglevel,
+ bool useLockFile )
+ : dev_(dev),
+ portFd_(-1),
+ timeoutSec_(0),
+ timeoutUSec_(0),
+ timeoutsEnabled_(enableTimeouts),
+ debugLevel_(debuglevel)
+{
+ if ( useLockFile )
+ {
+ try {
+ lockFile_ = new lockfile::LockFile( dev );
+ }
+ catch ( const lockfile::LockFileException &e )
+ {
+ stringstream ss;
+ ss << "Couldn't get lock for device " << dev << ": " << e.what();
+ throw SerialException( ss.str() );
+ }
+ }
+
+ try {
+ open();
+ setBaudRate( baudRate );
+
+ if(debugLevel_ > 2){
+ cout << "At end of Serial::Serial: " << getStatusString();
+ }
+ }
+ catch ( const SerialException &e )
+ {
+ if ( lockFile_ ) delete lockFile_;
+ throw;
+ }
+}
+
+Serial::~Serial()
+{
+ close();
+ if ( lockFile_ ) delete lockFile_;
+}
+
+void
+Serial::setTimeout(int sec, int usec)
+{
+ if ( !timeoutsEnabled_ )
+ {
+ stringstream s;
+ s << "setTimeout() called for port" << dev_ <<" but timeouts not enabled!";
+ throw SerialException( s.str() );
+ }
+
+ timeoutSec_=sec; timeoutUSec_=usec;
+}
+
+void
+Serial::close()
+{
+ if ( debugLevel_ > 0 )
+ cout<<"TRACE(serial.cpp): close()" << endl;
+
+ assert( portFd_ != -1 );
+
+ if(tcdrain(portFd_))
+ {
+ perror("Serial::close():tcdrain()");
+ }
+ if (::close(portFd_))
+ {
+ perror("Serial::close():close()");
+ }
+
+ //Make sure that we force this back to an invalid state
+ portFd_ = -1;
+}
+
+void
+Serial::setBaudRate(int baud)
+{
+ struct termios localOptions;
+
+ if ( debugLevel_ > 0 )
+ cout<<"TRACE(serial.cpp): setBaudRate("<<baud<<")" << endl;
+
+ if(portFd_==-1)
+ {
+ throw SerialException( "Serial:baud() no valid device open" );
+ }
+ if(tcgetattr(portFd_, &localOptions) == -1)
+ {
+ stringstream ss;
+ ss << "Serial::baud():tcgetattr() Error reading attr: " << strerror(errno);
+ throw SerialException( ss.str() );
+ }
+
+ cfsetispeed(&localOptions, cBaudrate(baud));
+ cfsetospeed(&localOptions, cBaudrate(baud));
+
+ //
+ // AlexB: This code doesn't seem to work for USB devices...
+ // See: http://ozlabs.org/pipermail/linuxppc-embedded/2005-February/016848.html
+ //
+ if ( strstr( dev_.c_str(), "USB" ) == 0 )
+ {
+ //
+ // AlexB: For reasons I don't fully understand, this chunk is required to make the
+ // laser work at standard baud rates.
+ //
+ struct serial_struct serinfo;
+ serinfo.reserved_char[0] = 0;
+ if (ioctl(portFd_, TIOCGSERIAL, &serinfo) < 0)
+ {
+ stringstream ss;
+ ss << "Serial::setBaudRate("<<baud<<"): error calling 'ioctl(portFd_, TIOCGSERIAL, &serinfo)': "<<strerror(errno);
+ throw SerialException( ss.str() );
+ }
+
+ serinfo.flags &= ~ASYNC_SPD_CUST;
+ serinfo.custom_divisor = 0;
+
+ if (ioctl(portFd_, TIOCSSERIAL, &serinfo) < 0)
+ {
+ stringstream ss;
+ ss << "Serial::setBaudRate("<<baud<<"): error calling 'ioctl(portFd_, TIOCSSERIAL, &serinfo)': "<<strerror(errno);
+ throw SerialException( ss.str() );
+ }
+ }
+
+ if ( tcsetattr(portFd_, TCSAFLUSH, &localOptions) == -1 )
+ {
+ stringstream ss;
+ ss << "Serial::baud():tcsetattr() Error setting attr: " << strerror(errno);
+ throw SerialException( ss.str() );
+ }
+}
+
+void
+Serial::open(int flags)
+{
+ struct termios localOptions;
+
+ if ( timeoutsEnabled_ )
+ flags |= O_NONBLOCK;
+
+ portFd_ = ::open(dev_.c_str(), flags|O_RDWR|O_NOCTTY);
+ if ( portFd_ == -1 )
+ {
+ stringstream ss;
+ ss << "Serial::open(): failed to open '"<<dev_<<"': "<<strerror(errno);
+ throw SerialException( ss.str() );
+ }
+
+
+ if(tcgetattr(portFd_, &localOptions) == -1)
+ {
+ close();
+ stringstream ss;
+ ss << "Serial::open(): tcgetattr() failed for '"<<dev_<<"': "<<strerror(errno);
+ throw SerialException( ss.str() );
+ }
+
+ if(debugLevel_ > 2){
+ cout << "At beginning of open(): "<<getStatusString()<<endl;
+ }
+
+
+
+ // enable receiver & ignore control lines
+ localOptions.c_cflag |= (CLOCAL | CREAD) ;
+
+ // set 8 data bits
+ localOptions.c_cflag &= ~CSIZE;
+ localOptions.c_cflag |= CS8;
+
+ // set parity to none with no stop bit
+ localOptions.c_cflag &= ~PARENB;
+ localOptions.c_cflag &= ~CSTOPB;
+
+ // disable hardware flow control
+ localOptions.c_cflag &= ~CRTSCTS;
+
+#if defined(__sun)
+ // http://www.sunmanagers.org/pipermail/summaries/2005-October/006871.html
+ localOptions.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
+ localOptions.c_oflag &= ~OPOST;
+ localOptions.c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
+ localOptions.c_cflag &= ~(CSIZE|PARENB);
+ localOptions.c_cflag |= CS8;
+#else
+ cfmakeraw(&localOptions);
+#endif
+
+ if(tcsetattr(portFd_, TCSAFLUSH, &localOptions) == -1)
+ {
+ close();
+ stringstream ss;
+ ss << "Serial::open(): tcsetattr() failed for '"<<dev_<<"': "<<strerror(errno);
+ throw SerialException( ss.str() );
+ }
+
+ if ( debugLevel_ > 2 ){
+ cout << "At end of open():" << getStatusString();
+ }
+
+}
+
+int
+Serial::read(void *buf, int count)
+{
+ if ( debugLevel_ > 0 )
+ cout<<"TRACE(serial.cpp): read()" << endl;
+
+ int got = ::read(portFd_, buf, count);
+ if ( got < 0 )
+ {
+ throw SerialException( string("Serial::read(): ") + strerror(errno) );
+ }
+
+ if ( debugLevel_ > 1 )
+ {
+ cout<<"TRACE(serial.cpp): read: '";
+ for ( int i=0; i < count; i++ )
+ cout << ((char*)(buf))[i];
+ cout << "'" << endl;
+ }
+
+ return got;
+}
+
+
+
+int
+Serial::readFull(void *buf, int count)
+{
+ if ( debugLevel_ > 0 )
+ cout<<"TRACE(serial.cpp): readFull(): count=" << count << endl;
+
+ char* bufPtr = static_cast<char*>(buf);
+
+ int got=0;
+ while ( got < count )
+ {
+ char *offset = bufPtr + got;
+ int ret = ::read(portFd_, offset, count-got);
+ if ( ret >= 0 )
+ {
+ got += ret;
+ }
+
+ else if (timeoutsEnabled_ && (errno == EAGAIN) )
+ {
+ if ( waitForDataOrTimeout() == TIMED_OUT )
+ {
+ // select timed out: no data
+ return -1;
+ }
+ }
+
+ else
+ {
+ throw SerialException( std::string("Serial::readFullWithTimeout: read(): ")+strerror(errno) );
+ }
+
+ }
+
+ return got; //The number of bytes that we read.
+}
+
+
+
+
+int
+Serial::readLine(void *buf, int count, char termchar)
+{
+ if ( debugLevel_ > 0 ){
+ cout<<"TRACE(serial.cpp): readLine ";
+ 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) )
+ {
+ throw SerialException( "Serial::readLine: Not enough room in buffer" );
+ }
+
+ 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() == GOT_DATA)
+ {
+ 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
+ throw SerialException( std::string( "Serial::readLine(): ")+strerror(errno) );
+ }
+
+ } 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) );
+
+ //TODO: Duncan! I think that this should cope with any <CR><LF> pair gracefully!
+}
+
+
+int
+Serial::bytesAvailable()
+{
+ int n_read;
+ int ret = ioctl(portFd_,FIONREAD,&n_read);
+
+ if(ret==-1)
+ {
+ throw SerialException( std::string("Serial::bytesAvailable(): ")+strerror(errno) );
+ }
+ return n_read;
+}
+
+int
+Serial::bytesAvailableWait()
+{
+ if ( waitForDataOrTimeout() == TIMED_OUT){
+ return -1;
+ }
+
+ return bytesAvailable();
+}
+
+
+int
+Serial::waitForDataOrTimeout()
+{
+ fd_set rfds;
+ struct timeval tv;
+ FD_ZERO(&rfds);
+ FD_SET(portFd_, &rfds);
+ tv.tv_sec = timeoutSec_;
+ tv.tv_usec = timeoutUSec_;
+ int selval = select(portFd_+1, &rfds, NULL, NULL, &tv);
+ if(selval==0)
+ {
+ // select timed out: no data
+ return TIMED_OUT;
+ }
+ if(selval<0)
+ {
+ throw SerialException( std::string("Serial::waitForTimeout: select(): ")+strerror(errno) );
+ }
+
+ return GOT_DATA;
+}
+
+
+int
+Serial::writeString(const char *str)
+{
+ if ( debugLevel_ > 0 )
+ cout<<"TRACE(serial.cpp): writeString(): writing '"<<str<<"'" << endl;
+
+ int put;
+ put = ::write(portFd_, str, strlen(str) );
+ if ( put < 0 )
+ {
+ throw SerialException( string("Serial::write(): ")+strerror(errno) );
+ }
+ else if ( put == 0 )
+ {
+ throw SerialException( "Serial::writeString(): ::write() returned 0" );
+ }
+ else if ( put < (int)(strlen(str)) )
+ {
+ // AlexB: Not sure what to do here... This can happen eg if the buffer is full.
+ // I'm not convinced that we want to throw an exception, but chances are
+ // lots of users won't check the return code.
+ cout << "WARNING: Serial::writeString: only wrote " << put << " of " << strlen(str) << " bytes." << endl;
+ }
+
+ if ( debugLevel_ > 1 )
+ {
+ cout<<"TRACE(serial.cpp): wrote " << put << " bytes" << endl;
+ }
+
+ return put;
+}
+
+
+std::string
+Serial::getStatusString()
+{
+ struct termios status;
+ if(tcgetattr(portFd_, &status) == -1)
+ {
+ close();
+ throw SerialException( std::string("Serial::getStatusString(): tcgetattr():")+strerror(errno) );
+ }
+
+ stringstream ss;
+ ss << endl << " Device " << dev_ << " Status:-" << endl;
+ ss << "In baud_rate: " << iBaudrate(cfgetispeed(&status))
+ << " Out baud_rate: " << iBaudrate(cfgetospeed(&status)) << endl;
+ ss << status;
+
+ struct serial_struct serinfo;
+ if (ioctl(portFd_, TIOCGSERIAL, &serinfo) < 0)
+ {
+ stringstream ss;
+ ss << "Serial::getStatusString(): error calling 'ioctl(portFd_, TIOCGSERIAL, &serinfo)': "<<strerror(errno);
+ throw SerialException( ss.str() );
+ }
+ ss << serinfo;
+
+ return ss.str();
+}
+
+
+void
+Serial::flush()
+{
+ int ret = tcflush(portFd_,TCIOFLUSH);
+ if ( ret < 0 )
+ {
+ throw SerialException( std::string("Serial::flush(): ")+strerror(errno) );
+ }
+}
+
+void
+Serial::drain()
+{
+ // wait till all output sent
+ if(tcdrain(portFd_))
+ {
+ throw SerialException( std::string("Serial::drain(): tcdrain: ")+strerror(errno) );
+ }
+}
+
+int
+Serial::write(const void *buf, int count)
+{
+ if ( debugLevel_ > 0 )
+ cout<<"TRACE(serial.cpp): write()" << endl;
+
+ if ( count == 0 )
+ throw SerialException( "Serial::write() was called with zero bytes" );
+
+ int put = ::write(portFd_, buf, count);
+ if ( put < 0 )
+ {
+ throw SerialException( string("Serial::write(): ")+strerror(errno) );
+ }
+ else if ( put == 0 )
+ {
+ throw SerialException( "Serial::write(): ::write() returned 0" );
+ }
+ if ( debugLevel_ > 1 )
+ {
+ cout<<"TRACE(serial.cpp): wrote " << put << " bytes: '";
+ for ( int i=0; i < count; i++ ) cout << ((char*)(buf))[i];
+ cout << "'" << endl;
+ }
+
+ return put;
+}
+
+} // namespace
Added: gearbox/trunk/submitted/gbxserialacfr/serial.h
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/serial.h (rev 0)
+++ gearbox/trunk/submitted/gbxserialacfr/serial.h 2008-02-16 06:25:16 UTC (rev 63)
@@ -0,0 +1,172 @@
+/*
+ * Orca-Robotics Project: Components for robotics
+ * http://orca-robotics.sf.net/
+ * Copyright (c) 2004-2008 Mathew Ridley, Alex Brooks
+ *
+ * This distribution is licensed to you under the terms described in
+ * the LICENSE file included in this distribution.
+ *
+ */
+#ifndef GBXSERIALACFR_SERIAL_H
+#define GBXSERIALACFR_SERIAL_H
+
+#include <termios.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#include <string>
+#include <gbxserialacfr/uncopyable.h>
+#include <gbxserialacfr/lockfile/lockfile.h>
+
+namespace gbxserialacfr {
+
+//!
+//! @brief Exception thrown by Serial.
+//!
+class SerialException : public std::exception
+{
+ std::string message_;
+public:
+ SerialException(const char *message)
+ : message_(message) {}
+ SerialException(const std::string &message)
+ : message_(message) {}
+ ~SerialException()throw(){}
+ virtual const char* what() const throw() { return message_.c_str(); }
+};
+
+//!
+//! @brief Encapsulates a serial port.
+//!
+//! This class hard-codes some options, such as:
+//! - 8 data bits
+//! - no handshaking
+//!
+//! Warning: this thing is _NOT_ thread-safe.
+//!
+//! @author Matthew Ridley, Alex Brooks
+//!
+class Serial : public Uncopyable
+{
+public:
+
+ //! Opens a device @ref dev.
+ //! Throws exceptions on error.
+ //! If useLockFile is set to true, Serial will use the file-system to
+ //! prevent concurrent access to a serial device by multiple instances of Serial.
+ Serial( const std::string &dev,
+ int baudRate,
+ bool enableTimeouts,
+ int debuglevel = 0,
+ bool useLockFile = true );
+
+ //! Destructor closes serial port
+ ~Serial();
+
+ //! turn on/off debug messages
+ void setDebugLevel( int debugLevel ) { debugLevel_ = debugLevel; }
+
+ //! Sets the baud rate. Flushes any data.
+ void setBaudRate(int baud);
+
+ //! Sets timeout (timeouts must be enabled)
+ void setTimeout(int sec, int usec);
+
+ //! Reads up to @ref count bytes into buffer @ref buf.
+ //! Returns the number of bytes read.
+ //! Will never return <0 -- throws exceptions instead.
+ //! If timeouts are not enabled, blocks till it gets something.
+ //! If timeouts are enabled, throws an exception if data isn't available.
+ int read(void *buf, int count);
+
+ //! Tries to read exactly @ref count bytes into @ref buf.
+ //! Returns the number of bytes read, or throws an exception.
+ //!
+ //! If timeouts are not enabled we might block forever, waiting for the number of bytes we want or an error.
+ //!
+ //! If timeouts are enabled we won't block more than the timeout specified.
+ //! Returns -1 if it timed out.
+ //! NOTE: The timeout applies for each individual read() call. We might have to make lots of them,
+ //! so the total time for which this function blocks might be longer than the specified timeout.
+ //!
+ int readFull(void *buf, int count);
+
+ //! Reads a line of data up to @ref count bytes-1 (including @ref termchar), terminated by @ref termchar.
+ //! Returns the number of bytes read.
+ //! After reading the line then the string will be NULL terminated.
+ //!
+ //! Example: if you expect to read the string "1234\n", you need something like:
+ //! char buf[6];
+ //! serial.readLine( buf, 6 );
+ //!
+ //! where the two extra characters are for the '\n' and the terminating '\0'.
+ //!
+ //! If timeouts are not enabled we might block forever, waiting for the number of bytes we want or an error.
+ //!
+ //! If timeouts are enabled we won't block more than the timeout specified.
+ //! Returns -1 if it timed out.
+ //! NOTE: The timeout applies for each individual read() call. We might have to make lots of them,
+ //! so the total time for which this function blocks might be longer than the specified timeout.
+ //!
+ int readLine(void *buf, int count, char termchar='\n');
+
+ //! Returns the number of bytes available for reading (non-blocking).
+ int bytesAvailable();
+
+ //! Returns the number of bytes available for reading. Waits according to the timeout.
+ //! Returns:
+ //! - <0 : timed out
+ //! - >0 : data ready
+ int bytesAvailableWait();
+
+ //! Writes some data. Returns the number of bytes written.
+ int write(const void *buf, int count);
+
+ //! Writes a ('\0'-terminated) string.
+ //! Returns the number of bytes written.
+ int writeString(const char *buf);
+ inline int writeString(const std::string &s) {
+ return writeString(s.c_str());
+ }
+
+ //! Flushs both input and output buffers.
+ //! This discards all data in buffers.
+ void flush();
+
+ //! Finishes transmission from output buffers and drains input buffers.
+ void drain();
+
+ //! This gives direct access to the file descriptor: be careful with this...
+ int fileDescriptor() { return portFd_; }
+
+ //! Print some diagnostic information about the current status of the port to cout.
+ std::string getStatusString();
+
+
+private:
+
+ // Utility function to wait up to the timeout for data to appear.
+ // Returns:
+ // TIMED_OUT: timed out
+ // GOT_DATA : data available
+ int waitForDataOrTimeout(void);
+
+ // Opens a device @ref dev.
+ void open(int flags=0);
+
+ // Won't throw exceptions.
+ void close();
+
+ const std::string dev_;
+ int portFd_;
+ int timeoutSec_;
+ int timeoutUSec_;
+ bool timeoutsEnabled_;
+
+ int debugLevel_;
+
+ lockfile::LockFile *lockFile_;
+};
+
+}
+
+#endif
Added: gearbox/trunk/submitted/gbxserialacfr/test/CMakeLists.txt
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/test/CMakeLists.txt (rev 0)
+++ gearbox/trunk/submitted/gbxserialacfr/test/CMakeLists.txt 2008-02-16 06:25:16 UTC (rev 63)
@@ -0,0 +1,7 @@
+INCLUDE( ${GBX_CMAKE_DIR}/UseBasicRules.cmake )
+
+LINK_LIBRARIES( GbxSerialAcfr )
+
+GBX_ADD_EXECUTABLE( serialechotest serialechotest.cpp )
+
+GBX_ADD_EXECUTABLE( serialloopbacktest serialloopbacktest.cpp )
Added: gearbox/trunk/submitted/gbxserialacfr/test/serialechotest.cpp
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/test/serialechotest.cpp (rev 0)
+++ gearbox/trunk/submitted/gbxserialacfr/test/serialechotest.cpp 2008-02-16 06:25:16 UTC (rev 63)
@@ -0,0 +1,66 @@
+#include <iostream>
+#include <gbxserialacfr/serial.h>
+#include <cstdlib>
+#include <string>
+#include <sstream>
+#include <vector>
+#include <iomanip>
+
+using namespace std;
+
+//
+// A simple utility program for testing serial ports.
+//
+
+std::string
+toHexString( const std::vector<unsigned char> &data )
+{
+ stringstream ss;
+ ss << "[ ";
+ for ( size_t i=0; i < data.size(); i++ )
+ {
+ ss <<hex<<std::setfill('0')<<std::setw(2)<<(int)(data[i])<<" ";
+ }
+ ss << "]";
+ return ss.str();
+}
+
+int main( int argc, char **argv )
+{
+ if ( argc < 3 )
+ {
+ cout << "USAGE: " << argv[0] << " <dev> <baudrate>" << endl;
+ exit(1);
+ }
+
+ const bool enableTimeouts = true;
+ gbxserialacfr::Serial serial( argv[1], atoi(argv[2]), enableTimeouts );
+ serial.setTimeout( 1, 0 );
+
+ std::vector<unsigned char> data;
+ while ( true )
+ {
+ cout<<"TRACE(serialechotest.cpp): Waiting for data..." << endl;
+ size_t nBytes = serial.bytesAvailableWait();
+
+ if ( nBytes > 0 )
+ {
+ cout<<"TRACE(serialechotest.cpp): nBytes: " << nBytes << endl;
+ if ( nBytes > data.size() )
+ {
+ cout<<"TRACE(serialechotest.cpp): resizing to " << nBytes << endl;
+ data.resize( nBytes );
+ }
+
+// cout<<"TRACE(serialechotest.cpp): data.size(): " << data.size() << endl;
+// cout<<"TRACE(serialechotest.cpp): &(data[0]): " << (int)(&(data[0])) << endl;
+// cout<<"TRACE(serialechotest.cpp): data[0]: " << (int)(data[0]) << endl;
+
+ serial.read( &(data[0]), nBytes );
+
+ cout << "got data: " << toHexString( data ) << endl;
+ }
+ }
+
+ return 0;
+}
Added: gearbox/trunk/submitted/gbxserialacfr/test/serialloopbacktest
===================================================================
(Binary files differ)
Property changes on: gearbox/trunk/submitted/gbxserialacfr/test/serialloopbacktest
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: gearbox/trunk/submitted/gbxserialacfr/test/serialloopbacktest.cpp
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/test/serialloopbacktest.cpp (rev 0)
+++ gearbox/trunk/submitted/gbxserialacfr/test/serialloopbacktest.cpp 2008-02-16 06:25:16 UTC (rev 63)
@@ -0,0 +1,87 @@
+#include <iostream>
+#include <gbxserialacfr/serial.h>
+#include <cstdlib>
+#include <cstring>
+#include <string>
+#include <sstream>
+#include <vector>
+#include <iomanip>
+
+using namespace std;
+
+//
+// A simple utility program for testing serial ports in loopback.
+//
+
+std::vector<std::string>
+getStringList()
+{
+ std::vector<std::string> stringList;
+
+ stringList.push_back( "string_one" );
+ stringList.push_back( "string_two" );
+ stringList.push_back( "string_three" );
+ stringList.push_back( "string_four" );
+ stringList.push_back( "" );
+ stringList.push_back( "testing" );
+ stringList.push_back( "asdfasdfasdfasdf" );
+
+ return stringList;
+}
+
+int main( int argc, char **argv )
+{
+ if ( argc < 3 )
+ {
+ cout << "USAGE: " << argv[0] << " <dev> <baudrate>" << endl;
+ exit(1);
+ }
+
+ const bool enableTimeouts = true;
+ gbxserialacfr::Serial serial( argv[1], atoi(argv[2]), enableTimeouts );
+ serial.setTimeout( 1, 0 );
+
+ const uint NUM_CHARS = 1000;
+ std::vector<std::string> stringList = getStringList();
+ for ( uint i=0; i < NUM_CHARS; i++ )
+ {
+ int stringI = i % (stringList.size());
+ std::string theString = stringList[stringI]+"\n";
+
+ serial.writeString( theString );
+
+ char buf[ theString.size()+1 ];
+ int ret = serial.readLine( buf, theString.size()+1 );
+ if ( ret < 0 )
+ {
+ cout << "ERROR(serialloopbacktest.cpp): Read timed out!" << endl;
+ int nBytes = serial.bytesAvailable();
+ cout<<"TRACE(serialloopbacktest.cpp): bytesAvailable: " << nBytes << endl;
+
+ if ( nBytes == 0 )
+ {
+ cout<<"TRACE(serialloopbacktest.cpp): Ensure that the serial port is looped-back" << endl;
+ cout<<"TRACE(serialloopbacktest.cpp): (ie pins 2 & 3 connected)" << endl;
+ }
+ exit(1);
+ }
+
+ if ( !strcmp( buf, theString.c_str() ) )
+ {
+ cout<<"Wrote and read: " << theString << endl;
+ }
+ else
+ {
+ cout << "ERROR(serialloopbacktest.cpp): Strings didn't match!!" << endl;
+ cout << "ERROR(serialloopbacktest.cpp): Wrote: '" << theString <<"'"<< endl;
+ cout << "ERROR(serialloopbacktest.cpp): Read: '" << buf <<"'"<< endl;
+
+ cout<<"TRACE(serialloopbacktest.cpp): test FAILED" << endl;
+ exit(1);
+ }
+ }
+
+ cout<<"TRACE(serialloopbacktest.cpp): test PASSED" << endl;
+
+ return 0;
+}
Added: gearbox/trunk/submitted/gbxserialacfr/uncopyable.h
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/uncopyable.h (rev 0)
+++ gearbox/trunk/submitted/gbxserialacfr/uncopyable.h 2008-02-16 06:25:16 UTC (rev 63)
@@ -0,0 +1,34 @@
+/*
+ * Orca-Robotics Project: Components for robotics
+ * http://orca-robotics.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 GBXSERIALACFR_UNCOPYABLE_H
+#define GBXSERIALACFR_UNCOPYABLE_H
+
+namespace gbxserialacfr {
+
+//
+// @brief Handy way to avoid unintended copies.
+
+// Inherit from this and the compiler will barf if you try to copy the derived class.
+//
+// @author Alex Brooks
+//
+class Uncopyable
+{
+public:
+ Uncopyable() {}
+private:
+ Uncopyable(const Uncopyable&);
+ void operator=(const Uncopyable&);
+};
+
+}
+
+#endif
Added: gearbox/trunk/submitted/gbxsickacfr/CMakeLists.txt
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/CMakeLists.txt (rev 0)
+++ gearbox/trunk/submitted/gbxsickacfr/CMakeLists.txt 2008-02-16 06:25:16 UTC (rev 63)
@@ -0,0 +1,41 @@
+SET ( lib_name GbxSickAcfr )
+GBX_ADD_LICENSE( LGPL )
+
+SET ( build TRUE )
+GBX_REQUIRE_OPTION( build LIB ${lib_name} ON )
+GBX_REQUIRE_VAR( build LIB ${lib_name} GBX_OS_LINUX "only Linux OS is supported" )
+
+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} )
+
+# these are built internally
+SET( int_libs GbxUtilAcfr GbxIceUtilAcfr GbxSerialDeviceAcfr )
+
+IF ( build )
+ # allow subdir's to include themselves and each other
+# INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR} )
+
+ ADD_SUBDIRECTORY( gbxutilacfr )
+ ADD_SUBDIRECTORY( gbxiceutilacfr )
+ ADD_SUBDIRECTORY( gbxserialdeviceacfr )
+
+ INCLUDE( ${GBX_CMAKE_DIR}/UseBasicRules.cmake )
+# INCLUDE( ${GBX_CMAKE_DIR}/UseIceUtil.cmake )
+
+ FILE( GLOB hdrs *.h )
+ FILE( GLOB srcs *.cpp )
+ SET( dep_libs ${proj_libs} ${int_libs} )
+
+ GBX_ADD_LIBRARY( ${lib_name} SHARED ${srcs} )
+ TARGET_LINK_LIBRARIES( ${lib_name} ${dep_libs} )
+
+ GBX_ADD_HEADERS( gbxsickacfr ${hdrs} )
+
+ IF ( GBX_BUILD_TESTS )
+ ADD_SUBDIRECTORY ( test )
+ ENDIF ( GBX_BUILD_TESTS )
+
+ENDIF ( build )
Added: gearbox/trunk/submitted/gbxsickacfr/doc.dox
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/doc.dox (rev 0)
+++ gearbox/trunk/submitted/gbxsickacfr/doc.dox 2008-02-16 06:25:16 UTC (rev 63)
@@ -0,0 +1,39 @@
+/*
+ * Orca-Robotics Project: Components for robotics
+ * http://orca-robotics.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 hydro_drivers_laserscanner2d
+@ingroup hydro_cpp
+@ingroup hydro_linux
+@defgroup hydro_driver_laserscanner2dsickacfr LaserScanner2dSickAcfr
+@brief ACFR driver for SICK laser range-finder.
+
+Drives SICK hardware, directly connected to the computer.
+
+@par Dependencies
+
+- libIceUtil (for timing)
+- libHydroSerial and libHydroSerialDevice
+
+@par Limitations
+
+- This is a Linux-only implementation.
+- It has not been tested at 500k baud.
+
+@par Extra configuration
+
+- @c SickAcfr.Device (string)
+ - The unix device to use
+ - Default: "/dev/ttyS0"
+- @c SickAcfr.Baudrate (int) [bps]
+ - Valid Values: { 9600, 19200, 38400, 500000 }
+ - Default: 38400
+
+*/
Added: gearbox/trunk/submitted/gbxsickacfr/driver.cpp
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/driver.cpp (rev 0)
+++ gearbox/trunk/submitted/gbxsickacfr/driver.cpp 2008-02-16 06:25:16 UTC (rev 63)
@@ -0,0 +1,583 @@
+/*
+ * Orca-Robotics Project: Components for robotics
+ * http://orca-robotics.sf.net/
+ * Copyright (c) 2004-2008 Alex Brooks
+ *
+ * This distribution is licensed to you under the terms described in
+ * the LICENSE file included in this distribution.
+ *
+ */
+
+#include <iostream>
+#include <cstring>
+
+#include <gbxsickacfr/gbxutilacfr/gbxutilacfr.h>
+#include <gbxsickacfr/gbxiceutilacfr/gbxiceutilacfr.h>
+#include "driver.h"
+
+using namespace std;
+
+namespace gbxsickacfr {
+
+namespace {
+
+ class NoResponseException : public std::exception
+ {
+ std::string message_;
+ public:
+ NoResponseException(const char *message)
+ : message_(message) {}
+ NoResponseException(const std::string &message)
+ : message_(message) ...
[truncated message content] |
|
From: <rus...@us...> - 2008-02-12 02:02:20
|
Revision: 62
http://gearbox.svn.sourceforge.net/gearbox/?rev=62&view=rev
Author: russo2503v
Date: 2008-02-11 18:02:21 -0800 (Mon, 11 Feb 2008)
Log Message:
-----------
disabled dashboard link for now
Modified Paths:
--------------
gearbox/trunk/doc/header.html
Modified: gearbox/trunk/doc/header.html
===================================================================
--- gearbox/trunk/doc/header.html 2008-02-11 12:03:24 UTC (rev 61)
+++ gearbox/trunk/doc/header.html 2008-02-12 02:02:21 UTC (rev 62)
@@ -58,7 +58,7 @@
<!--
<strong><a href="gbx_doc_faq.html" style="text-decoration:none">FAQ</a></strong><br>
-->
-<strong><a href="http://129.78.210.237:8081/gearbox/Dashboard/" style="text-decoration:none">Dashboard</a></strong><br>
+<!--<strong><a href="http://129.78.210.237:8081/gearbox/Dashboard/" style="text-decoration:none">Dashboard</a></strong><br>-->
<!--<strong><a href="http://wiki2.cas.edu.au/orca">Wiki</a></strong><br>
login/pass: orca/orca<br>-->
<br>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rus...@us...> - 2008-02-11 12:03:23
|
Revision: 61
http://gearbox.svn.sourceforge.net/gearbox/?rev=61&view=rev
Author: russo2503v
Date: 2008-02-11 04:03:24 -0800 (Mon, 11 Feb 2008)
Log Message:
-----------
named admins
Modified Paths:
--------------
gearbox/trunk/doc/contributors.dox
Modified: gearbox/trunk/doc/contributors.dox
===================================================================
--- gearbox/trunk/doc/contributors.dox 2008-02-10 07:12:57 UTC (rev 60)
+++ gearbox/trunk/doc/contributors.dox 2008-02-11 12:03:24 UTC (rev 61)
@@ -14,14 +14,13 @@
@par Project maintainers
-- TBD
+- <a href="http://staff.aist.go.jp/geoffrey.biggs/">Geoffrey Biggs</a>
+- <a href="http://www.cas.edu.au/content.php/232.html?personid=66">Alex Makarenko</a>
@par Current contributors
-- <a href="http://staff.aist.go.jp/geoffrey.biggs/">Geoffrey Biggs</a>
- <a href="http://www.cas.edu.au/content.php/232.html?personid=9">Alex Brooks</a>
- <a href="http://www.cas.edu.au/content.php/232.html?personid=45">Tobias Kaupp</a>
-- <a href="http://www.cas.edu.au/content.php/232.html?personid=66">Alex Makarenko</a>
- <a href="http://www.cas.edu.au/content.php/232.html?personid=69">Michael Moser</a>
@par Past contributors
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rus...@us...> - 2008-02-10 07:12:53
|
Revision: 60
http://gearbox.svn.sourceforge.net/gearbox/?rev=60&view=rev
Author: russo2503v
Date: 2008-02-09 23:12:57 -0800 (Sat, 09 Feb 2008)
Log Message:
-----------
fixed incorrect var name replacement
Modified Paths:
--------------
gearbox/trunk/submitted/CMakeLists.txt
Modified: gearbox/trunk/submitted/CMakeLists.txt
===================================================================
--- gearbox/trunk/submitted/CMakeLists.txt 2008-02-10 07:05:12 UTC (rev 59)
+++ gearbox/trunk/submitted/CMakeLists.txt 2008-02-10 07:12:57 UTC (rev 60)
@@ -10,4 +10,7 @@
# When adding new directories, please maintain order of inter-dependencies.
# Otherwise, maintain alphabetical order.
+# ADD_SUBDIRECTORY( gbxserialacfr )
+# ADD_SUBDIRECTORY( gbxsickacfr )
+
ENDIF ( GBX_BUILD_SUBMITTED )
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rus...@us...> - 2008-02-10 07:05:15
|
Revision: 59
http://gearbox.svn.sourceforge.net/gearbox/?rev=59&view=rev
Author: russo2503v
Date: 2008-02-09 23:05:12 -0800 (Sat, 09 Feb 2008)
Log Message:
-----------
removed / in the path
Modified Paths:
--------------
gearbox/trunk/cmake/internal/TargetUtils.cmake
Modified: gearbox/trunk/cmake/internal/TargetUtils.cmake
===================================================================
--- gearbox/trunk/cmake/internal/TargetUtils.cmake 2008-02-10 05:25:01 UTC (rev 58)
+++ gearbox/trunk/cmake/internal/TargetUtils.cmake 2008-02-10 07:05:12 UTC (rev 59)
@@ -5,7 +5,7 @@
#
MACRO( GBX_ADD_EXECUTABLE name )
ADD_EXECUTABLE( ${name} ${ARGN} )
- INSTALL( TARGETS ${name} RUNTIME DESTINATION bin/ )
+ INSTALL( TARGETS ${name} RUNTIME DESTINATION bin )
SET( templist ${COMPONENT_LIST} )
LIST ( APPEND templist ${name} )
# MESSAGE ( STATUS "DEBUG: ${templist}" )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rus...@us...> - 2008-02-10 05:24:57
|
Revision: 58
http://gearbox.svn.sourceforge.net/gearbox/?rev=58&view=rev
Author: russo2503v
Date: 2008-02-09 21:25:01 -0800 (Sat, 09 Feb 2008)
Log Message:
-----------
fixed comment
Modified Paths:
--------------
gearbox/trunk/src/basicexample/CMakeLists.txt
Modified: gearbox/trunk/src/basicexample/CMakeLists.txt
===================================================================
--- gearbox/trunk/src/basicexample/CMakeLists.txt 2008-02-10 04:43:57 UTC (rev 57)
+++ gearbox/trunk/src/basicexample/CMakeLists.txt 2008-02-10 05:25:01 UTC (rev 58)
@@ -15,7 +15,7 @@
GBX_ADD_HEADERS( basicexample ${hdrs} )
# the custom command above is equivalent to this
-# INSTALL( FILES ${hdrs} DESTINATION include/gearbox/basic )
+# INSTALL( FILES ${hdrs} DESTINATION include/gearbox/basicexample )
# IF ( GBX_BUILD_TESTS )
# ADD_SUBDIRECTORY ( test )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|