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

Modules/ImageProcessor/SlamImageProcessor/SlamFlagLocator.h

Go to the documentation of this file.
00001 /**
00002 * @file SlamFlagLocator.h
00003 *
00004 * Definition of class SlamFlagLocator
00005 * The FlagLocator localizes the position of additional landmarks
00006 *
00007 * @author <a href="mailto:c_rohde@web.de">Carsten Rohde</a>
00008 */
00009 
00010 #include "Tools/Math/Vector2.h"
00011 #include "Tools/Math/Pose2D.h"
00012 #include "../ImageProcessorTools/BresenhamLineScan.h"
00013 // #include "Tools/Debugging/Debugging.h"
00014 #include "Tools/Debugging/DebugDrawings.h"
00015 
00016 
00017 #ifndef SlamFlagLocator_h
00018 #define SlamFlagLocator_h
00019 
00020 class SlamFlagLocator
00021 {
00022 
00023 public:
00024 
00025   // embedded class newflagcontainer, ds for new flags
00026   class NewFlagContainer{
00027   public:
00028     enum{
00029       NO_OF_FLAGS = 10,
00030       NO_OF_CHARACTERIZATIONS = 13 // 12 + dont know
00031     };
00032 
00033     NewFlagContainer()
00034     {
00035       reset();
00036     }
00037   
00038     void reset()
00039     {
00040       for(int i=0;i<NO_OF_CHARACTERIZATIONS;++i)
00041         numberOfStoredFlags[i] = 0;
00042     }
00043 
00044     void addFlag(Vector2<int> flag, int characterization)
00045     {
00046       if (numberOfStoredFlags[characterization]>=NO_OF_FLAGS)
00047       {
00048       numberOfStoredFlags[characterization] = 0;
00049       }
00050       flagPositions[characterization][numberOfStoredFlags[characterization]] = flag;
00051       numberOfStoredFlags[characterization]++;
00052 
00053     }
00054 
00055     void getFlagsForCharacterization(Vector2<int>** flags,int& numberOfStored, int characterization)
00056     {
00057       (*flags) = flagPositions[characterization];
00058       numberOfStored = numberOfStoredFlags[characterization];
00059     }
00060 
00061   private:
00062 
00063     Vector2<int> flagPositions[NO_OF_CHARACTERIZATIONS][NO_OF_FLAGS];
00064     int numberOfStoredFlags[NO_OF_CHARACTERIZATIONS]; 
00065   
00066   };
00067 
00068   enum Sizes{
00069     xSize = 60+6,
00070     ySize = 40+6
00071   };
00072 
00073   SlamFlagLocator();
00074   ~SlamFlagLocator();
00075 
00076   void addFlagDirection(const Pose2D& robotPose, double bearing, int characterization);
00077   void finishUpdate();
00078   void getClosestFlagBearing(double& targetBearing, const Pose2D& robotPose, double measuredBearing);
00079   void draw();
00080 
00081   enum flagCharacteristics
00082   {
00083     blueOnThisSide=0,
00084     yellowOnThisSide=1,
00085     somethingElseOnThisSide=2
00086   };
00087 
00088   int getCharacterisationNumber(flagCharacteristics above, flagCharacteristics below, flagCharacteristics left, flagCharacteristics right)
00089   {
00090     return above + 3*below + 9*left + 18*right; // muhahahahahahaha   ;-)
00091   }
00092 
00093 
00094 
00095 private:
00096   long** cluster[NewFlagContainer::NO_OF_CHARACTERIZATIONS];
00097   NewFlagContainer* container;
00098   bool updateFinished;
00099   double averageParam, maxParam;
00100   void calcFlags();
00101 
00102 };
00103 
00104 #endif
00105 

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