kheperasensors.h
1 /********************************************************************************
2  * FARSA Experimentes Library *
3  * Copyright (C) 2007-2012 *
4  * Gianluca Massera <emmegian@yahoo.it> *
5  * Stefano Nolfi <stefano.nolfi@istc.cnr.it> *
6  * Tomassino Ferrauto <tomassino.ferrauto@istc.cnr.it> *
7  * *
8  * This program is free software; you can redistribute it and/or modify *
9  * it under the terms of the GNU General Public License as published by *
10  * the Free Software Foundation; either version 2 of the License, or *
11  * (at your option) any later version. *
12  * *
13  * This program is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16  * GNU General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU General Public License *
19  * along with this program; if not, write to the Free Software *
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
21  ********************************************************************************/
22 
23 #ifndef KHEPERASENSORS_H
24 #define KHEPERASENSORS_H
25 
26 #include "experimentsconfig.h"
27 #include "neuroninterfaces.h"
28 #include "world.h"
29 #include "robots.h"
30 #include "phybox.h"
31 #include "phycylinder.h"
32 #include "sensors.h"
33 
34 namespace farsa {
35 
58 class FARSA_EXPERIMENTS_API KheperaSensor : public Sensor
59 {
60 public:
72  KheperaSensor(ConfigurationParameters& params, QString prefix);
73 
77  virtual ~KheperaSensor();
78 
87  virtual void save(ConfigurationParameters& params, QString prefix);
88 
95  static void describe(QString type);
96 
97 protected:
105  virtual void resourceChanged(QString resourceName, ResourceChangeType changeType);
106 
111 
117 };
118 
131 class FARSA_EXPERIMENTS_API KheperaProximityIRSensor : public KheperaSensor
132 {
133 public:
141  KheperaProximityIRSensor(ConfigurationParameters& params, QString prefix);
142 
146  virtual ~KheperaProximityIRSensor();
147 
156  virtual void save(ConfigurationParameters& params, QString prefix);
157 
163  static void describe(QString type);
164 
169  virtual void update();
170 
176  virtual int size();
177 
178 private:
186  virtual void resourceChanged(QString resourceName, ResourceChangeType changeType);
187 
191  PhyKhepera* m_robot;
192 
196  NeuronsIterator* m_neuronsIterator;
197 };
198 
222 class FARSA_EXPERIMENTS_API KheperaSampledProximityIRSensor : public KheperaSensor
223 {
224 public:
233 
238 
247  virtual void save(ConfigurationParameters& params, QString prefix);
248 
254  static void describe(QString type);
255 
260  virtual void update();
261 
267  virtual int size();
268 
269 private:
277  virtual void resourceChanged(QString resourceName, ResourceChangeType changeType);
278 
282  Khepera* m_robot;
283 
287  Arena* m_arena;
288 
292  NeuronsIterator* m_neuronsIterator;
293 
297  const QVector<bool> m_activeSensors;
298 
304  const int m_numActiveSensors;
305 
309  const SampledIRDataLoader m_roundSamples;
310 
314  const SampledIRDataLoader m_smallSamples;
315 
319  const SampledIRDataLoader m_wallSamples;
320 };
321 
322 }
323 
324 #endif