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

Go to the documentation of this file.
00001 
00030 #ifndef _RANGEFINDER_H
00031 #define _RANGEFINDER_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 RANGEFINDER "RangeFinder"
00041 // IDNUMBER is used to identify data events . IDNUMBER+1 is the info event. this
00042 // system will probably go away soon...
00043 //#define RANGEFINDERIDNUMBER 30
00044 
00045 namespace WURDE {
00046         class Capability;
00047         class CommsManager;
00048         class Logger;
00049 
00050         
00051 
00052         
00053         class RangeFinderInfoStruct {
00054         public:         Writable< float  > x_offset;
00055                 std::string source;
00056                 Writable< float  > max_range;
00057                 Writable< float  > y_offset;
00058                 Writable< float  > phi_separation;
00059                 std::string target;
00060                 Writable< float  > psi_offset;
00061                 Time timestamp;
00062                 Writable< float  > x_separation;
00063                 Writable< float  > phi_offset;
00064                 Writable< float  > theta_separation;
00065                 Writable< float  > half_angle;
00066                 Writable< float  > psi_separation;
00067                 Writable< float  > y_separation;
00068                 Writable< std::vector< Pose3D > > sensor_positions;
00069                 MessageType mType;
00070                 Writable< bool  > uniform;
00071                 Writable< float  > z_separation;
00072                 Writable< float  > theta_offset;
00073                 Writable< float  > z_offset;
00074                 Writable< float  > angle_min;
00075         };
00076 
00077         
00078         class RangeFinderDataStruct {
00079         public:         std::string source;
00080                 std::vector< double > ranges;
00081                 Time timestamp;
00082         };
00083   
00089         class RangeFinder : virtual public Capability {
00090 
00091         public:
00097                explicit RangeFinder(const std::string & streamname);           
00098 
00104                RangeFinder(const ConnectionStrategy & strategy,const std::string & gblName);
00105 
00111                RangeFinder(const std::string & streamname,const std::string & gblName);
00112                
00113                ~RangeFinder();
00114 
00115 
00119                void init(const std::string & streamname,const ConnectionStrategy & strategy, const std::string & gblName);
00120 
00121                
00126                RangeFinderDataStruct data;    
00127                
00131                RangeFinderInfoStruct info;
00132                
00136                RangeFinderInfoStruct requests;
00137                
00138                //RobotObject imps
00139                void runUpdate();
00140                void setManager(CommsManager *myManager_);
00141                void setCOMObject(COMBase *object){ myCOMObject = dynamic_cast<COMObject<RangeFinderInfoStruct,RangeFinderDataStruct> *> (object);}
00142                void disconnect(){if(myCOMObject){myCOMObject->disconnect();}}
00143                void activateSupplier();
00144                void activateConsumer();
00145                std::string getInterfaceName(){ return RANGEFINDER;}
00146                void setStreamName(const std::string & name);
00147                void setGlobalName(const std::string & name);
00148                bool newData();
00149                bool newInfo();
00150                void setAutoPing(const bool & val);
00151                void doPing();
00152                //              int getID(){return RANGEFINDERIDNUMBER;}
00153 
00157                bool getQueueMode(){return m_queue;};
00158 
00162                void setQueueMode(const bool & val);
00163                
00168                RangeFinderDataStruct getNextData();
00169                
00174                RangeFinderInfoStruct getNextInfo();
00175 
00179                RangeFinderInfoStruct getNextRequest(){return getNextInfo();}
00180 
00181                void publishData();
00182                void publishInfo();
00183                //void publishRequest();
00184                
00185         protected:
00186                COMObject<RangeFinderInfoStruct, RangeFinderDataStruct> *myCOMObject;
00187 
00188                bool m_queue;
00189 
00190                //notes that the object should be initialized as soon as a streamname is received
00191                bool m_initialize;
00192                std::queue<RangeFinderDataStruct> m_dataVector;
00193                std::queue<RangeFinderInfoStruct> m_infoVector;
00194                std::queue<RangeFinderInfoStruct> m_requestVector;
00195         
00196         };
00197 
00198 }
00199 
00200 
00201 #endif

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