|
From: <bo...@us...> - 2008-03-06 07:03:37
|
Revision: 97
http://gearbox.svn.sourceforge.net/gearbox/?rev=97&view=rev
Author: borax00
Date: 2008-03-05 23:03:36 -0800 (Wed, 05 Mar 2008)
Log Message:
-----------
Modified Paths:
--------------
gearbox/trunk/submitted/gbxsickacfr/driver.cpp
gearbox/trunk/submitted/gbxsickacfr/driver.h
gearbox/trunk/submitted/gbxsickacfr/test/test.cpp
Modified: gearbox/trunk/submitted/gbxsickacfr/driver.cpp
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/driver.cpp 2008-03-02 03:14:51 UTC (rev 96)
+++ gearbox/trunk/submitted/gbxsickacfr/driver.cpp 2008-03-06 07:03:36 UTC (rev 97)
@@ -70,9 +70,16 @@
}
bool
-Config::validate() const
+Config::isValid() const
{
- // Don't bother verifying baudRate or device, the user will find out soon enough when the Driver bitches.
+ // Don't bother verifying device, the user will find out soon enough when the Driver bitches.
+ if ( !( baudRate == 9600 ||
+ baudRate == 19200 ||
+ baudRate == 38400 ||
+ baudRate == 500000 ) )
+ {
+ return false;
+ }
if ( minRange < 0.0 ) return false;
if ( maxRange <= 0.0 ) return false;
if ( fieldOfView <= 0.0 || fieldOfView > DEG2RAD(360.0) ) return false;
@@ -111,6 +118,13 @@
tracer_(tracer),
status_(status)
{
+ if ( !config.isValid() )
+ {
+ stringstream ss;
+ ss << __func__ << "(): Invalid config: " << config.toString();
+ throw gbxutilacfr::Exception( ERROR_INFO, ss.str() );
+ }
+
stringstream ssDebug;
ssDebug << "Connecting to laser on serial port " << config_.device;
tracer_.debug( ssDebug.str() );
Modified: gearbox/trunk/submitted/gbxsickacfr/driver.h
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/driver.h 2008-03-02 03:14:51 UTC (rev 96)
+++ gearbox/trunk/submitted/gbxsickacfr/driver.h 2008-03-06 07:03:36 UTC (rev 97)
@@ -23,7 +23,7 @@
{
public:
Config();
- bool validate() const;
+ bool isValid() const;
std::string toString() const;
bool operator==( const Config & other );
bool operator!=( const Config & other );
Modified: gearbox/trunk/submitted/gbxsickacfr/test/test.cpp
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/test/test.cpp 2008-03-02 03:14:51 UTC (rev 96)
+++ gearbox/trunk/submitted/gbxsickacfr/test/test.cpp 2008-03-06 07:03:36 UTC (rev 97)
@@ -46,7 +46,7 @@
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;
+ << "-b baud\tBaud rate to connect at (9600, 19200, 38400, oro 500000)." << endl;
return 1;
}
}
@@ -60,8 +60,9 @@
config.numberOfSamples = 181;
config.baudRate = baud;
config.device = port;
- if ( !config.validate() ) {
+ if ( !config.isValid() ) {
cout << "Test: Invalid laser configuration: " << config.toString() << endl;
+ exit(1);
}
cout << "Using configuration: " << config.toString() << endl;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|