00001 /** 00002 * @file Tools/Math/GaussBell.h 00003 * Declaration of class GaussBell. 00004 * 00005 * @author <a href=mailto:Kai_Engel@gmx.de>Kai Engel</a> 00006 */ 00007 00008 #ifndef __GaussBell_h_ 00009 #define __GaussBell_h_ 00010 00011 #include "Tools/Math/Matrix2x2.h" 00012 #include "Tools/Math/Vector2.h" 00013 #include "Tools/Debugging/DebugDrawings.h" 00014 00015 /** 00016 * @class GaussBell 00017 * This class contains attributes and methods which are necessary for the fusion 00018 * of Gauss-Bells. The percepts from differnt robots will be interpreted as 00019 * values which defines special Gauss-Bells. 00020 * 00021 * @author <A href=mailto:kai_engel@gmx.de>Kai Engel</A> 00022 */ 00023 class GaussBell 00024 { 00025 public: 00026 00027 /** 00028 * Constructor. 00029 */ 00030 GaussBell(); 00031 ~GaussBell(); 00032 00033 //############################################################################################### 00034 //# --- Get-Methods: # 00035 //############################################################################################### 00036 Matrix2x2<double> getCovarianceMatrix();/**< Returns the covariance matrix of the 00037 Gaussbell. */ 00038 Vector2<double> getPositionOfMaximum();/**< Returns the position of the GaussBell-Maximum */ 00039 double getValidity(Vector2<double> _position);/**< Returns the validity-value at the position given in the argument*/ 00040 double getValidityAtPositionOfMaximum(); 00041 unsigned int getTimeStamp(); 00042 void getSigmas(double& sigmaMaj, double& sigmaMin); /**< Returns the sigmas */ 00043 double getAngle(); /**< Returns the angle */ 00044 00045 //############################################################################################### 00046 //# --- Set-Methods: # 00047 //############################################################################################### 00048 void setCovarianceMatrix(double _validity, double _angle);/**< Sets the covarianceMatrix by the percepts of a player */ 00049 void setCovarianceMatrix(double _validity, double _deltaX, double _deltaY); /**< like the previous method aber faster! */ 00050 void setCovarianceMatrix(Matrix2x2<double> _covarianceMatrix);/**< Sets the covarianceMatrix by another Matrix */ 00051 void setCovarianceMatrix(double _sigmaMaj, double _sigmaMin, double _deltaX, double _deltaY); /** when the sigmas are given but no validity 00052 This method will be used for the SensorFusionPlayersLocator */ 00053 void setPositionOfMaximum(Vector2<double> _positionOfMaximum);/**< Sets the position of one object one robot has percepted*/ 00054 void setRotationAngle(double _rotationAngle); 00055 void setValidity(double _validity); 00056 void setSigmas(double _sigmaMaj, double _sigmaMin); 00057 00058 void setTimeStamp(unsigned long _timeStampGaussBell); 00059 void setTimeStamp(); /**< set the time stamp to the actual system time */ 00060 00061 void updateValidity(double _validity); /**< if a older percept should be merged the validity has to be decreased. 00062 This will be used in SensorFusionBallLocator. */ 00063 00064 //############################################################################################### 00065 //# --- other Methods: # 00066 //############################################################################################### 00067 void mergeBells(GaussBell _gaussBell1, GaussBell _gaussBell2); /**< merges the bells _gaussBell1 and _gaussBell2 */ 00068 00069 private: 00070 Matrix2x2<double> covarianceMatrix; 00071 Vector2<double> position; // double because of calculating the merged position 00072 00073 double sigmaMaj, /**< variance in maj. direction */ 00074 sigmaMin; /**< variance in min. direction */ 00075 double rotationAngle; 00076 double validity; /**< the validity of the percept */ 00077 00078 static const int phi[330]; /**< phi-table of the normalized gauss distribution (index: factor 100, array: factor 10000) */ 00079 static const int invProb[1000]; /**< inverted probability table of the normalized gauss distribution (index: factor 1000, array: factor 100) */ 00080 static const double radiusMaj; /**< radius in maj-direction of the validity-ellipse. the validity is the probability that the real position lies within this ellipe*/ 00081 static const double radiusMin; /**< radius in min-direction of the validity-ellipse */ 00082 static const double factor; 00083 00084 void transformSigmaToValidity(); 00085 void transformValidityToSigma(); /**< calculates sigmaMaj and sigmaMin when only the validity is given */ 00086 void updateSigmasAndAngle(); /**< calculates sigmaMaj, sigamMin and rotationAngle form the covariance matrix */ 00087 void updateCovarianceMatrix(); /**< calculates the CovarianceMatrix from sigmaMaj, sigmaMin and the rotationAngle */ 00088 00089 unsigned long timeStampGaussBell; /**< The time when this GaussBell was active. 00090 This attribut will be needed for merging history-Data into the fusion. */ 00091 }; 00092 00093 00094 #endif// __GaussBell_h_ 00095 00096 /* 00097 * Changelog: 00098 * 00099 * $Log: GaussBell.h,v $ 00100 * Revision 1.1.1.1 2004/05/22 17:37:04 cvsadm 00101 * created new repository GT2004_WM 00102 * 00103 * Revision 1.1 2003/10/07 10:13:24 cvsadm 00104 * Created GT2004 (M.J.) 00105 * 00106 * Revision 1.2 2003/09/28 09:28:48 juengel 00107 * Comments corrected. 00108 * 00109 * Revision 1.1 2003/09/26 11:40:40 juengel 00110 * - sorted tools 00111 * - clean-up in DataTypes 00112 * 00113 * Revision 1.1.1.1 2003/07/02 09:40:28 cvsadm 00114 * created new repository for the competitions in Padova from the 00115 * tamara CVS (Tuesday 2:00 pm) 00116 * 00117 * removed unused solutions 00118 * 00119 * Revision 1.3 2003/05/22 06:48:44 dueffert 00120 * doxygen docu corrected 00121 * 00122 * Revision 1.2 2003/05/19 15:35:01 wachter 00123 * Moved genration of debug-drawing 00124 * 00125 * Revision 1.1 2003/05/19 09:17:30 wachter 00126 * Renamed SensorFusionGaussBell to GaussBell as requested. 00127 * 00128 * Revision 1.8 2003/04/25 11:32:03 engel 00129 * Coments inserted 00130 * 00131 * Revision 1.7 2003/04/06 15:57:52 engel 00132 * Little changes (cosmetic and some improvements). 00133 * 00134 * Revision 1.6 2003/04/01 15:57:52 wachter 00135 * Fix of transformValidityToSigma 00136 * 00137 * Revision 1.5 2003/03/31 14:03:06 wachter 00138 * Cleanup of SensorFusionGaussBell, 00139 * added "real" Validity to SensorFusionGaussBell 00140 * 00141 * Revision 1.4 2003/03/21 15:11:52 engel 00142 * fixed crash for dx=dy=0 00143 * inserted getValitityAtPositionOfMaximum() 00144 * 00145 * Revision 1.3 2003/02/25 16:51:16 engel 00146 * some changes to calculate the validity (mean-Value) 00147 * 00148 * Revision 1.2 2003/02/25 11:43:44 dueffert 00149 * line feed and doxygen bugs fixed 00150 * 00151 * Revision 1.1 2003/02/14 14:34:02 wachter 00152 * Added SensorFusionBallLocator 00153 * 00154 * 00155 */