Enki  1.9
Sbot.h
Go to the documentation of this file.
1 /*
2  Enki - a fast 2D robot simulator
3  Copyright (C) 1999-2016 Stephane Magnenat <stephane at magnenat dot net>
4  Copyright (C) 2004-2005 Markus Waibel <markus dot waibel at epfl dot ch>
5  Copyright (c) 2004-2005 Antoine Beyeler <abeyeler at ab-ware dot com>
6  Copyright (C) 2005-2006 Laboratory of Intelligent Systems, EPFL, Lausanne
7  Copyright (C) 2006-2008 Laboratory of Robotics Systems, EPFL, Lausanne
8  See AUTHORS for details
9 
10  This program is free software; the authors of any publication
11  arising from research using this software are asked to add the
12  following reference:
13  Enki - a fast 2D robot simulator
14  http://home.gna.org/enki
15  Stephane Magnenat <stephane at magnenat dot net>,
16  Markus Waibel <markus dot waibel at epfl dot ch>
17  Laboratory of Intelligent Systems, EPFL, Lausanne.
18 
19  You can redistribute this program and/or modify
20  it under the terms of the GNU General Public License as published by
21  the Free Software Foundation; either version 2 of the License, or
22  (at your option) any later version.
23 
24  This program is distributed in the hope that it will be useful,
25  but WITHOUT ANY WARRANTY; without even the implied warranty of
26  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27  GNU General Public License for more details.
28 
29  You should have received a copy of the GNU General Public License
30  along with this program; if not, write to the Free Software
31  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
32 */
33 
34 #ifndef __ENKI_SBOT_H
35 #define __ENKI_SBOT_H
36 
42 
47 namespace Enki
48 {
50 
54  {
55  protected:
57  static unsigned worldFrequenciesState;
58 
59  public:
61  unsigned frequenciesState;
62 
63  public:
65  SbotGlobalSound (Robot *me) { this->owner = me; }
67  virtual void init() { worldFrequenciesState = 0; }
69  virtual void step(double dt, World *w) { worldFrequenciesState |= frequenciesState; }
71  static unsigned getWorldFrequenciesState(void);
72  };
73 
74 
76 
80  class SbotMicrophone : public FourWayMic
81  {
82  public:
88  SbotMicrophone(Robot *owner, double micDist, double range,
89  MicrophoneResponseModel micModel, unsigned channels) :
90  FourWayMic(owner, micDist, range, micModel, channels) {}
92  void objectStep(double dt, PhysicalObject *po, World *w);
93  };
94 
96 
99  class Sbot : public DifferentialWheeled
100  {
101  public:
106 
107  public:
109  Sbot();
111  ~Sbot() {}
112  };
113 
114 
116 
119  class FeedableSbot : public Sbot
120  {
121  public:
123  double energy;
125  double dEnergy;
127  double lastDEnergy;
128 
130  FeedableSbot() { energy=0; dEnergy=0; lastDEnergy=0; }
132  virtual void controlStep(double dt) ;
133  };
134 
135 
139 
140  class SoundSbot : public FeedableSbot
141  {
142  public:
147  virtual void step(double dt) = 0;
148 
149  public:
151  SoundSbot();
152  };
153 }
154 #endif
155 
virtual void init()
Initialisation, set world frequencies to zero. Called one time for each robot, which could be optimis...
Definition: Sbot.h:67
Specific microphone for S-bots.
Definition: Sbot.h:80
Header of sound emitter interaction.
Definition: DifferentialWheeled.h:45
~Sbot()
Destructor.
Definition: Sbot.h:111
static unsigned worldFrequenciesState
The world frequencies state, mask of all frequencies.
Definition: Sbot.h:57
SbotGlobalSound globalSound
the sound interaction, based on global frequencies
Definition: Sbot.h:105
double lastDEnergy
The previous energy difference.
Definition: Sbot.h:127
1D omnidirectional circular camera, based on 2 CircularCam Pixels start at -PI and then follow mathem...
Definition: CircularCam.h:135
A situated object in the world with mass, geometry properties, physical properties, ...
Definition: PhysicalEngine.h:131
A generic sound sensor/microphone.
Definition: Microphone.h:97
double energy
The actual energy of the Sbot.
Definition: Sbot.h:123
Header of the Sbot Active Object.
Enki is the namespace of the Enki simulator. All Enki functions and classes excepted the math one are...
Definition: BluetoothBase.cpp:44
unsigned frequenciesState
The frequencies state of this robot, mask of all frequencies.
Definition: Sbot.h:61
SbotMicrophone mic
4 microphones
Definition: Sbot.h:144
A very simplified model of the Sbot mobile robot.
Definition: Sbot.h:99
The world is the container of all objects and robots.
Definition: PhysicalEngine.h:411
static unsigned getWorldFrequenciesState(void)
Return state of the frequencies in the world.
Definition: Sbot.cpp:125
Interacts with the whole world.
Definition: Interaction.h:93
OmniCam camera
The omnidirectional linear camera.
Definition: Sbot.h:103
Robot * owner
The physical object that owns the interaction.
Definition: Interaction.h:97
Header of the features of differential wheeled robots.
Interaction sound between all Sbots.
Definition: Sbot.h:53
SbotMicrophone(Robot *owner, double micDist, double range, MicrophoneResponseModel micModel, unsigned channels)
Constructor e.g.
Definition: Sbot.h:88
Header of the generic infrared sensor.
Header of the 1D circular camera.
virtual void step(double dt, World *w)
Emit our frequencies to the world.
Definition: Sbot.h:69
FeedableSbot()
Constructor.
Definition: Sbot.h:130
ActiveSoundSource speaker
1 speaker
Definition: Sbot.h:146
Time limited sound emitter.
Definition: ActiveSoundSource.h:48
double dEnergy
The actual energy difference.
Definition: Sbot.h:125
This Sbot version has sound capabilities inherited from ActiveSoundObject, as well as the feeding and...
Definition: Sbot.h:140
An "improved" Sbot that can interact with SbotActiveObject.
Definition: Sbot.h:119
double(* MicrophoneResponseModel)(double, double)
A function for manipulating acquired sound, normally to model saturation, distance decreasing or freq...
Definition: Microphone.h:50
SbotGlobalSound(Robot *me)
Constructor.
Definition: Sbot.h:65
A robot is a PhysicalObject that has additional interactions and a controller.
Definition: PhysicalEngine.h:379