MRPT  2.0.2
CRoboticHeadInterface.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2020, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #pragma once
11 
18 
19 namespace mrpt::hwdrivers
20 {
21 /** This "software driver" implements the communication protocol for
22  * interfacing a Robotic Head Board through a custom
23  * USB RS-422 interface board.
24  * In this class the "bind" is ignored since it is designed for USB
25  * connections only, thus it internally generate the required object for
26  * simplicity of use.
27  * The default serial number is "OREJA001"
28  *
29  * Warning: Avoid defining an object of this class in a global scope if you
30  * want to catch all potential
31  * exceptions during the constructors (like USB interface DLL not found,
32  * 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  */
46 {
47  private:
50  std::string m_serialNumber;
51  std::vector<int32_t> gain;
53 
54  // bool checkControllerIsConnected();
55 
56  protected:
57  /** Loads specific configuration for the device from a given source of
58  * configuration parameters, for example, an ".ini" file,
59  * loading from the section "[iniSection]" (see config::CConfigFileBase
60  * and
61  * derived classes)
62  * See hwdrivers::CSonarSRF10 for the possible parameters
63  */
65  const mrpt::config::CConfigFileBase* configSource,
66  const std::string& iniSection);
67 
68  public:
69  /** Constructor
70  */
72 
73  /** Destructor
74  */
75  ~CRoboticHeadInterface() override = default;
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
84  * 0, 1 or 2.
85  */
86  void GetGain(int& _gain, int& channel);
87 
88  /** Set the gain for the amplifier each ear. The value range is [0x00(min)
89  * .. 0x7F(max)]. The value 0x80 set the resistor
90  * in high impedance state, DON'T USE IT!!!
91  */
92  bool SetGain(int& new_gain, int& channel);
93 
94  /** This function return the angle where last sound where detected. This
95  * angle is related to the robot pose, NOT head pose.
96  * \code
97  * angle > 0deg --> Sound detected in the left
98  * angle = 0deg --> Sound detected in front of the head
99  * angle < 0deg --> Sound detected in the right
100  * \endcode
101  */
102  void GetSoundLocation(int& ang);
103 
104  /** Debug only!!! This function return the last 500 acquired samples for
105  * each sound channel.
106  *
107  */
109 
110  /** Move the head in:
111  \code
112  * elevation = 'yaw' degrees
113  * orientation = 'pitch' degrees
114  * \endcode
115  */
116  void SetHeadPose(int& yaw, int& pitch);
117 
118 }; // End of class
119 
120 } // namespace mrpt::hwdrivers
bool SetGain(int &new_gain, int &channel)
Set the gain for the amplifier each ear.
Contains classes for various device interfaces.
void GetGain(int &_gain, int &channel)
Read the gain for the amplifier of the ear "channel", where channel is 0, 1 or 2. ...
void SetHeadPose(int &yaw, int &pitch)
Move the head in:
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...
~CRoboticHeadInterface() override=default
Destructor.
Versatile class for consistent logging and management of output messages.
void GetSoundLocation(int &ang)
This function return the angle where last sound where detected.
A class that contain generic messages, that can be sent and received from a "CClientTCPSocket" object...
Definition: CMessage.h:27
A definition of a CStream actually representing a USB connection to a FTDI chip.
void loadConfig_sensorSpecific(const mrpt::config::CConfigFileBase *configSource, const std::string &iniSection)
Loads specific configuration for the device from a given source of configuration parameters, for example, an ".ini" file, loading from the section "[iniSection]" (see config::CConfigFileBase and derived classes) See hwdrivers::CSonarSRF10 for the possible parameters.
mrpt::comms::CInterfaceFTDI m_usbConnection
void Get3SoundBuffer(mrpt::math::CMatrixDynamic< int > &buf)
Debug only!!! This function return the last 500 acquired samples for each sound channel.
This template class provides the basic functionality for a general 2D any-size, resizable container o...



Page generated by Doxygen 1.8.14 for MRPT 2.0.2 Git: 9b4fd2465 Mon May 4 16:59:08 2020 +0200 at lun may 4 17:26:07 CEST 2020