00001 /*************************************************************************** 00002 * Copyright (C) 2007 by Robot Group Leipzig * 00003 * georg@nld.ds.mpg.de * 00004 * fhesse@informatik.uni-leipzig.de * 00005 * der@informatik.uni-leipzig.de * 00006 * * 00007 ** Started on Mon Oct 15 16:48:03 2007 Georg Martius * 00008 ** Last update Mon Oct 15 16:48:03 2007 Georg Martius * 00009 * * 00010 * This program is free software; you can redistribute it and/or modify * 00011 * it under the terms of the GNU General Public License as published by * 00012 * the Free Software Foundation; either version 2 of the License, or * 00013 * (at your option) any later version. * 00014 * * 00015 * This program is distributed in the hope that it will be useful, * 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00018 * GNU General Public License for more details. * 00019 * * 00020 * You should have received a copy of the GNU General Public License * 00021 * along with this program; if not, write to the * 00022 * Free Software Foundation, Inc., * 00023 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00024 *************************************************************************** 00025 * * 00026 * DESCRIPTION * 00027 * * 00028 * $Log: soundsensor.h,v $ 00029 * Revision 1.2 2009/08/10 07:49:11 guettler 00030 * removed typedef to avoid compiler warnings 00031 * 00032 * Revision 1.1 2007/11/07 13:22:59 martius 00033 * new sound sensor 00034 * 00035 * 00036 * * 00037 ***************************************************************************/ 00038 #ifndef SOUNDSENSOR_H_ 00039 # define SOUNDSENSOR_H_ 00040 00041 #include "sensor.h" 00042 00043 namespace lpzrobots { 00044 00045 /** Sound sensor 00046 with possible direction and frequency detection and also 00047 distance dependence 00048 */ 00049 class SoundSensor: public Sensor { 00050 public: 00051 /* typedef */ enum Measure { Segments, Angle, AngleVel }; 00052 00053 /** @param dim Up-axis of the robot (sometimes it is not Z) 00054 */ 00055 SoundSensor(Dimensions dim = Z, Measure measure = Angle, 00056 int segments=1, int levels=1, float maxDistance=1000); 00057 virtual ~SoundSensor(); 00058 00059 virtual void init(Primitive* own){ this->own = own;} 00060 00061 virtual bool sense(const GlobalData& globaldata); 00062 00063 virtual int getSensorNumber() const; 00064 00065 virtual std::list<sensor> get() const; 00066 00067 virtual int get(sensor* sensors, int length) const; 00068 00069 private: 00070 short dim; ///< the axis in which the sensor is selective around 00071 Measure measure; ///< how to measure 00072 int segments; 00073 int levels; 00074 float maxDistance; 00075 00076 double* val; 00077 double* oldangle; 00078 00079 Primitive* own; 00080 00081 }; 00082 00083 00084 00085 00086 } 00087 00088 #endif /* !SOUNDSENSOR_H_ */