00001 /*************************************************************************** 00002 * Copyright (C) 2005 by Robot Group Leipzig * 00003 * martius@informatik.uni-leipzig.de * 00004 * fhesse@informatik.uni-leipzig.de * 00005 * der@informatik.uni-leipzig.de * 00006 * frankguettler@gmx.de * 00007 * joergweide84@aol.com (robot12) * 00008 * * 00009 * This program is free software; you can redistribute it and/or modify * 00010 * it under the terms of the GNU General Public License as published by * 00011 * the Free Software Foundation; either version 2 of the License, or * 00012 * (at your option) any later version. * 00013 * * 00014 * This program is distributed in the hope that it will be useful, * 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00017 * GNU General Public License for more details. * 00018 * * 00019 * You should have received a copy of the GNU General Public License * 00020 * along with this program; if not, write to the * 00021 * Free Software Foundation, Inc., * 00022 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00023 *************************************************************************** 00024 * * 00025 * DESCRIPTION * 00026 * * 00027 * $Log: trackablemeasure.h,v $ 00028 * Revision 1.3 2009/08/03 14:09:48 jhoffmann 00029 * Remove some compiling warnings, memory leaks; Add some code cleanups 00030 * 00031 * Revision 1.2 2009/07/15 12:59:05 robot12 00032 * one bugfixe in constructor (parameter type char* to const char*) 00033 * 00034 * Revision 1.1 2009/03/27 06:16:58 guettler 00035 * support for gcc 4.3 compatibility (has to be checked), StatisticTools moves from utils to statistictools 00036 * 00037 * Revision 1.1 2007/12/06 10:18:10 der 00038 * AbstractMeasure is now a abstract type for Measures, 00039 * StatisticTools now supports AbstractMeasures, 00040 * StatisticalMeasure, ComplexMeasure now derived from 00041 * AbstractMeasure, 00042 * ComplexMeasure provides support for calculation e.g. entropy, 00043 * uses Discretisizer, 00044 * Discretisizer is a stand-alone class for support of discretisizing values 00045 * TrackableMeasure derived from ComplexMeasure and provides support for calculating complex measures for Trackable objects 00046 * 00047 * Revision 1.3 2007/09/28 08:48:21 robot3 00048 * corrected some minor bugs, files are still in develop status 00049 * 00050 * Revision 1.2 2007/09/27 10:49:39 robot3 00051 * removed some minor bugs, 00052 * added CONVergence test 00053 * changed little things for support of the new WSM 00054 * 00055 * Revision 1.1 2007/05/07 21:01:31 robot3 00056 * statistictools is a class for easy visualization of measurements of observed values 00057 * it is possible to add the observed value itself with mode ID 00058 * 00059 * * 00060 ***************************************************************************/ 00061 #ifndef _TRACKABLE_MEASURE_H 00062 #define _TRACKABLE_MEASURE_H 00063 00064 #include "complexmeasure.h" 00065 #include "trackable.h" 00066 #include <list> 00067 #include "position.h" 00068 00069 /** 00070 * NOTE: SPEED and ANGSPEED is not implemented yet! 00071 */ 00072 enum TrackMode { 00073 POS, /// takes the position for the measure 00074 SPEED, /// takes the speed for the measure 00075 ANGSPEED /// takes the angular speed for the measure 00076 }; 00077 00078 /// defines which dimensions should be count. 00079 enum Dimensions { X = 1, Y = 2, Z = 4 }; 00080 00081 00082 class TrackableMeasure : public ComplexMeasure { 00083 00084 public: 00085 00086 /** 00087 * creates a new TrackableMeasure. The position of the Trackables in the 00088 * given list is counted in a fequency list. The possible positions are 00089 * given by the cornerPointList, which contains the cornerPoints of the 00090 * arena where the trackables are placed. 00091 * the complex measure ist then based on the frequency list 00092 * @param trackableList the list of the Trackables 00093 * @param cornerPointList the list with the cornerPoints of the arena 00094 * @param dimensions which dimensions do you like to count? Note that 00095 * the needed memory is (numberBins^ndim), but calculation costs are O(1) 00096 * @param cmode which type of complex measure should be evaluated? 00097 * @param numberBins number of bins used for discretisation 00098 */ 00099 TrackableMeasure(std::list<Trackable*> trackableList,const char* measureName ,ComplexMeasureMode cmode,std::list<Position> cornerPointList, short dimensions, int numberBins); 00100 00101 //virtual ~TrackableMeasure(); 00102 00103 /** 00104 * defined by AbstractMeasure. This method is called from StatisticTools 00105 for updating the measure in every simStep (ODE). 00106 */ 00107 virtual void step(); 00108 00109 00110 protected: 00111 std::list<Trackable*> trackableList; 00112 ComplexMeasureMode cmode; 00113 TrackMode tmode; 00114 00115 virtual double findRange(std::list<Position> positionList,short dim, bool min); 00116 00117 virtual void addDimension(short dim, std::list<Position> cornerPointList); 00118 00119 }; 00120 00121 #endif