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 
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  */
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  */
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 
mrpt::hwdrivers::CInterfaceFTDI
A definition of a CStream actually representing a USB connection to a FTDI chip.
Definition: CInterfaceFTDI.h:75
mrpt::hwdrivers::CRoboticHeadInterface::CRoboticHeadInterface
CRoboticHeadInterface()
Constructor.
mrpt::utils::CDebugOutputCapable
This base class provides a common printf-like method to send debug information to std::cout,...
Definition: CDebugOutputCapable.h:32
mrpt::hwdrivers::CRoboticHeadInterface::checkControllerIsConnected
bool checkControllerIsConnected()
CDebugOutputCapable.h
mrpt::hwdrivers::CRoboticHeadInterface::loadConfig_sensorSpecific
void loadConfig_sensorSpecific(const mrpt::utils::CConfigFileBase *configSource, const std::string &iniSection)
Loads specific configuration for the device from a given source of configuration parameters,...
mrpt::math::CMatrixTemplate
This template class provides the basic functionality for a general 2D any-size, resizable container o...
Definition: CMatrixTemplate.h:40
mrpt::hwdrivers::CRoboticHeadInterface::GetSoundLocation
void GetSoundLocation(int &ang)
This function return the angle where last sound where detected.
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CParticleFilter.h:17
CInterfaceFTDIMessages.h
mrpt::hwdrivers::CRoboticHeadInterface::SetGain
bool SetGain(int &new_gain, int &channel)
Set the gain for the amplifier each ear.
mrpt::hwdrivers::CRoboticHeadInterface::~CRoboticHeadInterface
~CRoboticHeadInterface()
Destructor.
Definition: CRoboticHeadInterface.h:72
mrpt::hwdrivers::CRoboticHeadInterface::gain
std::vector< int32_t > gain
Definition: CRoboticHeadInterface.h:52
mrpt::hwdrivers::CRoboticHeadInterface::GetGain
void GetGain(int &_gain, int &channel)
Read the gain for the amplifier of the ear "channel", where channel is 0, 1 or 2.
mrpt::hwdrivers::CRoboticHeadInterface::Get3SoundBuffer
void Get3SoundBuffer(mrpt::math::CMatrixTemplate< int > &buf)
Debug only!!! This function return the last 500 acquired samples for each sound channel.
mrpt::utils::CConfigFileBase
This class allows loading and storing values and vectors of different types from a configuration text...
Definition: CConfigFileBase.h:31
CInterfaceFTDI.h
mrpt::utils::CMessage
A class that contain generic messages, that can be sent and received from a "CClientTCPSocket" object...
Definition: CMessage.h:33
mrpt::hwdrivers::CRoboticHeadInterface
This "software driver" implements the communication protocol for interfacing a Robotic Head Board thr...
Definition: CRoboticHeadInterface.h:47
mrpt::hwdrivers::CRoboticHeadInterface::msg
utils::CMessage msg
Definition: CRoboticHeadInterface.h:50
mrpt::obs::gnss::pitch
double pitch
Definition: gnss_messages_novatel.h:204
CObservationRange.h
CConfigFileBase.h
mrpt::hwdrivers::CRoboticHeadInterface::head_yaw
int head_yaw
Definition: CRoboticHeadInterface.h:53
mrpt::hwdrivers::CRoboticHeadInterface::SetHeadPose
void SetHeadPose(int &yaw, int &pitch)
Move the head in:
mrpt::hwdrivers::CRoboticHeadInterface::setDeviceSerialNumber
void setDeviceSerialNumber(const std::string &deviceSerialNumber)
Changes the serial number of the device to open.
Definition: CRoboticHeadInterface.h:76
CMatrixTemplate.h
mrpt::hwdrivers::CRoboticHeadInterface::m_usbConnection
CInterfaceFTDIMessages m_usbConnection
Definition: CRoboticHeadInterface.h:49
HWDRIVERS_IMPEXP
#define HWDRIVERS_IMPEXP
Definition: hwdrivers_impexp.h:82
synch.h
mrpt::hwdrivers::CRoboticHeadInterface::m_serialNumber
std::string m_serialNumber
Definition: CRoboticHeadInterface.h:51
CMessage.h



Page generated by Doxygen 1.8.20 for MRPT 1.4.0 SVN: at Thu Aug 27 02:40:23 UTC 2020