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

Go to the documentation of this file.
00001 
00030 #ifndef _ROBOTDRIVE_H
00031 #define _ROBOTDRIVE_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 ROBOTDRIVE "RobotDrive"
00041 // IDNUMBER is used to identify data events . IDNUMBER+1 is the info event. this
00042 // system will probably go away soon...
00043 //#define ROBOTDRIVEIDNUMBER 32
00044 
00045 namespace WURDE {
00046         class Capability;
00047         class CommsManager;
00048         class Logger;
00049 
00050         
00051 
00052         
00053         class RobotDriveInfoStruct {
00054         public:         std::string source;
00055                 Writable< float  > angularAccel;
00056                 Writable< float  > transAccel;
00057                 Writable< float  > angularLimit;
00058                 Writable< float  > angular;
00059                 MessageType mType;
00060                 Writable< float  > angularDecel;
00061                 Writable< float  > trans;
00062                 std::string target;
00063                 Writable< float  > transDecel;
00064                 Time timestamp;
00065                 Writable< bool  > brake;
00066                 Writable< float  > transLimit;
00067         };
00068 
00069         
00070         class RobotDriveDataStruct {
00071         public:         std::string source;
00072                 Time timestamp;
00073         };
00074   
00080         class RobotDrive : virtual public Capability {
00081 
00082         public:
00088                explicit RobotDrive(const std::string & streamname);            
00089 
00095                RobotDrive(const ConnectionStrategy & strategy,const std::string & gblName);
00096 
00102                RobotDrive(const std::string & streamname,const std::string & gblName);
00103                
00104                ~RobotDrive();
00105 
00106 
00110                void init(const std::string & streamname,const ConnectionStrategy & strategy, const std::string & gblName);
00111 
00112                
00117                RobotDriveDataStruct data;    
00118                
00122                RobotDriveInfoStruct info;
00123                
00127                RobotDriveInfoStruct requests;
00128                
00129                //RobotObject imps
00130                void runUpdate();
00131                void setManager(CommsManager *myManager_);
00132                void setCOMObject(COMBase *object){ myCOMObject = dynamic_cast<COMObject<RobotDriveInfoStruct,RobotDriveDataStruct> *> (object);}
00133                void disconnect(){if(myCOMObject){myCOMObject->disconnect();}}
00134                void activateSupplier();
00135                void activateConsumer();
00136                std::string getInterfaceName(){ return ROBOTDRIVE;}
00137                void setStreamName(const std::string & name);
00138                void setGlobalName(const std::string & name);
00139                bool newData();
00140                bool newInfo();
00141                void setAutoPing(const bool & val);
00142                void doPing();
00143                //              int getID(){return ROBOTDRIVEIDNUMBER;}
00144 
00148                bool getQueueMode(){return m_queue;};
00149 
00153                void setQueueMode(const bool & val);
00154                
00159                RobotDriveDataStruct getNextData();
00160                
00165                RobotDriveInfoStruct getNextInfo();
00166 
00170                RobotDriveInfoStruct getNextRequest(){return getNextInfo();}
00171 
00172                void publishData();
00173                void publishInfo();
00174                //void publishRequest();
00175                
00176         protected:
00177                COMObject<RobotDriveInfoStruct, RobotDriveDataStruct> *myCOMObject;
00178 
00179                bool m_queue;
00180 
00181                //notes that the object should be initialized as soon as a streamname is received
00182                bool m_initialize;
00183                std::queue<RobotDriveDataStruct> m_dataVector;
00184                std::queue<RobotDriveInfoStruct> m_infoVector;
00185                std::queue<RobotDriveInfoStruct> m_requestVector;
00186         
00187         };
00188 
00189 }
00190 
00191 
00192 #endif

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