/home/fwph/code/wurde/rde/core/capabilities/PTUnit.H

Go to the documentation of this file.
00001 
00030 #ifndef _PTUNIT_H
00031 #define _PTUNIT_H
00032 #include <WritableType.H>
00033 #include <Capability.H>
00034 #include <COMObject.H>
00035 #include <queue>
00036 #include <vector>
00037 
00038 // $Id: Type.H 66 2007-01-23 20:53:23Z fwph $
00039 
00040 #define PTUNIT "PTUnit"
00041 // IDNUMBER is used to identify data events . IDNUMBER+1 is the info event. this
00042 // system will probably go away soon...
00043 //#define PTUNITIDNUMBER 28
00044 
00045 namespace WURDE {
00046         class Capability;
00047         class CommsManager;
00048         class Logger;
00049 
00050         
00051 
00052         
00053         class PTUnitInfoStruct {
00054         public:         std::string source;
00055                 Writable< float  > pan_upper;
00056                 Writable< float  > pan_accel;
00057                 Writable< float  > tilt_accel;
00058                 Writable< float  > tilt;
00059                 Writable< float  > pan;
00060                 MessageType mType;
00061                 Writable< float  > tilt_upper;
00062                 std::string target;
00063                 Time timestamp;
00064                 Writable< float  > tilt_vel;
00065                 Writable< float  > pan_vel;
00066         };
00067 
00068         
00069         class PTUnitDataStruct {
00070         public:         std::string source;
00071                 Time timestamp;
00072         };
00073   
00079         class PTUnit : virtual public Capability {
00080 
00081         public:
00087                explicit PTUnit(const std::string & streamname);        
00088 
00094                PTUnit(const ConnectionStrategy & strategy,const std::string & gblName);
00095 
00101                PTUnit(const std::string & streamname,const std::string & gblName);
00102                
00103                ~PTUnit();
00104 
00105 
00109                void init(const std::string & streamname,const ConnectionStrategy & strategy, const std::string & gblName);
00110 
00111                
00116                PTUnitDataStruct data;    
00117                
00121                PTUnitInfoStruct info;
00122                
00126                PTUnitInfoStruct requests;
00127                
00128                //RobotObject imps
00129                void runUpdate();
00130                void setManager(CommsManager *myManager_);
00131                void setCOMObject(COMBase *object){ myCOMObject = dynamic_cast<COMObject<PTUnitInfoStruct,PTUnitDataStruct> *> (object);}
00132                void disconnect(){if(myCOMObject){myCOMObject->disconnect();}}
00133                void activateSupplier();
00134                void activateConsumer();
00135                std::string getInterfaceName(){ return PTUNIT;}
00136                void setStreamName(const std::string & name);
00137                void setGlobalName(const std::string & name);
00138                bool newData();
00139                bool newInfo();
00140                void setAutoPing(const bool & val);
00141                void doPing();
00142                //              int getID(){return PTUNITIDNUMBER;}
00143 
00147                bool getQueueMode(){return m_queue;};
00148 
00152                void setQueueMode(const bool & val);
00153                
00158                PTUnitDataStruct getNextData();
00159                
00164                PTUnitInfoStruct getNextInfo();
00165 
00169                PTUnitInfoStruct getNextRequest(){return getNextInfo();}
00170 
00171                void publishData();
00172                void publishInfo();
00173                //void publishRequest();
00174                
00175         protected:
00176                COMObject<PTUnitInfoStruct, PTUnitDataStruct> *myCOMObject;
00177 
00178                bool m_queue;
00179 
00180                //notes that the object should be initialized as soon as a streamname is received
00181                bool m_initialize;
00182                std::queue<PTUnitDataStruct> m_dataVector;
00183                std::queue<PTUnitInfoStruct> m_infoVector;
00184                std::queue<PTUnitInfoStruct> m_requestVector;
00185         
00186         };
00187 
00188 }
00189 
00190 
00191 #endif

Generated on Thu Feb 1 15:31:53 2007 for WURDE by  doxygen 1.5.1