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

 

         

publisherthread.h

00001 #ifndef SEGWAYRMP_PUBLISHERTHREAD_H
00002 #define SEGWAYRMP_PUBLISHERTHREAD_H
00003 
00004 #include <orcaice/subsystemthread.h>
00005 #include <hydrointerfaces/segwayrmp.h>
00006 #include <gbxsickacfr/gbxiceutilacfr/store.h>
00007 #include <orcaifaceimpl/odometry2d.h>
00008 #include <orcaifaceimpl/odometry3d.h>
00009 #include <orcaifaceimpl/power.h>
00010 #include <hydroutil/history.h>
00011 #include "stats.h"
00012 
00013 namespace segwayrmp {
00014 
00015 //
00016 // @brief Responsible for publishing data over orca interfaces.
00017 //        We publish in a separate thread because:
00018 //          a) it avoids network-delays interacting with the driver thread, and
00019 //          b) it allows us to publish at a rate different from the at which rate data is generated.
00020 //
00021 // @author Alex Brooks
00022 //
00023 class PublisherThread : public orcaice::SubsystemThread
00024 {
00025 
00026 public:
00027 
00028     // intervals in seconds
00029     PublisherThread( double                                  odometry2dPublishInterval,
00030                      double                                  odometry3dPublishInterval,
00031                      double                                  powerPublishInterval,
00032                      const orcaifaceimpl::Odometry2dImplPtr &odometry2dI,
00033                      const orcaifaceimpl::Odometry3dImplPtr &odometry3dI,
00034                      const orcaifaceimpl::PowerImplPtr      &powerI,
00035                      gbxutilacfr::Tracer                    &tracer,
00036                      gbxutilacfr::Status                    &status,
00037                      hydroutil::History                     &history )
00038         : orcaice::SubsystemThread(tracer,status,"PublisherThread"),
00039           odometry2dPublishInterval_(odometry2dPublishInterval),
00040           odometry3dPublishInterval_(odometry3dPublishInterval),
00041           powerPublishInterval_(powerPublishInterval),
00042           odometry2dI_(odometry2dI),
00043           odometry3dI_(odometry3dI),
00044           powerI_(powerI),
00045           history_(history),
00046           hardwareInitNeedsReporting2d_(false),
00047           hardwareInitNeedsReporting3d_(false)
00048         {}
00049 
00050     // from SubsystemThread
00051     virtual void work();
00052     virtual void finalise();
00053 
00054     void publish( const hydrointerfaces::SegwayRmp::Data &data );
00055 
00056     void hardwareInitialised();
00057 
00058 private:
00059 
00060     double                            odometry2dPublishInterval_;
00061     double                            odometry3dPublishInterval_;
00062     double                            powerPublishInterval_;
00063 
00064     orcaifaceimpl::Odometry2dImplPtr  odometry2dI_;
00065     orcaifaceimpl::Odometry3dImplPtr  odometry3dI_;
00066     orcaifaceimpl::PowerImplPtr       powerI_;
00067 
00068     gbxiceutilacfr::Store<hydrointerfaces::SegwayRmp::Data> dataStore_;
00069 
00070     // Summarizes motion information
00071     Stats historyStats_;
00072     hydroutil::History &history_;
00073 
00074     bool hardwareInitNeedsReporting2d_;
00075     bool hardwareInitNeedsReporting3d_;
00076 };
00077 
00078 }
00079 
00080 #endif
 

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


Generated for Orca Robotics by  doxygen 1.4.5