INTRODUCTION
Overview
Download and Install
Quick Start
Documentation
Publications

NONFRAMEWORK CODE
Driver Interfaces
Drivers
Libraries
Utilities

FRAMEWORK CODE
Interfaces
Components
Libraries
Utilities

Full Software Listings

DEVELOPER
Tutorials
Examples
Dev Guide
Dashboard

PEOPLE
Contributors
Users

SourceForge.net Logo
Project
Download
Mailing lists

 

         

features.h

00001 #ifndef LASERFEATURES_FEATURES_H
00002 #define LASERFEATURES_FEATURES_H
00003 
00004 #include <hydrogeom2d/geom2d.h>
00005 #include <assert.h>
00006 
00007 namespace hydrofeatureobs {
00008 
00009 // Define a few feature types.  These are defined as int's rather than enum, so
00010 // users can define their own.
00011 
00013 const int LASERREFLECTOR   = 0;
00015 const int FOREGROUNDPOINT  = 1;
00017 const int DOOR             = 2;
00019 const int CORNER           = 3;
00021 const int LINE             = 4;
00023 const int INTERNALCORNER   = 5;
00025 const int EXTERNALCORNER   = 6;
00027 const int VEHICLEPOSE      = 7;
00029 const int GPSFIX           = 8;
00030 
00031 std::string featureTypeToString( int featureType );
00032 
00038 class FeatureObs
00039 {
00040 public:
00041     virtual ~FeatureObs() {}
00042 
00043     virtual std::string toString()  const=0;
00044 
00045     virtual int    featureType()    const=0;
00046     virtual double pFalsePositive() const=0;
00047     virtual double pTruePositive()  const=0;
00048 
00049     // Allow sanity checks for debugging
00050     virtual bool isSane() const=0;
00051 };
00052 inline std::ostream &operator<<( std::ostream &s, const FeatureObs &o )
00053 { return s << o.toString(); }
00054 
00056 bool isSane( double pFalsePositive, double pTruePositive );
00057 
00063 class PointFeatureObs : public virtual FeatureObs
00064 {
00065 public:
00066     PointFeatureObs( int featureType,
00067                      double pFalsePositive,
00068                      double pTruePositive,
00069                      double range,
00070                      double bearing,
00071                      double rangeSd,
00072                      double bearingSd )
00073         : featureType_(featureType),
00074           pFalsePositive_(pFalsePositive),
00075           pTruePositive_(pTruePositive),
00076           range_(range),
00077           bearing_(bearing),
00078           rangeSd_(rangeSd),
00079           bearingSd_(bearingSd)
00080         { assert(rangeSd>=0 && bearingSd>=0); }
00081 
00082     // const access
00083     double range()   const { return range_; }
00084     double bearing() const { return bearing_; }
00085     double rangeSd()    const { return rangeSd_; }
00086     double bearingSd()  const { return bearingSd_; }
00087 
00088     // non-const access
00089     double &range()      { return range_; }
00090     double &bearing()    { return bearing_; }
00091     double &rangeSd()    { return rangeSd_; }
00092     double &bearingSd()  { return bearingSd_; }
00093 
00094     std::string toString() const;
00095 
00096     int    featureType()    const { return featureType_; }
00097     double pFalsePositive() const { return pFalsePositive_; }
00098     double pTruePositive()  const { return pTruePositive_; }
00099 
00100     bool isSane() const;
00101 
00102 private:
00103     int   featureType_;
00104     double pFalsePositive_;
00105     double pTruePositive_;
00106 
00107     double range_;
00108     double bearing_;
00109     double rangeSd_;
00110     double bearingSd_;
00111 };
00112 
00118 class PoseFeatureObs : public virtual FeatureObs
00119 {
00120 public:
00121     PoseFeatureObs( int featureType,
00122                     double pFalsePositive,
00123                     double pTruePositive,
00124                     double range,
00125                     double bearing,
00126                     double orientation,
00127                     double rangeSd,
00128                     double bearingSd,
00129                     double orientationSd )
00130         : featureType_(featureType),
00131           pFalsePositive_(pFalsePositive),
00132           pTruePositive_(pTruePositive),
00133           range_(range),
00134           bearing_(bearing),
00135           orientation_(orientation),
00136           rangeSd_(rangeSd),
00137           bearingSd_(bearingSd),
00138           orientationSd_(orientationSd)
00139         { assert(rangeSd>=0 && bearingSd>=0); }
00140 
00141     // const access
00142     double range()       const { return range_; }
00143     double bearing()     const { return bearing_; }
00144     double orientation() const { return orientation_; }
00145     double rangeSd()        const { return rangeSd_; }
00146     double bearingSd()      const { return bearingSd_; }
00147     double orientationSd() const { return orientationSd_; }
00148 
00149     // non-const access
00150     double &range()         { return range_; }
00151     double &bearing()       { return bearing_; }
00152     double &orientation()   { return orientation_; }
00153     double &rangeSd()       { return rangeSd_; }
00154     double &bearingSd()     { return bearingSd_; }
00155     double &orientationSd() { return orientationSd_; }
00156 
00157     std::string toString() const;
00158 
00159     int    featureType()    const { return featureType_; }
00160     double pFalsePositive() const { return pFalsePositive_; }
00161     double pTruePositive()  const { return pTruePositive_; }
00162 
00163     bool isSane() const;
00164 
00165 private:
00166     int   featureType_;
00167     double pFalsePositive_;
00168     double pTruePositive_;
00169 
00170     double range_;
00171     double bearing_;
00172     double orientation_;
00173     double rangeSd_;
00174     double bearingSd_;
00175     double orientationSd_;
00176 };
00177 
00190 class LineFeatureObs : public virtual FeatureObs
00191 {
00192 public:
00193     LineFeatureObs( int featureType, double pFalsePositive, double pTruePositive,
00194                     double rangeStart, double bearingStart,
00195                     double rangeEnd, double bearingEnd,
00196                     bool startSighted, bool endSighted,
00197                     double rhoSd, double alphaSd );
00198 
00199     double rangeStart()   const { return start_.range(); }
00200     double bearingStart() const { return start_.bearing(); }
00201     double rangeEnd()     const { return end_.range(); }
00202     double bearingEnd()   const { return end_.bearing(); }
00203 
00204     void setEndpoints( double rangeStart, double bearingStart,
00205                        double rangeEnd, double bearingEnd );
00206 
00207     bool startSighted() const { return startSighted_; }
00208     bool endSighted() const { return endSighted_; }
00209 
00210     // polar observation of infinite line
00211     double rho()   const { return rho_; }
00212     double alpha() const { return alpha_; }
00213 
00214     // uncertainty
00215     double rhoSd()   const { return rhoSd_; }
00216     double alphaSd() const { return alphaSd_; }
00217 
00218     std::string toString() const;
00219 
00220     virtual int    featureType()    const { return featureType_; }
00221     virtual double pFalsePositive() const { return pFalsePositive_; }
00222     virtual double pTruePositive()  const { return pTruePositive_; }
00223 
00224     bool isSane() const;
00225 
00226 private:
00227 
00228     int   featureType_;
00229     double pFalsePositive_;
00230     double pTruePositive_;
00231 
00232     geom2d::PolarPoint start_, end_;
00233 
00234     bool startSighted_;
00235     bool endSighted_;
00236 
00237     // obs of infinite line
00238     double rho_, alpha_;
00239     double rhoSd_, alphaSd_;
00240 };
00241 
00242 }
00243 
00244 #endif
 

Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)


Generated for Orca Robotics by  doxygen 1.4.5