00001 /* 00002 Enki - a fast 2D robot simulator 00003 Copyright (C) 1999-2005 Stephane Magnenat <stephane at magnenat dot net> 00004 Copyright (C) 2005 Laboratory of Intelligent Systems, EPFL, Lausanne 00005 See AUTHORS for details 00006 00007 This program is free software; the authors of any publication 00008 arising from research using this software are asked to add the 00009 following reference: 00010 Enki - a fast 2D robot simulator part of the Teem framework 00011 http://teem.epfl.ch 00012 Stephane Magnenat <stephane at magnenat dot net>, 00013 Markus Waibel <markus dot waibel at epfl dot ch> 00014 Laboratory of Intelligent Systems, EPFL, Lausanne. 00015 00016 You can redistribute this program and/or modify 00017 it under the terms of the GNU General Public License as published by 00018 the Free Software Foundation; either version 2 of the License, or 00019 (at your option) any later version. 00020 00021 This program is distributed in the hope that it will be useful, 00022 but WITHOUT ANY WARRANTY; without even the implied warranty of 00023 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00024 GNU General Public License for more details. 00025 00026 You should have received a copy of the GNU General Public License 00027 along with this program; if not, write to the Free Software 00028 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00029 */ 00030 00031 #ifndef __SBOT_H 00032 #define __SBOT_H 00033 00034 #include <enki/PhysicalEngine.h> 00035 #include <enki/robots/s-bot/SbotCam.h> 00036 00041 namespace Enki 00042 { 00044 00047 class SbotGlobalSound : public GlobalInteraction 00048 { 00049 protected: 00051 static unsigned worldFrequenciesState; 00052 00053 public: 00055 unsigned frequenciesState; 00056 00057 public: 00059 SbotGlobalSound::SbotGlobalSound (Robot *me) { this->owner = me; } 00061 virtual void init() { worldFrequenciesState = 0; } 00063 virtual void step(double dt, World *w) { worldFrequenciesState |= frequenciesState; } 00065 static unsigned getWorldFrequenciesState(void); 00066 }; 00067 00069 00072 class Sbot : public Robot 00073 { 00074 public: 00076 SbotCam camera; 00078 SbotGlobalSound sound; 00079 00080 public: 00082 double leftSpeed, rightSpeed; 00083 00084 public: 00086 Sbot(); 00088 ~Sbot() {} 00090 virtual void step(double dt); 00091 }; 00092 00093 // TODO : handle this nicely 00094 00096 00099 class FeedableSbot : public Sbot 00100 { 00101 public: 00103 double energy; 00105 double dEnergy; 00107 double lastDEnergy; 00108 00110 FeedableSbot() { energy=0; dEnergy=0; lastDEnergy=0; } 00112 virtual void step(double dt) ; 00113 }; 00114 } 00115 #endif 00116