Main MRPT website > C++ reference for MRPT 1.5.5
List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
mrpt::hwdrivers::CRoboticHeadInterface Class Reference

Detailed Description

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

Definition at line 45 of file CRoboticHeadInterface.h.

#include <mrpt/hwdrivers/CRoboticHeadInterface.h>

Inheritance diagram for mrpt::hwdrivers::CRoboticHeadInterface:
Inheritance graph

Public Member Functions

 CRoboticHeadInterface ()
 Constructor. More...
 
 ~CRoboticHeadInterface ()
 Destructor. More...
 
void setDeviceSerialNumber (const std::string &deviceSerialNumber)
 Changes the serial number of the device to open. More...
 
void GetGain (int &_gain, int &channel)
 Read the gain for the amplifier of the ear "channel", where channel is 0, 1 or 2. More...
 
bool SetGain (int &new_gain, int &channel)
 Set the gain for the amplifier each ear. More...
 
void GetSoundLocation (int &ang)
 This function return the angle where last sound where detected. More...
 
void Get3SoundBuffer (mrpt::math::CMatrixTemplate< int > &buf)
 Debug only!!! This function return the last 500 acquired samples for each sound channel. More...
 
void SetHeadPose (int &yaw, int &pitch)
 Move the head in: More...
 

Protected Member Functions

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, for example, an ".ini" file, loading from the section "[iniSection]" (see utils::CConfigFileBase and derived classes) See hwdrivers::CSonarSRF10 for the possible parameters. More...
 

Private Member Functions

bool checkControllerIsConnected ()
 

Private Attributes

CInterfaceFTDIMessages m_usbConnection
 
utils::CMessage msg
 
std::string m_serialNumber
 
std::vector< int32_tgain
 
int head_yaw
 
int head_pitch
 

Constructor & Destructor Documentation

CRoboticHeadInterface::CRoboticHeadInterface ( )

Constructor.

Definition at line 21 of file CRoboticHeadInterface.cpp.

References gain, head_pitch, head_yaw, m_serialNumber, MRPT_END, and MRPT_START.

mrpt::hwdrivers::CRoboticHeadInterface::~CRoboticHeadInterface ( )
inline

Destructor.

Definition at line 71 of file CRoboticHeadInterface.h.

Member Function Documentation

bool mrpt::hwdrivers::CRoboticHeadInterface::checkControllerIsConnected ( )
private
void CRoboticHeadInterface::Get3SoundBuffer ( mrpt::math::CMatrixTemplate< int > &  buf)

Debug only!!! This function return the last 500 acquired samples for each sound channel.

Definition at line 97 of file CRoboticHeadInterface.cpp.

References mrpt::utils::CMessage::content, int(), m_usbConnection, msg, mrpt::utils::CStream::receiveMessage(), mrpt::utils::CStream::sendMessage(), mrpt::math::CMatrixTemplate< T >::setSize(), and mrpt::utils::CMessage::type.

void CRoboticHeadInterface::GetGain ( int _gain,
int channel 
)

Read the gain for the amplifier of the ear "channel", where channel is 0, 1 or 2.

Definition at line 52 of file CRoboticHeadInterface.cpp.

References mrpt::utils::CMessage::content, m_usbConnection, msg, mrpt::utils::CStream::receiveMessage(), mrpt::utils::CStream::sendMessage(), THROW_EXCEPTION, and mrpt::utils::CMessage::type.

void CRoboticHeadInterface::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

Definition at line 85 of file CRoboticHeadInterface.cpp.

References mrpt::utils::CMessage::content, int(), m_usbConnection, msg, mrpt::utils::CStream::receiveMessage(), mrpt::utils::CStream::sendMessage(), and mrpt::utils::CMessage::type.

void CRoboticHeadInterface::loadConfig_sensorSpecific ( const mrpt::utils::CConfigFileBase configSource,
const std::string iniSection 
)
protected

Loads specific configuration for the device from a given source of configuration parameters, for example, an ".ini" file, loading from the section "[iniSection]" (see utils::CConfigFileBase and derived classes) See hwdrivers::CSonarSRF10 for the possible parameters.

Definition at line 40 of file CRoboticHeadInterface.cpp.

References gain, head_pitch, head_yaw, m_serialNumber, mrpt::utils::CConfigFileBase::read_int(), mrpt::utils::CConfigFileBase::read_string(), and mrpt::utils::CConfigFileBase::read_vector().

void mrpt::hwdrivers::CRoboticHeadInterface::setDeviceSerialNumber ( const std::string deviceSerialNumber)
inline

Changes the serial number of the device to open.

Definition at line 75 of file CRoboticHeadInterface.h.

bool CRoboticHeadInterface::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!!!

Definition at line 68 of file CRoboticHeadInterface.cpp.

References mrpt::utils::CMessage::content, m_usbConnection, msg, mrpt::utils::CStream::receiveMessage(), mrpt::utils::CStream::sendMessage(), and mrpt::utils::CMessage::type.

void mrpt::hwdrivers::CRoboticHeadInterface::SetHeadPose ( int yaw,
int pitch 
)

Move the head in:

elevation = 'yaw' degrees
orientation = 'pitch' degrees

Member Data Documentation

std::vector<int32_t> mrpt::hwdrivers::CRoboticHeadInterface::gain
private

Definition at line 51 of file CRoboticHeadInterface.h.

Referenced by CRoboticHeadInterface(), and loadConfig_sensorSpecific().

int mrpt::hwdrivers::CRoboticHeadInterface::head_pitch
private

Definition at line 52 of file CRoboticHeadInterface.h.

Referenced by CRoboticHeadInterface(), and loadConfig_sensorSpecific().

int mrpt::hwdrivers::CRoboticHeadInterface::head_yaw
private

Definition at line 52 of file CRoboticHeadInterface.h.

Referenced by CRoboticHeadInterface(), and loadConfig_sensorSpecific().

std::string mrpt::hwdrivers::CRoboticHeadInterface::m_serialNumber
private

Definition at line 50 of file CRoboticHeadInterface.h.

Referenced by CRoboticHeadInterface(), and loadConfig_sensorSpecific().

CInterfaceFTDIMessages mrpt::hwdrivers::CRoboticHeadInterface::m_usbConnection
private

Definition at line 48 of file CRoboticHeadInterface.h.

Referenced by Get3SoundBuffer(), GetGain(), GetSoundLocation(), and SetGain().

utils::CMessage mrpt::hwdrivers::CRoboticHeadInterface::msg
private

Definition at line 49 of file CRoboticHeadInterface.h.

Referenced by Get3SoundBuffer(), GetGain(), GetSoundLocation(), and SetGain().




Page generated by Doxygen 1.8.6 for MRPT 1.5.5 Git: e06b63d Fri Dec 1 14:41:11 2017 +0100 at sáb dic 2 13:00:21 CET 2017