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

Modules/SelfLocator/SlamSelfLocator/SlamSelfLocatorSample.h

Go to the documentation of this file.
00001 #ifndef __SlamSelfLocatorSample_h_
00002 #define __SlamSelfLocatorSample_h_
00003 
00004 
00005 #include "Representations/Cognition/SampleSet.h"
00006 #include "Representations/Perception/LinesPercept.h"
00007 #include "Tools/Math/Pose2D.h"
00008 #include "Tools/Debugging/Debugging.h"
00009 #include "Platform/SystemCall.h"
00010 
00011 
00012 
00013 /**
00014 * The class represents a sample.
00015 */
00016 class SlamSelfLocatorSample : public PoseSample
00017 {
00018 public:
00019 
00020   enum{
00021     UNINITIALIZED_PROBABILITY = 2,
00022     NO_PERCEPT_PROBABILITY = 3,
00023     PERCEPT_TTL_MS = 2000
00024   };
00025 
00026   static double paramProbUpLimit,       // step size for increasing probabilities
00027                 paramProbDownLimit,     // step size for decreasing probabilities
00028                 paramProbDelay;       // delay param for changing probabilities
00029 
00030   // caution: observationTable encodes yFieldLine as [numberOfLineTypes] the original
00031   // gt2004 sample encodes yFieldLine as [numberOfLineTypes+1]
00032   enum PerceptType
00033   {
00034     xFieldLine,
00035     yFieldLine,
00036     flag,      
00037     yellowGoal,
00038     skyblueGoal,
00039     lineCrossing,
00040     numberOfPerceptTypes                                  /**< the number of percept types */
00041   };
00042 
00043   Pose2D camera;                        /**< Temporary representing the pose of the camera. */
00044   double perceptProbabilities[numberOfPerceptTypes];      /**< a probability for each percept-type recognized */
00045   long perceptTimestamps[numberOfPerceptTypes];
00046   SlamSelfLocatorSample* next;                  /**< The next sample in the cell cube. */
00047 
00048   /**
00049   * Constructor.
00050   */
00051   SlamSelfLocatorSample();
00052 
00053   /**
00054   * Constructor.
00055   * @param pose The pose of the sample.
00056   */
00057   SlamSelfLocatorSample(const Pose2D& pose);
00058 
00059   double getProbability() const {return probability;}
00060 
00061   /* updates the probability of the sample -> multilplies all probablities.
00062   * if a probability is not set, this probability is not used
00063   */
00064   void updateProbability();
00065 
00066 
00067   /* updates the probability of the sample -> multilplies all probablities.
00068   * if a probability is not set, a value dependent of the average is taken
00069   * @param average pointer to the array of average probabilities for the percept types
00070   */
00071   void updateProbability(const double* average);
00072 
00073 
00074   /**
00075   * sets the probability for a percept. replaces setProbability in GT04SL
00076   * limits change of probability to +paramProbUpLimit and -paramProbDownLimit
00077   * differs from gt code by strange part dependent on goal type
00078   * @param type of the percept the probability is updated for
00079   * @return value the probability for the percept
00080   */
00081   void setPerceptProbability(SlamSelfLocatorSample::PerceptType type,double value);
00082 
00083   bool isValid() const {return probability <= 1;}
00084 };
00085 #endif
00086 
00087 
00088 

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