Main MRPT website > C++ reference
MRPT logo
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-2014, 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  using namespace mrpt::math;
28 
29  /** This "software driver" implements the communication protocol for interfacing a Robotic Head Board through a custom
30  * USB RS-422 interface board.
31  * 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.
32  * The default serial number is "OREJA001"
33  *
34  * Warning: Avoid defining an object of this class in a global scope if you want to catch all potential
35  * exceptions during the constructors (like USB interface DLL not found, etc...)
36  *
37  * \code
38  * PARAMETERS IN THE ".INI"-LIKE CONFIGURATION STRINGS:
39  * -------------------------------------------------------
40  * [supplied_section_name]
41  * HEAD_serialNumber=OREJA001
42  * HEAD_gain=127,127,127
43  * HEAD_yaw=0 //orientación inicial
44  * HEAD_pitch=0 //elevación inicial
45  * \endcode
46  * \ingroup mrpt_hwdrivers_grp
47  */
49  {
50  private:
53  std::string m_serialNumber;
54  std::vector<int32_t> gain;
55  int head_yaw, head_pitch;
56 
57  bool checkControllerIsConnected();
58 
59  protected:
60  /** Loads specific configuration for the device from a given source of configuration parameters, for example, an ".ini" file,
61  * loading from the section "[iniSection]" (see utils::CConfigFileBase and derived classes)
62  * See hwdrivers::CSonarSRF10 for the possible parameters
63  */
64  void loadConfig_sensorSpecific( const mrpt::utils::CConfigFileBase *configSource,
65  const std::string &iniSection );
66 
67  public:
68  /** Constructor
69  */
71 
72  /** Destructor
73  */
75 
76  /** Changes the serial number of the device to open
77  */
78  void setDeviceSerialNumber(const std::string &deviceSerialNumber)
79  {
80  m_serialNumber = deviceSerialNumber;
81  }
82 
83  /** Read the gain for the amplifier of the ear "channel", where channel is 0, 1 or 2.
84  */
85  void GetGain(int &_gain,int &channel);
86 
87  /** Set the gain for the amplifier each ear. The value range is [0x00(min) .. 0x7F(max)]. The value 0x80 set the resistor
88  * in high impedance state, ¡¡¡DON'T USE IT!!!
89  */
90  bool SetGain(int &new_gain,int &channel);
91 
92  /** This function return the angle where last sound where detected. This angle is related to the robot pose, NOT head pose.
93  * \code
94  * angle > 0deg --> Sound detected in the left
95  * angle = 0deg --> Sound detected in front of the head
96  * angle < 0deg --> Sound detected in the right
97  * \endcode
98  */
99  void GetSoundLocation(int &ang);
100 
101  /** Debug only!!! This function return the last 500 acquired samples for each sound channel.
102  *
103  */
104  void Get3SoundBuffer(CMatrixTemplate<int> &buf);
105 
106  /** Move the head in:
107  * \code
108  * elevation = 'yaw' degrees
109  * orientation = 'pitch' degrees
110  * \endcode
111  */
112  void SetHeadPose(int &yaw, int &pitch);
113 
114  //TO DO --> Funciones del acelerómetro
115  // Movimientos faciales
116 
117  }; // End of class
118 
119  } // End of namespace
120 } // end of namespace
121 
122 #endif
123 
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 base provides a set of functions for maths stuff.
Definition: CArray.h:18
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.8 for MRPT 1.2.2 SVN:Unversioned directory at Tue Oct 14 02:14:08 UTC 2014