Main MRPT website > C++ reference for MRPT 1.5.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 it could be plugged either an Sharp IR adaptater board
27  * (phidget's part number : 1101),or a MaxBotix EZ-1 sonar (phidget's part number : 1118).
28  * The configuration file describe what is plugged to this board, and the geometry of the sensors on the robots. See the exemple below.
29  * \code
30  * [PhidgetInterfaceKitProximitySensors]
31  * sensorLabel = FrontProximitySensors
32  * process_rate = 100 // Integer value in Hz (common to all sensors), default value is 50Hz.
33  * displayRecapitulativeInformations = true // default value = false.
34  * serialNumber = 12345 // The interface kit serial number (Integer value), default value is -1.
35  * sensor1 = SHARP-30cm // sharp InfraRed sensor 30cm range (string value). capital to convert raw data to range data (in meters).
36  * pose1_x = 0 // position on the robot (float value in meters)
37  * pose1_y = 0
38  * pose1_z = 0.5
39  * pose1_yaw = -45.0 // Angles in degrees (float value).
40  * pose1_pitch = 0
41  * pose1_roll = 0
42  * //...
43  * sensorn = EZ1 // Maxbotix Ultrasound sonar
44  * posen_x = 0
45  * // ...
46  * \endcode
47  *
48  * The maximum number of sensors on this board is 8. Sensor 1 is the first sensor. If you haven't plugged any sensor on an entry of the board, you haven't to specify
49  * anyithing about this sensor in the configuration file.
50  * The following table enumerate the different sensors supported by this class.
51  * \latexonly
52  * \begin{tabular}{|c|c|c}
53  * \hline
54  * Part Number & Config file indentifiant & IR or US
55  * \hline
56  * MaxBotix EZ-1 Sonar Sensor & EZ1 & US \\
57  * GP2D12 & SHARP-30cm & IR \\
58  * GP2Y0A21** & SHARP-80cm & IR \\
59  * \hline
60  * \end{tabular}
61  *
62  * This isn't an event based implementation of the phidget library. That means that when an instanciation of a CPhidgetInterfaceKitProximitySensors is done, the constructor will block during
63  * in the worst case 200ms, if the board isn't found, an exception will be thrown.
64  * mrpt::obs::CObservation returned by this class is a CObservationRange. CObservationrange::minSensorDistance will be the minimum of the minimum of the sensor distances, e.g if you plug to the interface
65  * kit a GP2D12 (min range 4 cm) and a GP2Y0A21 (min range 8 cm), then CObservationrange::minSensorDistance = min(0.04,0.08) = 0.04. Respectively for the maximal range.
66  * \endlatexonly
67  * \warning{The Phidget library use udev. By default, udev require to be root to be launched, if you want to be able to run a program wich use a phidget board without be root, you must modify files in /etc/udev/rules.d .}
68  * \ingroup mrpt_hwdrivers_grp
69  */
71 
72  class HWDRIVERS_IMPEXP CPhidgetInterfaceKitProximitySensors : public mrpt::utils::COutputLogger, public CGenericSensor
73  {
75 
76  public:
77  /** Constructor
78  * \param serialNumber The board's serial number. Set -1 to choose the first available board
79  */
81 
82  /** Destructor
83  */
85 
86  /** This method tries to get a set of range measurements from the IR sensors.
87  * \param outThereIsObservation Will be true if an observation was sucessfully received.
88  */
89  void getObservation(mrpt::obs::CObservationRange &outObservation);
90  /** Initialize the sensor according to the parameters previously read in the configuration file.
91  * \exception throw an exception if the board could not be found.
92  * \exception throw an exception if the process rate can't be set on one of the board channel.
93  */
94  void initialize();
95 
96  /** This method should be called periodically. Period depend on the process_rate in the configuration file.
97  */
98  void doProcess();
99 
100  private:
101  /** An 8 dimension vector of boolean value wich store the presence or abscence of a sensor on the phidget interface kit board.
102  */
103  std::vector<bool> m_sensorIsPlugged;
104  /** The minimum range in meters, this field is automaticaly filled according to the sensor part number read in the configuration file.
105  * Size of this vector depend on the number of sensors described in the configuration file.
106  */
107  std::vector<float> m_minRange;
108 
109  /** The maximum range in meters, this field is automaticaly filled according to the sensor part number read in the configuration file.
110  * Size of this vector depend on the number of sensors described in the configuration file.
111  */
112  std::vector<float> m_maxRange;
113 
114  /** The sensor type.
115  */
116  std::vector<SensorType> m_sensorType;
117  /** The poses of the 8 sensors x[m] y[m] z[m] yaw[deg] pitch[deg] roll[deg]. This field is automaticaly filled according to the sensor
118  * described in the configuration file.
119  */
120  std::vector<mrpt::poses::CPose3D> m_sensorPoses;
121 
122  /** The board serial number read in the configuration file. -1 for any board.
123  */
127 
128  void* m_carteInterfaceKit; //CPhidgetInterfaceKitHandle
129 
130  /** See the class documentation at the top for expected parameters */
131  void loadConfig_sensorSpecific( const mrpt::utils::CConfigFileBase &configSource,
132  const std::string &iniSection );
133  }; // end class
134 
135  } // end namespace
136 } // end namespace
137 
138 #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.
OBSERVATION_T::Ptr getObservation(mrpt::obs::CSensoryFramePtr &observations, mrpt::obs::CObservationPtr &observation, bool priority_to_sf=true)
Given an mrpt::obs::CSensoryFrame and a mrpt::obs::CObservation pointer if a OBSERVATION_T type obser...
Definition: obs_utils.h:32
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:3919
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).



Page generated by Doxygen 1.8.14 for MRPT 1.5.9 Git: 690a4699f Wed Apr 15 19:29:53 2020 +0200 at miƩ abr 15 19:30:12 CEST 2020