class mrpt::hwdrivers::CRoboticHeadInterface¶
This “software driver” implements the communication protocol for interfacing a Robotic Head Board through a custom USB RS-422 interface board.
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. The default serial number is “OREJA001”
Warning: Avoid defining an object of this class in a global scope if you want to catch all potential exceptions during the constructors (like USB interface DLL not found, etc…)
PARAMETERS IN THE ".INI"-LIKE CONFIGURATION STRINGS: ------------------------------------------------------- [supplied_section_name] HEAD_serialNumber=OREJA001 HEAD_gain=127,127,127 HEAD_yaw=0 // initial yaw value HEAD_pitch=0 // initial tilt
#include <mrpt/hwdrivers/CRoboticHeadInterface.h> class CRoboticHeadInterface: public mrpt::system::COutputLogger { public: // methods void setDeviceSerialNumber(const std::string& deviceSerialNumber); void GetGain(int& _gain, int& channel); bool SetGain(int& new_gain, int& channel); void GetSoundLocation(int& ang); void Get3SoundBuffer(mrpt::math::CMatrixDynamic<int>& buf); void SetHeadPose(int& yaw, int& pitch); };
Methods¶
void setDeviceSerialNumber(const std::string& deviceSerialNumber)
Changes the serial number of the device to open.
void GetGain(int& _gain, int& channel)
Read the gain for the amplifier of the ear “channel”, where channel is 0, 1 or 2.
bool SetGain(int& new_gain, int& channel)
Set the gain for the amplifier each ear.
The value range is [0x00(min) .. 0x7F(max)]. The value 0x80 set the resistor in high impedance state, DON’T USE IT!!!
void GetSoundLocation(int& ang)
This function return the angle where last sound where detected.
This angle is related to the robot pose, NOT head pose.
angle > 0deg --> Sound detected in the left angle = 0deg --> Sound detected in front of the head angle < 0deg --> Sound detected in the right
void Get3SoundBuffer(mrpt::math::CMatrixDynamic<int>& buf)
Debug only!!! This function return the last 500 acquired samples for each sound channel.
void SetHeadPose(int& yaw, int& pitch)
Move the head in:
elevation = 'yaw' degrees orientation = 'pitch' degrees