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

 

         

powerbasemanager.h

00001 #ifndef HYDRORMPUTIL_POWERBASEMANAGER_H
00002 #define HYDRORMPUTIL_POWERBASEMANAGER_H
00003 
00004 #include <hydrormputil/driverthread.h>
00005 #include <memory>
00006 #include <boost/shared_ptr.hpp>
00007 
00008 namespace hydrormputil {
00009 
00010 //
00011 // @brief Aggregates information about multiple powerbases, to give
00012 //        the impression of a single robot.
00013 //
00014 class AggregatorCallback {
00015 public:
00016     virtual ~AggregatorCallback() {}
00017     
00018     virtual void hardwareInitialised( int powerbaseID )=0;
00019     virtual void receiveData( int                                     powerbaseID,
00020                               const hydrointerfaces::SegwayRmp::Data &data )=0;
00021     
00022 };
00023 
00024 //
00025 // @brief Manages a single power-base (an RMP-style vehicle may be made up of multiple (e.g. the RMP400 has two)
00026 //
00027 // @author Alex Brooks
00028 //
00029 class PowerbaseManager : public hydrormputil::Callback
00030 {
00031 public: 
00032 
00033     PowerbaseManager( const std::string                         &name,
00034                       int                                        powerbaseID,
00035                       AggregatorCallback                        &aggregatorCallback,
00036                       std::auto_ptr<hydrointerfaces::SegwayRmp> &hydroDriver,
00037                       const hydroutil::Context                  &context );
00038     ~PowerbaseManager();
00039 
00040     hydrointerfaces::SegwayRmp::Capabilities capabilities() const
00041         { return hydroDriver_->capabilities(); }
00042 
00043     void init( const hydrormputil::DriverThread::Config &cfg );
00044     void startThread();
00045 
00046     const std::string &name() const { return name_; }
00047 
00048     void setDesiredSpeed( const hydrointerfaces::SegwayRmp::Command &cmd );
00049 
00050     // from hydrormputil::Callback
00051     void hardwareInitialised()
00052         { aggregatorCallback_.hardwareInitialised( powerbaseID_ ); }
00053     void receiveData( const hydrointerfaces::SegwayRmp::Data &data,
00054                       hydrormputil::StallType                  stallType )
00055         { 
00056             stallType_ = stallType;
00057             aggregatorCallback_.receiveData( powerbaseID_, data ); 
00058         }
00059 
00060     hydrormputil::StallType stallType() const { return stallType_; }
00061 
00062 private: 
00063 
00064     hydrormputil::DriverThread *segwayRmpDriverThread_;
00065     gbxiceutilacfr::ThreadPtr segwayRmpDriverThreadPtr_;
00066 
00067     // Generic hydro driver for the hardware
00068     std::auto_ptr<hydrointerfaces::SegwayRmp> hydroDriver_;
00069 
00070     const std::string name_;
00071     const int         powerbaseID_;
00072 
00073     AggregatorCallback &aggregatorCallback_;
00074 
00075     hydrormputil::StallType stallType_;
00076 
00077     hydroutil::Context context_;
00078 };
00079 typedef boost::shared_ptr<PowerbaseManager> PowerbaseManagerPtr;
00080 
00081 }
00082 
00083 #endif
 

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


Generated for Orca Robotics by  doxygen 1.4.5