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

# Modules/BallLocator/GT2005Particles/GT2005ParticleContainer.h

Go to the documentation of this file.

    00001 /**
    00002  * @file GT2005ParticleContainer.h
    00003  *
    00004  * This file contains a Particle Container used by the GT2005BallLocator.
    00005  *
    00006  * @author <a href="mailto:christinez@gmx.de">Christine Zarges</a>
    00007  * @author <a href="mailto:Thorsten.Kerkhof@gmx.de">Thorsten Kerkhof</a>
    00008  */
    00009
    00010 #ifndef __GT2005ParticleContainer_h_
    00011 #define __GT2005ParticleContainer_h_
    00012
    00013 //Number of particles:
    00014 #define numOfBLParticles 40
    00015
    00016 #include "Tools/Debugging/GenericDebugData.h"
    00017 #include "Tools/Math/Common.h"
    00018 #include "Tools/Math/Vector2.h"
    00019 #include "Tools/Math/Pose2D.h"
    00020 #include "Tools/FieldDimensions.h"
    00021 #include "Representations/Cognition/RobotPose.h"
    00022 #include "Representations/Perception/ObstaclesPercept.h"
    00023 #include "Representations/Motion/OdometryData.h"
    00024 #include "Representations/Cognition/SampleSet.h"
    00025 #include "GT2005Particle.h"
    00026 #include <math.h>
    00027
    00028 /**
    00029 * @class GT2005ParticleContainer
    00030 */
    00031 class GT2005ParticleContainer
    00032 {
    00033 public:
    00034   // Constructor:
    00035   GT2005ParticleContainer();
    00036
    00037   //Grid size for the calculation of the estimated ball position:
    00038   #define blMaxGrid 10
    00039
    00040   //A cell in the grid:
    00041   class Cell
    00042   {
    00043     public:
    00044       //The sum of the probabilities of the particles in this cell:
    00045       double count;
    00046       //The first particle in this cell:
    00047       GT2005Particle* first;
    00048
    00049       //Constructor:
    00050       Cell()
    00051       {
    00052         count = 0;
    00053         first = 0;
    00054       }
    00055
    00056       void clear()
    00057       {
    00058         count = 0;
    00059         first = 0;
    00060       }
    00061   };
    00062
    00063   Cell cells[blMaxGrid][blMaxGrid];
    00064   double yMax,
    00065          xMax,
    00066          countMax;
    00067
    00068   GT2005Particle array[numOfBLParticles];
    00069   GT2005Particle& operator[](int index) {return array[index];}
    00070   const GT2005Particle& operator[](int index) const {return array[index];}
    00071   int getNumberOfSamples();
    00072
    00073   //The function gives the index of the particle with the lowest probability,
    00074   //ignoring particles with probability 0:
    00075   int getIndexOfParticleWithLowestProb();
    00076
    00077   //This funtion calculates out of the particles the actual estimated
    00078   //ball position and velocity:
    00079   void calculateEstimatedBall(double& ballX,
    00080                               double& ballY,
    00081                               double& ballP,
    00082                               double& ballVX,
    00083                               double& ballVY,
    00084                               double& ballVP);
    00085 };
    00086
    00087 #endif // __GT2005ParticleContainer_h_