Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

LocalizationParticleData.h

Go to the documentation of this file.
00001 //-*-c++-*-
00002 #ifndef _LOCALIZATIONPARTICLEDATA_H_
00003 #define _LOCALIZATIONPARTICLEDATA_H_
00004 
00005 #include "Shared/Measures.h"    // coordinate_t; AngPi data member
00006 #include "Shared/fmatSpatial.h"
00007 
00008 #include "DualCoding/BaseData.h"    // superclass
00009 #include "DualCoding/Point.h"       // Point data member
00010 #include "DualCoding/ShapeTypes.h"  // localizationParticleDataType
00011 
00012 #include "Localization/ShapeBasedParticleFilter.h"
00013 
00014 namespace DualCoding {
00015 
00016 class ShapeRoot;
00017 class SketchSpace;
00018 template<typename T> class Sketch;
00019 
00020 //! Shape represention of a localization particle
00021 /*! Rather than caching data locally, we store a pointer to the
00022   particle vector and the index of the particle. This way, each time
00023   the user refreshes the sketchGUI we will fetch the latest values
00024   for the particle.
00025 */
00026 class LocalizationParticleData : public BaseData {
00027 private:
00028   const ShapeBasedParticleFilter::particle_collection *particles;
00029   ShapeBasedParticleFilter::index_t index;
00030 
00031 public:
00032 
00033   //! Constructor
00034   LocalizationParticleData(ShapeSpace &_space,
00035          const ParticleFilter<LocalizationParticle>::particle_collection &_particles,
00036          ParticleFilter<LocalizationParticle>::index_t _index);
00037 
00038   //! Copy constructor
00039   LocalizationParticleData(const LocalizationParticleData &other);
00040 
00041   static ShapeType_t getStaticType() { return localizationParticleDataType; }
00042 
00043   DATASTUFF_H(LocalizationParticleData);
00044   
00045   //! Centroid. (Virtual in BaseData.)
00046   virtual Point getCentroid() const;
00047   
00048   AngTwoPi getOrientation() const { return (*particles)[index].theta; }
00049 
00050   float getWeight() const { return (*particles)[index].weight;}
00051 
00052   virtual bool isMatchFor(const ShapeRoot& other) const;
00053 
00054   virtual bool updateParams(const ShapeRoot&, bool force=false);
00055 
00056   //! Print information about this shape. (Virtual in BaseData.)
00057   virtual void printParams() const;
00058   
00059   virtual void applyTransform(const fmat::Transform& Tmat, const ReferenceFrameType_t newref=unspecified) {}
00060 
00061   virtual void projectToGround(const fmat::Transform&, const PlaneEquation&) {}
00062 
00063   virtual unsigned short getDimension() const { return 2; }
00064 
00065   LocalizationParticleData& operator=(const LocalizationParticleData &other);
00066 
00067 private:
00068   //! Render into a sketch space and return pointer. (Private.)
00069   virtual Sketch<bool>* render() const;
00070 
00071 
00072 };
00073 
00074 } // namespace
00075 
00076 #endif

DualCoding 5.1CVS
Generated Mon May 9 04:56:26 2016 by Doxygen 1.6.3