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

Modules/SelfLocator/SlamSelfLocator/SlamSampleTemplateGenerator.h

Go to the documentation of this file.
00001 #ifndef __SlamSampleTemplateGenerator_h_
00002 #define __SlamSampleTemplateGenerator_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 "SlamSelfLocatorSample.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 SlamSampleTemplateGenerator : LinesTables2004
00018 {
00019 public:
00020   /**
00021   * Constructor
00022   */
00023   SlamSampleTemplateGenerator();
00024   
00025   /**
00026   * this method returns a generated template
00027   */
00028   SlamSelfLocatorSample 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                bool useLandmarks = false);
00039 
00040   int getNumberOfTemplates();
00041 
00042 
00043 private:
00044   enum{
00045     TEMPLATES_MAX = 100,        /**< maximum number of samples - should be the same as max number of samples in locator */
00046     FLAGS_MAX = 3               /**< maximum number of flags stored in a buffer */
00047   };
00048 
00049   Flag flags[FLAGS_MAX];              /**< A buffer for previously seen flags. */
00050 
00051   int numberOfTemplates,              /**< The number of templates generated. */
00052       numberOfFlags,
00053       nextTemplate;               /**< The next template delivered. */
00054   int randomFactor;               /**< A factor that is increased if more templates are required. */
00055   Pose2D templates[TEMPLATES_MAX];        /**< Templates for poses replacing bad samples. */
00056 
00057   bool getBearing(const LandmarksPercept& landmarksPercept,int i,
00058           Vector2<double>& mark, double& dir,double& dist);
00059 
00060   int poseFromBearingsAndDistance( double dir0,double dir1,double dist,
00061                   const Vector2<double>& mark0,
00062                   const Vector2<double>& mark1,
00063                   const Vector2<double>& cameraOffset,
00064                   Pose2D& resultingPose1,
00065                   Pose2D& resultingPose2);
00066 
00067   bool poseFromBearings(double dir0,double dir1,double dir2,
00068             const Vector2<double>& mark0,
00069             const Vector2<double>& mark1,
00070             const Vector2<double>& mark2,
00071             const Vector2<double>& cameraOffset,
00072             Pose2D& resultingPose);
00073 
00074   void addFlag(const Flag& flag);
00075 };
00076 #endif
00077 
00078 

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