epuckIR.hpp
Go to the documentation of this file.
1 /* Copyright 2008 Renato Florentino Garcia <fgar.renato@gmail.com>
2  *
3  * This program is free software: you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License version 2, as
5  * published by the Free Software Foundation.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program. If not, see <http://www.gnu.org/licenses/>.
14  */
15 
16 #ifndef EPUCK_IR_HPP
17 #define EPUCK_IR_HPP
18 
19 #include "epuckInterface.hpp"
20 #include <vector>
21 
31 class EpuckIR : public EpuckInterface
32 {
33 public:
34 
36  static const unsigned SENSOR_QUANTITY = 8;
37 
39  struct IRData
40  {
41  std::vector<float> voltages;
42  std::vector<float> ranges;
43  };
44 
45 
52  EpuckIR(const SerialPort* const serialPort);
53 
60  IRData GetIRData() const;
61 
66  inline std::vector<EpuckInterface::Triple> GetGeometry() const
67  {
68  return this->geometry;
69  }
70 
71 private:
72 
73  std::vector<EpuckInterface::Triple> geometry;
74 };
75 
76 #endif
Class for to get data from e-puck IR sensors.
Definition: epuckIR.hpp:31
const SerialPort *const serialPort
A SerialPort class instance shared among the device interfaces.
Definition: epuckInterface.hpp:59
EpuckIR(const SerialPort *const serialPort)
The EpuckIR class constructor.
Definition: epuckIR.cpp:18
Represents the data got from e-puck IR sensors.
Definition: epuckIR.hpp:39
std::vector< float > ranges
The equivalent obstacle distance.
Definition: epuckIR.hpp:42
std::vector< EpuckInterface::Triple > GetGeometry() const
Give the geometry of each IR sensor in e-puck.
Definition: epuckIR.hpp:66
static const unsigned SENSOR_QUANTITY
The number of IR sensors on e-puck.
Definition: epuckIR.hpp:36
Header file of the EpuckInterface class and the struct EpuckInterface::Triple.
IRData GetIRData() const
Read the IR sensors.
Definition: epuckIR.cpp:64
Base class for all concrete interfaces of e-puck.
Definition: epuckInterface.hpp:33
std::vector< float > voltages
The raw IR readings.
Definition: epuckIR.hpp:41
Send and receive messages from e-puck.
Definition: serialPort.hpp:40