00001 #ifndef __GT2005SampleTemplateGenerator_h_
00002 #define __GT2005SampleTemplateGenerator_h_
00003
00004
00005
00006
00007
00008
00009
00010
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
00022
00023
00024
00025
00026
00027 class GT2005SampleTemplateGenerator : public LinesTables2005
00028 {
00029 public:
00030
00031
00032
00033 GT2005SampleTemplateGenerator(const GT2005SelfLocatorParameters& parameters);
00034
00035
00036
00037
00038 GT2005SelfLocatorSample getTemplate();
00039
00040
00041
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,
00062 FLAGS_MAX = 3
00063 };
00064
00065 Flag flags[FLAGS_MAX];
00066
00067 int numberOfTemplates,
00068 numberOfFlags,
00069 nextTemplate;
00070 int randomFactor;
00071 Pose2D templates[TEMPLATES_MAX];
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
00093
00094 bool checkTemplatePose(const Pose2D &pose, const Vector2<double> &mark, double dir);
00095 };
00096 #endif
00097
00098