Main MRPT website > C++ reference for MRPT 1.5.7
CRoboticHeadInterface.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 CRoboticHeadInterface_H
11 #define CRoboticHeadInterface_H
12 
15 #include <mrpt/utils/CMessage.h>
20 
21 
22 namespace mrpt
23 {
24  namespace hwdrivers
25  {
26  /** This "software driver" implements the communication protocol for interfacing a Robotic Head Board through a custom
27  * USB RS-422 interface board.
28  * In this class the "bind" is ignored since it is designed for USB connections only, thus it internally generate the required object for simplicity of use.
29  * The default serial number is "OREJA001"
30  *
31  * Warning: Avoid defining an object of this class in a global scope if you want to catch all potential
32  * exceptions during the constructors (like USB interface DLL not found, etc...)
33  *
34  * \code
35  * PARAMETERS IN THE ".INI"-LIKE CONFIGURATION STRINGS:
36  * -------------------------------------------------------
37  * [supplied_section_name]
38  * HEAD_serialNumber=OREJA001
39  * HEAD_gain=127,127,127
40  * HEAD_yaw=0 // initial yaw value
41  * HEAD_pitch=0 // initial tilt
42  * \endcode
43  * \ingroup mrpt_hwdrivers_grp
44  */
45  class HWDRIVERS_IMPEXP CRoboticHeadInterface : public mrpt::utils::COutputLogger
46  {
47  private:
51  std::vector<int32_t> gain;
52  int head_yaw, head_pitch;
53 
54  bool checkControllerIsConnected();
55 
56  protected:
57  /** Loads specific configuration for the device from a given source of configuration parameters, for example, an ".ini" file,
58  * loading from the section "[iniSection]" (see utils::CConfigFileBase and derived classes)
59  * See hwdrivers::CSonarSRF10 for the possible parameters
60  */
61  void loadConfig_sensorSpecific( const mrpt::utils::CConfigFileBase *configSource,
62  const std::string &iniSection );
63 
64  public:
65  /** Constructor
66  */
68 
69  /** Destructor
70  */
72 
73  /** Changes the serial number of the device to open
74  */
75  void setDeviceSerialNumber(const std::string &deviceSerialNumber)
76  {
77  m_serialNumber = deviceSerialNumber;
78  }
79 
80  /** Read the gain for the amplifier of the ear "channel", where channel is 0, 1 or 2.
81  */
82  void GetGain(int &_gain,int &channel);
83 
84  /** Set the gain for the amplifier each ear. The value range is [0x00(min) .. 0x7F(max)]. The value 0x80 set the resistor
85  * in high impedance state, DON'T USE IT!!!
86  */
87  bool SetGain(int &new_gain,int &channel);
88 
89  /** This function return the angle where last sound where detected. This angle is related to the robot pose, NOT head pose.
90  * \code
91  * angle > 0deg --> Sound detected in the left
92  * angle = 0deg --> Sound detected in front of the head
93  * angle < 0deg --> Sound detected in the right
94  * \endcode
95  */
96  void GetSoundLocation(int &ang);
97 
98  /** Debug only!!! This function return the last 500 acquired samples for each sound channel.
99  *
100  */
101  void Get3SoundBuffer(mrpt::math::CMatrixTemplate<int> &buf);
102 
103  /** Move the head in:
104  \code
105  * elevation = 'yaw' degrees
106  * orientation = 'pitch' degrees
107  * \endcode
108  */
109  void SetHeadPose(int &yaw, int &pitch);
110 
111  }; // End of class
112 
113  } // End of namespace
114 } // end of namespace
115 
116 #endif
117 
void setDeviceSerialNumber(const std::string &deviceSerialNumber)
Changes the serial number of the device to open.
This class allows loading and storing values and vectors of different types from a configuration text...
This "software driver" implements the communication protocol for interfacing a Robotic Head Board thr...
GLsizei const GLchar ** string
Definition: glext.h:3919
This template class provides the basic functionality for a general 2D any-size, resizable container o...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
A definition of a CStream actually representing a USB connection to a FTDI chip.
A class that contain generic messages, that can be sent and received from a "CClientTCPSocket" object...
Definition: CMessage.h:29



Page generated by Doxygen 1.8.14 for MRPT 1.5.7 Git: 5902e14cc Wed Apr 24 15:04:01 2019 +0200 at lun oct 28 01:39:17 CET 2019