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

# Modules/SelfLocator/GT2005StableSelfLocator/GT2005StableSelfLocatorSample.h

Go to the documentation of this file.

    00001 #ifndef __GT2005StableSelfLocatorSample_h_
    00002 #define __GT2005StableSelfLocatorSample_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 GT2005StableSelfLocatorSample : 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     border,
    00037     flag,
    00038     yellowGoal,
    00039     skyblueGoal,
    00040     lineCrossing,
    00041     numberOfPerceptTypes                                  /**< the number of percept types */
    00042   };
    00043
    00044   Pose2D camera;                        /**< Temporary representing the pose of the camera. */
    00045   double perceptProbabilities[numberOfPerceptTypes];      /**< a probability for each percept-type recognized */
    00046   long perceptTimestamps[numberOfPerceptTypes];
    00047   GT2005StableSelfLocatorSample* next;                  /**< The next sample in the cell cube. */
    00048
    00049   /**
    00050   * Constructor.
    00051   */
    00052   GT2005StableSelfLocatorSample();
    00053
    00054   /**
    00055   * Constructor.
    00056   * @param pose The pose of the sample.
    00057   */
    00058   GT2005StableSelfLocatorSample(const Pose2D& pose);
    00059
    00060   double getProbability() const {return probability;}
    00061
    00062   /* updates the probability of the sample -> multilplies all probablities.
    00063   * if a probability is not set, this probability is not used
    00064   */
    00065   void updateProbability();
    00066
    00067
    00068   /* updates the probability of the sample -> multilplies all probablities.
    00069   * if a probability is not set, a value dependent of the average is taken
    00070   * @param average pointer to the array of average probabilities for the percept types
    00071   */
    00072   void updateProbability(const double* average);
    00073
    00074
    00075   /**
    00076   * sets the probability for a percept. replaces setProbability in GT04SL
    00077   * limits change of probability to +paramProbUpLimit and -paramProbDownLimit
    00078   * differs from gt code by strange part dependent on goal type
    00079   * @param type of the percept the probability is updated for
    00080   * @return value the probability for the percept
    00081   */
    00082   void setPerceptProbability(GT2005StableSelfLocatorSample::PerceptType type,double value);
    00083
    00084   bool isValid() const {return probability <= 1;}
    00085 };
    00086 #endif
    00087
    00088
    00089