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

Modules/SelfLocator/GT2005SelfLocator/GT2005SampleTemplateGenerator.h

Go to the documentation of this file.
00001  #ifndef __GT2005SampleTemplateGenerator_h_
00002 #define __GT2005SampleTemplateGenerator_h_
00003 
00004 /*
00005 * Template generation for the gt2005 SelfLocator, completely
00006 * identical to the gt2004 SelfLocators template generation
00007 *
00008 * @author <A href=mailto:roefer@tzi.de>Thomas Röfer</A>
00009 * @author <A href=mailto:c_rohde@web.de>Carsten Rohde</A>
00010 * @author <A href=mailto:judith-winter@web.de>Judith Winter</A>
00011 */
00012 
00013 #include "Representations/Perception/LandmarksPercept.h"
00014 #include "Tools/Math/Pose2D.h"
00015 #include "Tools/Field.h"
00016 #include "../LinesTables2005.h"
00017 
00018 #include "GT2005SelfLocatorSample.h"
00019 #include "GT2005SelfLocatorParameters.h"
00020 
00021 // remove most of the parameters of generateTemplate by adding addXXX Mehtods to
00022 // keep datastructures inside this class updated
00023 
00024 /**
00025 * A Class to encapsulate the template geneation feature of the gt04 localizer
00026 */
00027 class GT2005SampleTemplateGenerator : public LinesTables2005
00028 {
00029 public:
00030   /**
00031   * Constructor
00032   */
00033   GT2005SampleTemplateGenerator(const GT2005SelfLocatorParameters& parameters);
00034   
00035   /**
00036   * this method returns a generated template
00037   */
00038   GT2005SelfLocatorSample getTemplate();
00039 
00040   /**
00041   * this method generates new sample templates
00042   */
00043   void generateTemplates(const LandmarksPercept& landmarksPercept, 
00044                const LinesPercept& linesPercept,
00045                            const Pose2D& odometry);
00046 
00047   int getNumberOfTemplates() const;
00048 
00049   void draw(const Pose2D& pose, const Drawings::Color& color) const;
00050   void draw(const Pose2D &pose, const Drawings::Color &color,
00051             const Vector2<double>& mark1, const Vector2<double>& mark2, double dir1, double dir2) const;
00052   void draw(const Pose2D &pose, const Drawings::Color &color,
00053             const Vector2<double>& mark1, const Vector2<double>& mark2,
00054             const Vector2<double>& mark3, double dir1, double dir2, double dir3) const;
00055 
00056 private:
00057 
00058   const GT2005SelfLocatorParameters& parameters;
00059 
00060   enum{
00061     TEMPLATES_MAX = 100,        /**< maximum number of samples - should be the same as max number of samples in locator */
00062     FLAGS_MAX = 3               /**< maximum number of flags stored in a buffer */
00063   };
00064 
00065   Flag flags[FLAGS_MAX];              /**< A buffer for previously seen flags. */
00066 
00067   int numberOfTemplates,              /**< The number of templates generated. */
00068       numberOfFlags,
00069       nextTemplate;               /**< The next template delivered. */
00070   int randomFactor;               /**< A factor that is increased if more templates are required. */
00071   Pose2D templates[TEMPLATES_MAX];        /**< Templates for poses replacing bad samples. */
00072 
00073   bool getBearing(const LandmarksPercept& landmarksPercept,int i,
00074           Vector2<double>& mark, double& dir,double& dist);
00075 
00076   int poseFromBearingsAndDistance( double dir0,double dir1,double dist,
00077                   const Vector2<double>& mark0,
00078                   const Vector2<double>& mark1,
00079                   const Vector2<double>& cameraOffset,
00080                   Pose2D& resultingPose1,
00081                   Pose2D& resultingPose2);
00082 
00083   bool poseFromBearings(double dir0,double dir1,double dir2,
00084             const Vector2<double>& mark0,
00085             const Vector2<double>& mark1,
00086             const Vector2<double>& mark2,
00087             const Vector2<double>& cameraOffset,
00088             Pose2D& resultingPose);
00089 
00090   void addFlag(const Flag& flag);
00091 
00092   // test if templates returned from poseFromBearings were calculated correctly
00093   // this should not be necessary but sometimes wrong poses are returned
00094   bool checkTemplatePose(const Pose2D &pose, const Vector2<double> &mark, double dir);
00095 };
00096 #endif
00097 
00098 

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