/home/fwph/code/wurde/rde/core/RobotTypes.H

Go to the documentation of this file.
00001 #ifndef ROBOT_TYPES_H
00002 #define ROBOT_TYPES_H
00003 
00024 #include <Geometry.H>
00025 #include <WeightedPoints.H>
00026 
00037 namespace WURDE {
00042         typedef enum { PROTOCOL_NULL, 
00043                        PROTOCOL_CMUIPC, 
00044                        PROTOCOL_SHMEM 
00045         } Protocols;
00046 
00047        /* used by WritableType. Declarations have to go here */
00051        typedef enum { 
00052                       W_NULL,           
00053                       W_SUPPLIER_ONLY, 
00054                       W_CONSUMER_ONLY, 
00055                       W_ALL,           
00056                       W_LOCKED        
00057        } WriteMode;
00061        typedef enum {
00062               C_NULL, 
00063               C_CONSUMER,
00064               C_SUPPLIER
00065        } ConsumeMode;
00069        typedef enum {
00070               STAT_NULL,
00071               STAT_OKAY,
00072               STAT_FAIL,
00073               STAT_PENDING,
00074               STAT_REQUEST
00075        } StatusMode;     
00076        
00080        typedef enum { STATE_NULL,     
00081                       STATE_RUN,      
00082                       STATE_IDLE,     
00083                       STATE_QUIT,     
00084                       STATE_RESTART,  
00085                       STATE_REQUEST,  
00086                       STATE_RESET,    
00087                       STATE_ZOMBIE,   
00088                       STATE_FAIL,     
00089                       STATE_INACTIVE, 
00090                       STATE_INFO,     
00091                       STATE_STARTUP   
00092        } RunState;
00093        
00097        typedef enum { LOCALE_NULL, 
00098                       LOCALE_EXTERNAL, 
00099                       LOCALE_INTERNAL  
00100        } ProcessLocale;
00101        
00105        typedef enum { PROC_NULL,      
00106                       PROC_MANAGED,   
00107                       PROC_UNMANAGED, 
00108                       PROC_CRITICAL   
00110        } ProcessType;
00111 
00115        typedef enum { STRAT_NULL,     
00116                       STRAT_AUTO,     
00117                       STRAT_ASSIGNED, 
00118                       STRAT_NORMAL    
00119        } ConnectionStrategy;
00120 
00124        typedef enum {
00125               MESSAGE_NULL,           /*< Null type */
00126               MESSAGE_INFO,           /*< Indicates this message is for informational purposes only (not a request) */
00127               MESSAGE_REQUEST,        /*< Indicates this message is a request */
00128               MESSAGE_PING            /*< Indicates a ping-- request that info/data events be sent */
00129        } MessageType;
00130 
00131 
00136         // \todo Match ImageFormat with WURDEVision::WURDEVisionVideoMode
00137        typedef enum {
00138               FORMAT_NULL,                /*< Null type */
00139               FORMAT_CHAR_111_YUV24,      /*< YUV24, the main type we'll be using */
00140               FORMAT_CHAR_11_YUV422,      /*< YUV422 */
00141               FORMAT_CHAR_111_RGB,        /*< Standard RGB */
00142               FORMAT_CHAR_1_GRAY,         /*< Grayscale image */
00143               FORMAT_INT,                 /*< Integer image, user-defined number of channels */
00144               FORMAT_DOUBLE,              /*< Double image, user-defined number of channels */
00145               FORMAT_FLOAT,               /*< Float image, user-defined number of channels */
00146               FORMAT_LONG,                /*< Long image, user-defined number of channels */
00147               FORMAT_SHORT,               /*< Short image, user-defined number of channels */
00148               FORMAT_CHAR,                /*< Char image, user-defined number of channels */
00149               FORMAT_BOOL                 /*< Bool image, user-defined number of channels */          
00150        } ImageFormat;
00151 
00152        typedef enum {
00153               COMPRESSION_NULL,            /*< Null type */
00154               COMPRESSION_UNCOMPRESSED,    /*< No compression */
00155               COMPRESSION_RLE_HIGHQUALITY, /*< Run length encoding, see utils lib for more info  */
00156               COMPRESSION_RLE_LOWQUALITY, /*< Run length encoded, see utils lib for more info */
00157        } ImageCompression;
00158 
00162        class Point : public FixedNdWeightedPoint <double,double,2>{
00163        public:
00164               Point() : FixedNdWeightedPoint<double,double,2>(0){this->value(0);};
00165               Point(const double & x, const double & y) : FixedNdWeightedPoint<double,double,2>(0){(*this)[0]=x; (*this)[1]=y;this->value(0);};
00166               Point(const double & x, const double & y, const double & value) : FixedNdWeightedPoint<double,double,2>(0){(*this)[0]=x; (*this)[1]=y;this->value(value);};
00167               
00168               void x(const double & x){(*this)[0]=x;};
00169               void y(const double & y){(*this)[1]=y;};
00170               const double x() const {return (*this)[0];};
00171               const double y() const {return (*this)[1];};
00172               
00173        };
00174        
00178        class Point3D : public FixedNdWeightedPoint <double,double,3>{
00179        public:
00180               Point3D() : FixedNdWeightedPoint<double, double, 3>(0){this->value(0); };
00181               Point3D(const double & x, const double & y, const double & z) : FixedNdWeightedPoint<double,double,3>(0){(*this)[0]=x; (*this)[1]=y; (*this)[2]=z;this->value(0);};
00182               Point3D(const double & x, const double & y, const double & z, const double & value) : FixedNdWeightedPoint<double,double,3>(0){(*this)[0]=x; (*this)[1]=y; (*this)[2]=z;this->value(value);};
00183               
00184               void x(const double & x){(*this)[0]=x;};
00185               void y(const double & y){(*this)[1]=y;};
00186               void z(const double & z){(*this)[2]=z;};
00187               
00188               const double x() const {return (*this)[0];};
00189               const double y() const {return (*this)[1];};
00190               const double z() const {return (*this)[2];};
00191        };
00192        
00196        class Pose : public FixedNdWeightedPoint <double,double,3>{
00197        public:
00198               Pose() : FixedNdWeightedPoint<double,double,3>(0){this->value(0);};
00199               Pose(const double & x, const double & y) : FixedNdWeightedPoint<double,double,3>(0){(*this)[0]=x; (*this)[1]=y; this->value(0);};
00200               Pose(const double & x, const double & y, const double & theta) : FixedNdWeightedPoint<double,double,3>(0){(*this)[0]=x; (*this)[1]=y; (*this)[2]=theta;this->value(0);};
00201               Pose(const double & x, const double & y, const double & theta, const double & value) : FixedNdWeightedPoint<double,double,3>(0){(*this)[0]=x; (*this)[1]=y; (*this)[2]=theta; this->value(value);};
00202               
00203               void x(const double & x){(*this)[0]=x;};
00204               void y(const double & y){(*this)[1]=y;};
00205               void theta(const double & theta){(*this)[2]=theta;};
00206               
00207               const double x() const {return (*this)[0];};
00208               const double y() const {return (*this)[1];};
00209               const double theta() const {return (*this)[2];};
00210        };
00211        
00215        class Pose3D : public FixedNdWeightedPoint <double,double,6>{
00216        public:
00217               Pose3D() : FixedNdWeightedPoint<double,double,6>(0){this->value(0);};
00218               Pose3D(const double & x, const double & y, const double & z) : FixedNdWeightedPoint<double,double,6>(0){(*this)[0]=x; (*this)[1]=y; (*this)[2]=z;this->value(0);};
00219               Pose3D(const double & x, const double & y, const double & z, const double & value) : FixedNdWeightedPoint<double,double,6>(0){(*this)[0]=x; (*this)[1]=y; (*this)[2]=z;this->value(value);};
00220               Pose3D(const double & x, const double & y, const double & z, const double & theta, const double & phi, const double & psi) : FixedNdWeightedPoint<double,double,6>(0){(*this)[0]=x; (*this)[1]=y;(*this)[2]=z; (*this)[3]=theta;
00221               (*this)[4]=phi; (*this)[5]=psi; this->value(0);};   
00222               Pose3D(const double & x, const double & y, const double & z, const double & theta, const double & phi, const double & psi, const double & value) : FixedNdWeightedPoint<double,double,6>(0){(*this)[0]=x; (*this)[1]=y; (*this)[2]=z; (*this)[3]=theta;
00223               (*this)[4]=phi; (*this)[5]=psi; this->value(value);};       
00224               
00225               void x(const double & x){(*this)[0]=x;};
00226               void y(const double & y){(*this)[1]=y;};
00227               void z(const double & z){(*this)[2]=z;};
00228               void theta(const double & theta){(*this)[3]=theta;};
00229               void phi(const double & phi){(*this)[4]=phi;};
00230               void psi(const double & psi){(*this)[5]=psi;};
00231               
00232               const double x() const {return (*this)[0];};
00233               const double y() const {return (*this)[1];};
00234               const double z() const {return (*this)[2];};
00235               const double theta() const {return (*this)[3];};
00236               const double phi() const {return (*this)[4];};
00237               const double psi() const {return (*this)[5];};
00238               
00239               
00240        };
00241        
00242        
00246        class CVector : public FixedNdWeightedVector <double,double,2>{
00247        public:
00248               CVector() : FixedNdWeightedVector<double,double,2>(0){this->value(0);};
00249               CVector(const double & x, const double & y) : FixedNdWeightedVector<double,double,2>(0){(*this)[0]=x; (*this)[1]=y; this->value(0);};
00250               CVector(const double & x, const double & y, const double & value) : FixedNdWeightedVector<double,double,2>(0){(*this)[0]=x; (*this)[1]=y; this->value(value);};
00251               
00252               void x(const double & x){(*this)[0]=x;};
00253               void y(const double & y){(*this)[1]=y;};
00254               
00255               const double x() const {return (*this)[0];};
00256               const double y() const {return (*this)[1];};
00257               
00258        };
00259        
00260        
00264        class PVector : public FixedNdWeightedVector <double,double,2>{
00265        public:
00266               PVector() : FixedNdWeightedVector<double,double,2>(0){this->value(0);};
00267               PVector(const double & r, const double & theta) : FixedNdWeightedVector<double,double,2>(0){(*this)[0]=r; (*this)[1]=theta; this->value(0);};
00268               PVector(const double & r, const double & theta, const double & value) : FixedNdWeightedVector<double,double,2>(0){(*this)[0]=r; (*this)[1]=theta; this->value(value);};
00269               
00270               void r(const double & r){(*this)[0]=r;};
00271               void theta(const double & theta){(*this)[1]=theta;};
00272               
00273               const double r() const {return (*this)[0];};
00274               const double theta() const {return (*this)[1];};
00275               
00276        };
00277 
00283        template <typename Type>
00284        class DataCounter {
00285        public:
00286               DataCounter(const int & count, const Type & data){m_count=count; m_data=data;}
00287               DataCounter(){m_count=0;}
00288 
00289               void setCount(const int & count){m_count=count;}
00290               const int getCount() const {return m_count;}
00291               const int decrementCount(){ m_count=m_count-1; return m_count;}
00292               const Type getData() const {return m_data;}
00293               void setData(const Type & data){m_data=data;}
00294        private:
00295               int m_count;
00296               Type m_data;
00297        };
00298      
00299 }
00300 
00301 #endif

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