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 
131 class FARSA_EXPERIMENTS_API EpuckProximityIRSensor : public EpuckSensor
132 {
133 public:
141  EpuckProximityIRSensor(ConfigurationParameters& params, QString prefix);
142 
146  virtual ~EpuckProximityIRSensor();
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  PhyEpuck* m_robot;
192 
196  NeuronsIterator* m_neuronsIterator;
197 };
198 
211 class FARSA_EXPERIMENTS_API EpuckGroundIRSensor : public EpuckSensor
212 {
213 public:
221  EpuckGroundIRSensor(ConfigurationParameters& params, QString prefix);
222 
226  virtual ~EpuckGroundIRSensor();
227 
236  virtual void save(ConfigurationParameters& params, QString prefix);
237 
243  static void describe(QString type);
244 
249  virtual void update();
250 
256  virtual int size();
257 
258 private:
266  virtual void resourceChanged(QString resourceName, ResourceChangeType changeType);
267 
271  PhyEpuck* m_robot;
272 
276  NeuronsIterator* m_neuronsIterator;
277 };
278 
306 class FARSA_EXPERIMENTS_API EpuckLinearCameraSensor : public EpuckSensor
307 {
308 public:
316  EpuckLinearCameraSensor(ConfigurationParameters& params, QString prefix);
317 
321  virtual ~EpuckLinearCameraSensor();
322 
331  virtual void save(ConfigurationParameters& params, QString prefix);
332 
338  static void describe(QString type);
339 
344  virtual void update();
345 
351  virtual int size();
352 
353 private:
361  virtual void resourceChanged(QString resourceName, ResourceChangeType changeType);
362 
366  PhyEpuck* m_robot;
367 
371  NeuronsIterator* m_neuronsIterator;
372 
380  int m_numReceptors;
381 
388  real m_aperture;
389 
393  LinearCamera* m_camera;
394 
398  const bool m_drawCamera;
399 };
400 
418 class FARSA_EXPERIMENTS_API EpuckSampledProximityIRSensor : public EpuckSensor
419 {
420 public:
429 
434 
443  virtual void save(ConfigurationParameters& params, QString prefix);
444 
450  static void describe(QString type);
451 
456  virtual void update();
457 
463  virtual int size();
464 
465 private:
473  virtual void resourceChanged(QString resourceName, ResourceChangeType changeType);
474 
478  Epuck* m_robot;
479 
483  Arena* m_arena;
484 
488  NeuronsIterator* m_neuronsIterator;
489 
493  const SampledIRDataLoader m_roundSamples;
494 
498  const SampledIRDataLoader m_smallSamples;
499 
503  const SampledIRDataLoader m_wallSamples;
504 };
505 
506 }
507 
508 #endif