marxbotsensors.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 MARXBOTSENSORS_H
24 #define MARXBOTSENSORS_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 MarXbotSensor : public Sensor
59 {
60 public:
72  MarXbotSensor(ConfigurationParameters& params, QString prefix);
73 
77  virtual ~MarXbotSensor();
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 MarXbotProximityIRSensor : public MarXbotSensor
132 {
133 public:
141  MarXbotProximityIRSensor(ConfigurationParameters& params, QString prefix);
142 
146  virtual ~MarXbotProximityIRSensor();
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  PhyMarXbot* m_robot;
192 
196  NeuronsIterator* m_neuronsIterator;
197 };
198 
212 class FARSA_EXPERIMENTS_API MarXbotGroundBottomIRSensor : public MarXbotSensor
213 {
214 public:
222  MarXbotGroundBottomIRSensor(ConfigurationParameters& params, QString prefix);
223 
227  virtual ~MarXbotGroundBottomIRSensor();
228 
237  virtual void save(ConfigurationParameters& params, QString prefix);
238 
244  static void describe(QString type);
245 
250  virtual void update();
251 
257  virtual int size();
258 
259 private:
267  virtual void resourceChanged(QString resourceName, ResourceChangeType changeType);
268 
272  PhyMarXbot* m_robot;
273 
277  NeuronsIterator* m_neuronsIterator;
278 };
279 
293 class FARSA_EXPERIMENTS_API MarXbotGroundAroundIRSensor : public MarXbotSensor
294 {
295 public:
303  MarXbotGroundAroundIRSensor(ConfigurationParameters& params, QString prefix);
304 
308  virtual ~MarXbotGroundAroundIRSensor();
309 
318  virtual void save(ConfigurationParameters& params, QString prefix);
319 
325  static void describe(QString type);
326 
331  virtual void update();
332 
338  virtual int size();
339 
340 private:
348  virtual void resourceChanged(QString resourceName, ResourceChangeType changeType);
349 
353  PhyMarXbot* m_robot;
354 
358  NeuronsIterator* m_neuronsIterator;
359 };
360 
387 class FARSA_EXPERIMENTS_API MarXbotLinearCameraSensor : public MarXbotSensor
388 {
389 public:
397  MarXbotLinearCameraSensor(ConfigurationParameters& params, QString prefix);
398 
402  virtual ~MarXbotLinearCameraSensor();
403 
412  virtual void save(ConfigurationParameters& params, QString prefix);
413 
419  static void describe(QString type);
420 
425  virtual void update();
426 
432  virtual int size();
433 
434 private:
442  virtual void resourceChanged(QString resourceName, ResourceChangeType changeType);
443 
447  PhyMarXbot* m_robot;
448 
452  NeuronsIterator* m_neuronsIterator;
453 
461  int m_numReceptors;
462 
469  real m_aperture;
470 
474  LinearCamera* m_camera;
475 
479  const bool m_drawCamera;
480 };
481 
482 namespace __MarXbotTractionSensor_internal {
483  class TractionSensorGraphic;
484 }
485 
505 class FARSA_EXPERIMENTS_API MarXbotTractionSensor : public MarXbotSensor
506 {
507 public:
515  MarXbotTractionSensor(ConfigurationParameters& params, QString prefix);
516 
520  virtual ~MarXbotTractionSensor();
521 
530  virtual void save(ConfigurationParameters& params, QString prefix);
531 
537  static void describe(QString type);
538 
543  virtual void update();
544 
550  virtual int size();
551 
552 private:
560  virtual void resourceChanged(QString resourceName, ResourceChangeType changeType);
561 
565  PhyMarXbot* m_robot;
566 
570  NeuronsIterator* m_neuronsIterator;
571 
576  const real m_maxForce;
577 
582  const bool m_drawSensor;
583 
588 };
589 
590 }
591 
592 #endif