epucksensors.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 EPUCKSENSORS_H
24 #define EPUCKSENSORS_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 EpuckSensor : public Sensor
59 {
60 public:
72  EpuckSensor(ConfigurationParameters& params, QString prefix);
73 
77  virtual ~EpuckSensor();
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 
132 class FARSA_EXPERIMENTS_API EpuckProximityIRSensor : public EpuckSensor
133 {
134 public:
142  EpuckProximityIRSensor(ConfigurationParameters& params, QString prefix);
143 
147  virtual ~EpuckProximityIRSensor();
148 
157  virtual void save(ConfigurationParameters& params, QString prefix);
158 
164  static void describe(QString type);
165 
170  virtual void update();
171 
177  virtual int size();
178 
179 private:
187  virtual void resourceChanged(QString resourceName, ResourceChangeType changeType);
188 
192  PhyEpuck* m_robot;
193 
197  NeuronsIterator* m_neuronsIterator;
198 };
199 
214 class FARSA_EXPERIMENTS_API EpuckGroundIRSensor : public EpuckSensor
215 {
216 public:
224  EpuckGroundIRSensor(ConfigurationParameters& params, QString prefix);
225 
229  virtual ~EpuckGroundIRSensor();
230 
239  virtual void save(ConfigurationParameters& params, QString prefix);
240 
246  static void describe(QString type);
247 
252  virtual void update();
253 
259  virtual int size();
260 
261 private:
269  virtual void resourceChanged(QString resourceName, ResourceChangeType changeType);
270 
274  PhyEpuck* m_robot;
275 
279  NeuronsIterator* m_neuronsIterator;
280 
284  Arena* m_arena;
285 };
286 
318 class FARSA_EXPERIMENTS_API EpuckLinearCameraSensor : public EpuckSensor
319 {
320 public:
328  EpuckLinearCameraSensor(ConfigurationParameters& params, QString prefix);
329 
333  virtual ~EpuckLinearCameraSensor();
334 
343  virtual void save(ConfigurationParameters& params, QString prefix);
344 
350  static void describe(QString type);
351 
356  virtual void update();
357 
363  virtual int size();
364 
365 private:
373  virtual void resourceChanged(QString resourceName, ResourceChangeType changeType);
374 
378  PhyEpuck* m_robot;
379 
383  NeuronsIterator* m_neuronsIterator;
384 
392  int m_numReceptors;
393 
400  real m_aperture;
401 
405  LinearCamera* m_camera;
406 
410  const bool m_drawCamera;
411 
416  const bool m_ignoreWalls;
417 };
418 
437 class FARSA_EXPERIMENTS_API EpuckSampledProximityIRSensor : public EpuckSensor
438 {
439 public:
448 
453 
462  virtual void save(ConfigurationParameters& params, QString prefix);
463 
469  static void describe(QString type);
470 
475  virtual void update();
476 
482  virtual int size();
483 
484 private:
492  virtual void resourceChanged(QString resourceName, ResourceChangeType changeType);
493 
497  Epuck* m_robot;
498 
502  Arena* m_arena;
503 
507  NeuronsIterator* m_neuronsIterator;
508 
512  const SampledIRDataLoader m_roundSamples;
513 
517  const SampledIRDataLoader m_smallSamples;
518 
522  const SampledIRDataLoader m_wallSamples;
523 };
524 
525 }
526 
527 #endif