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



Page generated by Doxygen 1.8.11 for MRPT 1.4.0 SVN:Unversioned directory at Tue Jun 28 11:46:25 UTC 2016