Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Modules/SelfLocator/GT2005StableSelfLocator/GT2005StableSampleTemplateGenerator.h

Go to the documentation of this file.
00001 #ifndef __GT2005StableSampleTemplateGenerator_h_
00002 #define __GT2005StableSampleTemplateGenerator_h_
00003 
00004 #include "Representations/Perception/LandmarksPercept.h"
00005 #include "Tools/Math/Pose2D.h"
00006 #include "Tools/Field.h"
00007 #include "../LinesTables2004.h"
00008 
00009 #include "GT2005StableSelfLocatorSample.h"
00010 
00011 // remove most of the parameters of generateTemplate by adding addXXX Mehtods to
00012 // keep datastructures inside this class updated
00013 
00014 /**
00015 * A Class to encapsulate the template geneation feature of the gt04 localizer
00016 */
00017 class GT2005StableSampleTemplateGenerator : LinesTables2004
00018 {
00019 public:
00020   /**
00021   * Constructor
00022   */
00023   GT2005StableSampleTemplateGenerator();
00024   
00025   /**
00026   * this method returns a generated template
00027   */
00028   GT2005StableSelfLocatorSample getTemplate();
00029 
00030   /**
00031   * this method generates new sample templates
00032   */
00033   void generateTemplates(const LandmarksPercept& landmarksPercept, 
00034                const LinesPercept& linesPercept,
00035                            const Pose2D& odometry, 
00036                int   numberOfPerceptTypes, /* number of different percept types in current percepts*/
00037                const LinesPercept::LineType types[LinesPercept::numberOfLineTypes]);
00038 
00039   int getNumberOfTemplates();
00040 
00041 
00042 private:
00043   enum{
00044     TEMPLATES_MAX = 100,        /**< maximum number of samples - should be the same as max number of samples in locator */
00045     FLAGS_MAX = 3               /**< maximum number of flags stored in a buffer */
00046   };
00047 
00048   Flag flags[FLAGS_MAX];              /**< A buffer for previously seen flags. */
00049 
00050   int numberOfTemplates,              /**< The number of templates generated. */
00051       numberOfFlags,
00052       nextTemplate;               /**< The next template delivered. */
00053   int randomFactor;               /**< A factor that is increased if more templates are required. */
00054   Pose2D templates[TEMPLATES_MAX];        /**< Templates for poses replacing bad samples. */
00055 
00056   bool getBearing(const LandmarksPercept& landmarksPercept,int i,
00057           Vector2<double>& mark, double& dir,double& dist);
00058 
00059   int poseFromBearingsAndDistance( double dir0,double dir1,double dist,
00060                   const Vector2<double>& mark0,
00061                   const Vector2<double>& mark1,
00062                   const Vector2<double>& cameraOffset,
00063                   Pose2D& resultingPose1,
00064                   Pose2D& resultingPose2);
00065 
00066   bool poseFromBearings(double dir0,double dir1,double dir2,
00067             const Vector2<double>& mark0,
00068             const Vector2<double>& mark1,
00069             const Vector2<double>& mark2,
00070             const Vector2<double>& cameraOffset,
00071             Pose2D& resultingPose);
00072 
00073   void addFlag(const Flag& flag);
00074 };
00075 #endif
00076 
00077 

Generated on Mon Mar 20 21:59:55 2006 for GT2005 by doxygen 1.3.6