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 
370  int getNumReceptors() const
371  {
372  return m_numReceptors;
373  }
374 
380  const LinearCamera* getCamera() const
381  {
382  return m_camera;
383  }
384 
385 private:
393  virtual void resourceChanged(QString resourceName, ResourceChangeType changeType);
394 
398  PhyEpuck* m_robot;
399 
403  NeuronsIterator* m_neuronsIterator;
404 
412  int m_numReceptors;
413 
420  real m_aperture;
421 
425  LinearCamera* m_camera;
426 
430  const bool m_drawCamera;
431 
436  const bool m_ignoreWalls;
437 };
438 
457 class FARSA_EXPERIMENTS_API EpuckSampledProximityIRSensor : public EpuckSensor
458 {
459 public:
468 
473 
482  virtual void save(ConfigurationParameters& params, QString prefix);
483 
489  static void describe(QString type);
490 
495  virtual void update();
496 
502  virtual int size();
503 
504 private:
512  virtual void resourceChanged(QString resourceName, ResourceChangeType changeType);
513 
517  Epuck* m_robot;
518 
522  Arena* m_arena;
523 
527  NeuronsIterator* m_neuronsIterator;
528 
532  const SampledIRDataLoader m_roundSamples;
533 
537  const SampledIRDataLoader m_smallSamples;
538 
542  const SampledIRDataLoader m_wallSamples;
543 };
544 
545 }
546 
547 #endif
QString m_epuckResource
The name of the resource associated with the e-puck robot.
Definition: epucksensors.h:110
The infrared proximity sensors of the e-puck.
Definition: epucksensors.h:132
The infrared ground sensors of the e-puck.
Definition: epucksensors.h:214
An helper class to load sampled data from file.
Definition: sensors.h:849
The sampled proximity infrared sensors of the e-puck.
Definition: epucksensors.h:457
The class modelling an arena.
Definition: arena.h:50
The base abstract class for iterating over neurons of a neural network.
The class modelling the e-puck robot.
Definition: robots.h:397
This file contains the common type defitions used on the whole framework.
The base abstract class for e-puck sensors.
Definition: epucksensors.h:58
The base abstract class for the Sensor hierarchy.
int getNumReceptors() const
Returns the number of receptors of the camera.
Definition: epucksensors.h:370
An helper class for linear camera sensors of various robots.
Definition: sensors.h:232
const LinearCamera * getCamera() const
Returns the camera sensor used internally.
Definition: epucksensors.h:380
float real
QString m_neuronsIteratorResource
The name of th resource associated with the neural network iterator.
Definition: epucksensors.h:116
The linear camera sensor of the e-puck.
Definition: epucksensors.h:318