Main MRPT website > C++ reference for MRPT 1.9.9
CPhidgetInterfaceKitProximitySensors.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #ifndef CPhidgetInterfaceKitProximitySensors_H
11 #define CPhidgetInterfaceKitProximitySensors_H
12 
14 #include <mrpt/poses/CPoint3D.h>
17 
18 namespace mrpt
19 {
20 namespace hwdrivers
21 {
22 /** \brief : An interface for the phidget Interface kit board (1018).
23  * \class CPhidgetInterfaceKitProximitySensors
24  * \author Adrien BARRAL - Robopec (aba@robopec.com).
25  *
26  * An interface for the Phidgets Interface kit board (part number 1018) on wich
27  * it could be plugged either an Sharp IR adaptater board
28  * (phidget's part number : 1101),or a MaxBotix EZ-1 sonar (phidget's part
29  * number : 1118).
30  * The configuration file describe what is plugged to this board, and the
31  * geometry of the sensors on the robots. See the exemple below.
32  * \code
33  * [PhidgetInterfaceKitProximitySensors]
34  * sensorLabel = FrontProximitySensors
35  * process_rate = 100 // Integer value in Hz (common to
36  * all
37  * sensors),
38  * default value is 50Hz.
39  * displayRecapitulativeInformations = true // default value = false.
40  * serialNumber = 12345 // The interface kit serial number
41  * (Integer
42  * value),
43  * default value is -1.
44  * sensor1 = SHARP-30cm // sharp InfraRed sensor 30cm range
45  * (string
46  * value).
47  * capital to convert raw data to range data (in meters).
48  * pose1_x = 0 // position on the robot (float
49  * value
50  * in
51  * meters)
52  * pose1_y = 0
53  * pose1_z = 0.5
54  * pose1_yaw = -45.0 // Angles in degrees (float value).
55  * pose1_pitch = 0
56  * pose1_roll = 0
57  * //...
58  * sensorn = EZ1 // Maxbotix Ultrasound sonar
59  * posen_x = 0
60  * // ...
61  * \endcode
62  *
63  * The maximum number of sensors on this board is 8. Sensor 1 is the first
64  * sensor. If you haven't plugged any sensor on an entry of the board, you
65  * haven't to specify
66  * anyithing about this sensor in the configuration file.
67  * The following table enumerate the different sensors supported by this class.
68  * \latexonly
69  * \begin{tabular}{|c|c|c}
70  * \hline
71  * Part Number & Config file indentifiant & IR or US
72  * \hline
73  * MaxBotix EZ-1 Sonar Sensor & EZ1 & US \\
74  * GP2D12 & SHARP-30cm & IR \\
75  * GP2Y0A21** & SHARP-80cm & IR \\
76  * \hline
77  * \end{tabular}
78  *
79  * This isn't an event based implementation of the phidget library. That means
80  * that when an instanciation of a CPhidgetInterfaceKitProximitySensors is done,
81  * the constructor will block during
82  * in the worst case 200ms, if the board isn't found, an exception will be
83  * thrown.
84  * mrpt::obs::CObservation returned by this class is a CObservationRange.
85  * CObservationrange::minSensorDistance will be the minimum of the minimum of
86  * the sensor distances, e.g if you plug to the interface
87  * kit a GP2D12 (min range 4 cm) and a GP2Y0A21 (min range 8 cm), then
88  * CObservationrange::minSensorDistance = min(0.04,0.08) = 0.04. Respectively
89  * for the maximal range.
90  * \endlatexonly
91  * \warning{The Phidget library use udev. By default, udev require to be root to
92  * be launched, if you want to be able to run a program wich use a phidget board
93  * without be root, you must modify files in /etc/udev/rules.d .}
94  * \ingroup mrpt_hwdrivers_grp
95  */
97 {
102 };
103 
104 class CPhidgetInterfaceKitProximitySensors : public mrpt::utils::COutputLogger,
105  public CGenericSensor
106 {
108 
109  public:
110  /** Constructor
111  * \param serialNumber The board's serial number. Set -1 to choose the
112  * first available board
113  */
115 
116  /** Destructor
117  */
119 
120  /** This method tries to get a set of range measurements from the IR
121  * sensors.
122  * \param outThereIsObservation Will be true if an observation was
123  * sucessfully received.
124  */
125  void getObservation(mrpt::obs::CObservationRange& outObservation);
126  /** Initialize the sensor according to the parameters previously read in the
127  * configuration file.
128  * \exception throw an exception if the board could not be found.
129  * \exception throw an exception if the process rate can't be set on one of
130  * the board channel.
131  */
132  void initialize();
133 
134  /** This method should be called periodically. Period depend on the
135  * process_rate in the configuration file.
136  */
137  void doProcess();
138 
139  private:
140  /** An 8 dimension vector of boolean value wich store the presence or
141  * abscence of a sensor on the phidget interface kit board.
142  */
143  std::vector<bool> m_sensorIsPlugged;
144  /** The minimum range in meters, this field is automaticaly filled according
145  * to the sensor part number read in the configuration file.
146  * Size of this vector depend on the number of sensors described in the
147  * configuration file.
148  */
149  std::vector<float> m_minRange;
150 
151  /** The maximum range in meters, this field is automaticaly filled according
152  * to the sensor part number read in the configuration file.
153  * Size of this vector depend on the number of sensors described in the
154  * configuration file.
155  */
156  std::vector<float> m_maxRange;
157 
158  /** The sensor type.
159  */
160  std::vector<SensorType> m_sensorType;
161  /** The poses of the 8 sensors x[m] y[m] z[m] yaw[deg] pitch[deg] roll[deg].
162  * This field is automaticaly filled according to the sensor
163  * described in the configuration file.
164  */
165  std::vector<mrpt::poses::CPose3D> m_sensorPoses;
166 
167  /** The board serial number read in the configuration file. -1 for any
168  * board.
169  */
173 
174  void* m_carteInterfaceKit; // CPhidgetInterfaceKitHandle
175 
176  /** See the class documentation at the top for expected parameters */
178  const mrpt::utils::CConfigFileBase& configSource,
179  const std::string& iniSection);
180 }; // end class
181 
182 } // end namespace
183 } // end namespace
184 
185 #endif
A generic interface for a wide-variety of sensors designed to be used in the application RawLogGrabbe...
Declares a class derived from "CObservation" that encapsules a single range measurement, and associated parameters.
void getObservation(mrpt::obs::CObservationRange &outObservation)
This method tries to get a set of range measurements from the IR sensors.
This class allows loading and storing values and vectors of different types from a configuration text...
int m_serialNumber
The board serial number read in the configuration file.
std::vector< mrpt::poses::CPose3D > m_sensorPoses
The poses of the 8 sensors x[m] y[m] z[m] yaw[deg] pitch[deg] roll[deg].
std::vector< bool > m_sensorIsPlugged
An 8 dimension vector of boolean value wich store the presence or abscence of a sensor on the phidget...
GLsizei const GLchar ** string
Definition: glext.h:4101
std::vector< float > m_minRange
The minimum range in meters, this field is automaticaly filled according to the sensor part number re...
#define DEFINE_GENERIC_SENSOR(class_name)
This declaration must be inserted in all CGenericSensor classes definition, within the class declarat...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
std::vector< float > m_maxRange
The maximum range in meters, this field is automaticaly filled according to the sensor part number re...
: An interface for the phidget Interface kit board (1018).
void loadConfig_sensorSpecific(const mrpt::utils::CConfigFileBase &configSource, const std::string &iniSection)
See the class documentation at the top for expected parameters.
void initialize()
Initialize the sensor according to the parameters previously read in the configuration file...



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019