INTRODUCTION
Overview
Download and Install
Quick Start
Documentation
Publications

NONFRAMEWORK CODE
Driver Interfaces
Drivers
Libraries
Utilities

FRAMEWORK CODE
Interfaces
Components
Libraries
Utilities

Full Software Listings

DEVELOPER
Tutorials
Examples
Dev Guide
Dashboard

PEOPLE
Contributors
Users

SourceForge.net Logo
Project
Download
Mailing lists

 

         

autologgers.h

00001 #ifndef ORCALOGFACTORY_AUTOLOGGERS_H
00002 #define ORCALOGFACTORY_AUTOLOGGERS_H
00003 
00004 #include <orcalog/autologger.h>
00005 #include <orcalogfactory/logwriters.h>
00006 #include <orcaifaceimpl/pathfollower2d.h>
00007 
00008 namespace orcalogfactory {
00009 
00010 //
00011 // A set of AutoLoggers: ie loggers which run continuously as soon as they're
00012 //                       initialised
00013 //
00014 
00016 
00017 typedef orcalog::GenericAutoLogger<orca::Cpu, orca::CpuConsumer,
00018                                    orca::CpuData,
00019                                    CpuLogWriter> CpuAutoLogger;
00020 
00022 
00023 class DriveBicycleAutoLogger : public orcalog::GenericAutoLogger<orca::DriveBicycle, orca::DriveBicycleConsumer,
00024                                                                  orca::DriveBicycleData,
00025                                                                  DriveBicycleLogWriter>
00026 {
00027 public:
00028     DriveBicycleAutoLogger( const orcaice::Context &context ) :
00029         orcalog::GenericAutoLogger<orca::DriveBicycle, orca::DriveBicycleConsumer,
00030                           orca::DriveBicycleData,
00031                           DriveBicycleLogWriter>( context ) {};
00032 private:
00033     void setupEvent( orca::DriveBicyclePrx &providerPrx, DriveBicycleLogWriter &logWriter )
00034         {
00035             logWriter.write( providerPrx->getDescription() );
00036         }
00037 };
00038 
00040 
00041 typedef orcalog::GenericAutoLogger<orca::Imu, orca::ImuConsumer,
00042                           orca::ImuData,
00043                           ImuLogWriter> ImuAutoLogger;
00044 
00046 
00047 class Localise2dAutoLogger : public orcalog::GenericAutoLogger<orca::Localise2d, orca::Localise2dConsumer,
00048                                                                orca::Localise2dData,
00049                                                                Localise2dLogWriter>
00050 {
00051 public:
00052     Localise2dAutoLogger( const orcaice::Context &context ) :
00053         orcalog::GenericAutoLogger<orca::Localise2d, orca::Localise2dConsumer,
00054                           orca::Localise2dData,
00055                           Localise2dLogWriter>( context ) {};
00056 private:
00057     void setupEvent( orca::Localise2dPrx &providerPrx, Localise2dLogWriter &logWriter )
00058         {
00059             logWriter.write( providerPrx->getDescription() );
00060         }
00061 };
00062 
00064 
00065 class Localise3dAutoLogger : public orcalog::GenericAutoLogger<orca::Localise3d, orca::Localise3dConsumer,
00066                                                                orca::Localise3dData,
00067                                                                Localise3dLogWriter>
00068 {
00069 public:
00070     Localise3dAutoLogger( const orcaice::Context &context ) :
00071         orcalog::GenericAutoLogger<orca::Localise3d, orca::Localise3dConsumer,
00072                           orca::Localise3dData,
00073                           Localise3dLogWriter>( context ) {};
00074 private:
00075     void setupEvent( orca::Localise3dPrx &providerPrx, Localise3dLogWriter &logWriter )
00076         {
00077             logWriter.write( providerPrx->getDescription() );
00078         }
00079 };
00080 
00082 
00083 class Odometry2dAutoLogger : public orcalog::GenericAutoLogger<orca::Odometry2d, orca::Odometry2dConsumer,
00084                                                                orca::Odometry2dData,
00085                                                                Odometry2dLogWriter>
00086 {
00087 public:
00088     Odometry2dAutoLogger( const orcaice::Context &context ) :
00089         orcalog::GenericAutoLogger<orca::Odometry2d, orca::Odometry2dConsumer,
00090                           orca::Odometry2dData,
00091                           Odometry2dLogWriter>( context ) {};
00092 private:
00093     void setupEvent( orca::Odometry2dPrx &providerPrx, Odometry2dLogWriter &logWriter )
00094         {
00095             logWriter.write( providerPrx->getDescription() );
00096         }
00097 };
00098 
00100 
00101 class Odometry3dAutoLogger : public orcalog::GenericAutoLogger<orca::Odometry3d, orca::Odometry3dConsumer,
00102                                                                orca::Odometry3dData,
00103                                                                Odometry3dLogWriter>
00104 {
00105 public:
00106     Odometry3dAutoLogger( const orcaice::Context &context ) :
00107         orcalog::GenericAutoLogger<orca::Odometry3d, orca::Odometry3dConsumer,
00108                         orca::Odometry3dData,
00109                         Odometry3dLogWriter>( context ) {};
00110 private:
00111     void setupEvent( orca::Odometry3dPrx &providerPrx, Odometry3dLogWriter &logWriter )
00112         {
00113             logWriter.write( providerPrx->getDescription() );
00114         }
00115 };
00116 
00118 
00119 typedef orcalog::GenericAutoLogger<orca::PolarFeature2d, orca::PolarFeature2dConsumer,
00120                                    orca::PolarFeature2dData,
00121                                    PolarFeature2dLogWriter> PolarFeature2dAutoLogger;
00122 
00124 
00125 typedef orcalog::GenericAutoLogger<orca::Power, orca::PowerConsumer,
00126                           orca::PowerData,
00127                           PowerLogWriter> PowerAutoLogger;
00128 
00130 
00131 typedef orcalog::GenericAutoLogger<orca::Wifi, orca::WifiConsumer,
00132                                    orca::WifiData,
00133                                    WifiLogWriter> WifiAutoLogger;
00134 
00136 
00137 class GpsAutoLogger : public orcalog::GenericAutoLogger<orca::Gps, orca::GpsConsumer,
00138                                               orca::GpsData,
00139                                               GpsLogWriter>
00140 {
00141 public:
00142     GpsAutoLogger( const orcaice::Context &context ) :
00143         orcalog::GenericAutoLogger<orca::Gps, orca::GpsConsumer,
00144                                    orca::GpsData,
00145                                    GpsLogWriter>( context ) {};
00146 private:
00147     void setupEvent( orca::GpsPrx &providerPrx, GpsLogWriter &logWriter )
00148         {
00149             logWriter.write( providerPrx->getDescription() );
00150         }
00151 };
00152 
00154 
00155 class ImageAutoLogger : public orcalog::GenericAutoLogger<orca::Image, orca::ImageConsumer,
00156                                                 orca::ImageDataPtr,
00157                                                 ImageLogWriter>
00158 {
00159 public:
00160     ImageAutoLogger( const orcaice::Context &context ) :
00161         orcalog::GenericAutoLogger<orca::Image, orca::ImageConsumer,
00162                                    orca::ImageDataPtr,
00163                                    ImageLogWriter>( context ) {};
00164 private:
00165     void setupEvent( orca::ImagePrx &providerPrx, ImageLogWriter &logWriter )
00166         {
00167             logWriter.write( providerPrx->getDescription() );
00168         }
00169 };
00170 
00172 
00173 class  MultiCameraAutoLogger : public orcalog::GenericAutoLogger<orca::MultiCamera,
00174                                                             orca:: MultiCameraConsumer,
00175                                                             orca::MultiCameraDataPtr,
00176                                                             MultiCameraLogWriter>
00177 {
00178 public:
00179 
00180     MultiCameraAutoLogger(const orcaice::Context &context) :
00181             orcalog::GenericAutoLogger<orca::MultiCamera, orca::MultiCameraConsumer,
00182                         orca::MultiCameraDataPtr,
00183                         MultiCameraLogWriter>(context) {};
00184     private:
00185         void setupEvent(orca::MultiCameraPrx &providerPrx, MultiCameraLogWriter &logWriter)
00186         {
00187             // MultiCameraWriter needs to know properties of the data in order to set up properly
00188             logWriter.initMultiCameraWriter(providerPrx->getDescription());
00189             logWriter.write(providerPrx->getDescription());
00190         }
00191 };
00192 
00193 
00195 // the following do not use the generic template because their data
00196 // types are classes and not structs
00198 
00199 class LaserScanner2dAutoLogger :
00200       public orcaifaceimpl::ConsumerImpl<orca::RangeScanner2d, orca::RangeScanner2dConsumer,
00201                           orca::RangeScanner2dDataPtr>, 
00202       public orcalog::AutoLogger
00203 {
00204 public:
00205     LaserScanner2dAutoLogger( const orcaice::Context &context );
00206 
00207     virtual void dataEvent( const orca::RangeScanner2dDataPtr& data );
00208 
00209     virtual void init( const orcalog::LogWriterInfo &logWriterInfo, 
00210                         orcalog::MasterFileWriter    &masterFileWriter );
00211     virtual void startLogging();
00212 
00213 private:
00214     std::auto_ptr<LaserScanner2dLogWriter> logWriter_;
00215 };
00216 
00217 class RangeScanner2dAutoLogger :
00218       public orcaifaceimpl::ConsumerImpl<orca::RangeScanner2d, orca::RangeScanner2dConsumer,
00219                           orca::RangeScanner2dDataPtr>, 
00220       public orcalog::AutoLogger
00221 {
00222 public:
00223     RangeScanner2dAutoLogger( const orcaice::Context &context );
00224 
00225     virtual void dataEvent( const orca::RangeScanner2dDataPtr& data );
00226 
00227     virtual void init( const orcalog::LogWriterInfo &logWriterInfo, 
00228                         orcalog::MasterFileWriter    &masterFileWriter );
00229     virtual void startLogging();
00230 
00231 private:
00232     std::auto_ptr<RangeScanner2dLogWriter> logWriter_;
00233 };
00234 
00236 
00237 class CameraAutoLogger : 
00238       public orcaifaceimpl::ConsumerImpl<orca::Image, orca::ImageConsumer, orca::ImageDataPtr>,
00239       public orcalog::AutoLogger
00240 {
00241 public:    
00242     CameraAutoLogger( const orcaice::Context &context );
00243 
00244     virtual void dataEvent( const orca::ImageDataPtr& data );
00245     virtual void init( const orcalog::LogWriterInfo &logWriterInfo, 
00246                         orcalog::MasterFileWriter    &masterFileWriter );
00247     virtual void startLogging();
00248 
00249 private:
00250     std::auto_ptr<CameraLogWriter> logWriter_;
00251 };
00252 
00254 
00255 typedef orcaifaceimpl::ConsumerImpl<orca::PathFollower2d,
00256                                     orca::PathFollower2dConsumer,
00257                                     orca::PathFollower2dData,
00258                                     orcaifaceimpl::PathFollower2dConsumerTypeI> PathFollower2dConsumerImpl;
00259 
00260 class PathFollower2dAutoLogger : public orcalog::AutoLogger,
00261                                  public PathFollower2dConsumerImpl
00262 {
00263 public:
00264     PathFollower2dAutoLogger( const orcaice::Context &context )
00265         : PathFollower2dConsumerImpl( context )
00266         {}
00267 
00268     void dataEvent( const orca::PathFollower2dData &data )
00269         {
00270             logWriter_->write( data, orcaice::getNow() );
00271         }
00272 
00274     // BEGIN cut-and-paste-and-modify from GenericAutoLogger
00276     // Inherited from orcalog::AutoLogger
00277     virtual void init( const orcalog::LogWriterInfo &logWriterInfo,
00278                        orcalog::MasterFileWriter    &masterFileWriter )
00279     {
00280         logWriter_.reset( new PathFollower2dLogWriter );
00281         logWriter_->checkFormat( logWriterInfo.format );
00282         logWriter_->init( logWriterInfo, masterFileWriter );
00283     }
00284 
00285     virtual void startLogging()
00286     {
00287         // may throw
00288         //orca::PathFollower2dPrx providerPrx;
00289         //orcaice::connectToInterfaceWithTag<orca::PathFollower2dPrx>( 
00290         //        context_, 
00291         //        providerPrx,
00292         //        logWriter_->logWriterInfo().interfaceTag );
00293 
00294         // Allow derived classes to do something special (like get description)
00295         // setupEvent( providerPrx, *logWriter_ );
00296 
00297         subscribeWithTag( logWriter_->logWriterInfo().interfaceTag );
00298     }
00300     // END cut-and-paste-and-modify from GenericAutoLogger
00302 private:
00303 
00304     std::auto_ptr<PathFollower2dLogWriter> logWriter_;
00305 };
00306 
00307 }
00308 
00309 #endif
 

Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)


Generated for Orca Robotics by  doxygen 1.4.5