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.1 2007/11/07 13:22:59 martius 00030 * new sound sensor 00031 * 00032 * 00033 * * 00034 ***************************************************************************/ 00035 #ifndef SOUNDSENSOR_H_ 00036 # define SOUNDSENSOR_H_ 00037 00038 #include "sensor.h" 00039 00040 namespace lpzrobots { 00041 00042 /** Sound sensor 00043 with possible direction and frequency detection and also 00044 distance dependence 00045 */ 00046 class SoundSensor: public Sensor { 00047 public: 00048 typedef enum Measure { Segments, Angle, AngleVel }; 00049 00050 /** @param dim Up-axis of the robot (sometimes it is not Z) 00051 */ 00052 SoundSensor(Dimensions dim = Z, Measure measure = Angle, 00053 int segments=1, int levels=1, float maxDistance=1000); 00054 virtual ~SoundSensor(); 00055 00056 virtual void init(Primitive* own){ this->own = own;} 00057 00058 virtual bool sense(const GlobalData& globaldata); 00059 00060 virtual int getSensorNumber() const; 00061 00062 virtual std::list<sensor> get() const; 00063 00064 virtual int get(sensor* sensors, int length) const; 00065 00066 private: 00067 short dim; ///< the axis in which the sensor is selective around 00068 Measure measure; ///< how to measure 00069 int segments; 00070 int levels; 00071 float maxDistance; 00072 00073 double* val; 00074 double* oldangle; 00075 00076 Primitive* own; 00077 00078 }; 00079 00080 00081 00082 00083 } 00084 00085 #endif /* !SOUNDSENSOR_H_ */