|
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.
|