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

# Modules/SelfLocator/GT2005SelfLocator/GT2005SelfLocatorSample.h

Go to the documentation of this file.

    00001 /*
    00002 * Representation for a single particle(=sample) int the gt2005 selflocator
    00003 * Based on the Sample of the GT2004 SelfLocator
    00004 *
    00005 * TODO: fix strange landmark solution for goals etc
    00006 *
    00007 *
    00008 *  @author <A href=mailto:c_rohde@web.de>Carsten Rohde</A>
    00009 *  @author <A href=mailto:judith-winter@web.de>Judith Winter</A>
    00010 *
    00011 */
    00012
    00013 #ifndef __GT2005SelfLocatorSample_h_
    00014 #define __GT2005SelfLocatorSample_h_
    00015
    00016
    00017 #include "Representations/Cognition/SampleSet.h"
    00018 #include "Representations/Perception/LinesPercept.h"
    00019 #include "Tools/Math/Pose2D.h"
    00020 #include "Tools/Debugging/Debugging.h"
    00021 #include "Platform/SystemCall.h"
    00022 #include "GT2005SelfLocatorParameters.h"
    00023
    00024 /**
    00025 * The class represents a sample.
    00026 */
    00027 class GT2005SelfLocatorSample : public PoseSample
    00028 {
    00029 public:
    00030
    00031   enum{
    00032     UNINITIALIZED_PROBABILITY = 2
    00033   };
    00034
    00035   // caution: observationTable encodes yFieldLine as [numberOfLineTypes] the original
    00036   // gt2004 sample encodes yFieldLine as [numberOfLineTypes+1]
    00037   enum PerceptType
    00038   {
    00039     xFieldLine,
    00040     yFieldLine,
    00041     border,
    00042     flag,
    00043     goal,
    00044     lineCrossing,
    00045     numberOfPerceptTypes                                  /**< the number of percept types */
    00046   };
    00047
    00048   Pose2D camera;                        /**< Temporary representing the pose of the camera. */
    00049   double perceptProbabilities[numberOfPerceptTypes];      /**< a probability for each percept-type recognized */
    00050   long perceptTimestamps[numberOfPerceptTypes];
    00051   GT2005SelfLocatorSample* next;                  /**< The next sample in the cell cube. */
    00052   bool isUsingOdometry;                /**< Whether this sample receives odometry updates or not. */
    00053
    00054   /**
    00055   * Constructor.
    00056   */
    00057   GT2005SelfLocatorSample();
    00058
    00059   /**
    00060   * Constructor.
    00061   * @param pose The pose of the sample.
    00062   */
    00063   GT2005SelfLocatorSample(const Pose2D& pose);
    00064
    00065   double getProbability() const {return probability;}
    00066
    00067   void reset();
    00068
    00069   /* updates the probability of the sample -> multilplies all probablities.
    00070   * if a probability is not set, a value dependent of the average is taken
    00071   * @param average pointer to the array of average probabilities for the percept types
    00072   */
    00073   void updateProbability(const double* average, const GT2005SelfLocatorParameters& parameters);
    00074
    00075
    00076   /**
    00077   * sets the probability for a percept. replaces setProbability in GT04SL
    00078   * limits change of probability to +paramProbUpLimit and -paramProbDownLimit
    00079   * differs from gt code by strange part dependent on goal type
    00080   * @param type of the percept the probability is updated for
    00081   * @return value the probability for the percept
    00082   */
    00083   void setPerceptProbability(GT2005SelfLocatorSample::PerceptType type,double value, const GT2005SelfLocatorParameters& parameters);
    00084
    00085   bool isValid() const {return probability <= 1;}
    00086
    00087   void scaleProbabilities(double factor);
    00088 };
    00089
    00090 /**
    00091  * Streaming operator that reads a sample from a stream.
    00092  */
    00093 In& operator>>(In& stream,GT2005SelfLocatorSample& sample);
    00094
    00095 /**
    00096  * Streaming operator that writes a sample to a stream.
    00097  */
    00098 Out& operator<<(Out& stream, const GT2005SelfLocatorSample& sample);
    00099
    00100 #endif
    00101
    00102
    00103