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

Go to the documentation of this file.
00001 
00030 #ifndef _EGOMOTION_H
00031 #define _EGOMOTION_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 EGOMOTION "Egomotion"
00041 // IDNUMBER is used to identify data events . IDNUMBER+1 is the info event. this
00042 // system will probably go away soon...
00043 //#define EGOMOTIONIDNUMBER 4
00044 
00045 namespace WURDE {
00046         class Capability;
00047         class CommsManager;
00048         class Logger;
00049 
00050         
00051 
00052         
00053         class EgomotionInfoStruct {
00054         public:         std::string source;
00055                 std::string target;
00056                 Time timestamp;
00057                 MessageType mType;
00058         };
00059 
00060         
00061         class EgomotionDataStruct {
00062         public:         float angularVelocity;
00063                 std::string source;
00064                 float angularAccel;
00065                 float transAccel;
00066                 Pose location;
00067                 Time timestamp;
00068                 float transVelocity;
00069         };
00070   
00076         class Egomotion : virtual public Capability {
00077 
00078         public:
00084                explicit Egomotion(const std::string & streamname);             
00085 
00091                Egomotion(const ConnectionStrategy & strategy,const std::string & gblName);
00092 
00098                Egomotion(const std::string & streamname,const std::string & gblName);
00099                
00100                ~Egomotion();
00101 
00102 
00106                void init(const std::string & streamname,const ConnectionStrategy & strategy, const std::string & gblName);
00107 
00108                
00113                EgomotionDataStruct data;    
00114                
00118                EgomotionInfoStruct info;
00119                
00123                EgomotionInfoStruct requests;
00124                
00125                //RobotObject imps
00126                void runUpdate();
00127                void setManager(CommsManager *myManager_);
00128                void setCOMObject(COMBase *object){ myCOMObject = dynamic_cast<COMObject<EgomotionInfoStruct,EgomotionDataStruct> *> (object);}
00129                void disconnect(){if(myCOMObject){myCOMObject->disconnect();}}
00130                void activateSupplier();
00131                void activateConsumer();
00132                std::string getInterfaceName(){ return EGOMOTION;}
00133                void setStreamName(const std::string & name);
00134                void setGlobalName(const std::string & name);
00135                bool newData();
00136                bool newInfo();
00137                void setAutoPing(const bool & val);
00138                void doPing();
00139                //              int getID(){return EGOMOTIONIDNUMBER;}
00140 
00144                bool getQueueMode(){return m_queue;};
00145 
00149                void setQueueMode(const bool & val);
00150                
00155                EgomotionDataStruct getNextData();
00156                
00161                EgomotionInfoStruct getNextInfo();
00162 
00166                EgomotionInfoStruct getNextRequest(){return getNextInfo();}
00167 
00168                void publishData();
00169                void publishInfo();
00170                //void publishRequest();
00171                
00172         protected:
00173                COMObject<EgomotionInfoStruct, EgomotionDataStruct> *myCOMObject;
00174 
00175                bool m_queue;
00176 
00177                //notes that the object should be initialized as soon as a streamname is received
00178                bool m_initialize;
00179                std::queue<EgomotionDataStruct> m_dataVector;
00180                std::queue<EgomotionInfoStruct> m_infoVector;
00181                std::queue<EgomotionInfoStruct> m_requestVector;
00182         
00183         };
00184 
00185 }
00186 
00187 
00188 #endif

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