#include <mrpt/hwdrivers/CBoardSonars.h>
Public Member Functions | |
CBoardSonars () | |
Constructor. | |
~CBoardSonars () | |
Destructor. | |
void | loadConfig (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::CBoardSonars for the possible parameters. | |
bool | queryFirmwareVersion (std::string &out_firmwareVersion) |
Query the firmware version on the device (can be used to test communications). | |
bool | getObservation (mrpt::slam::CObservationRange &obs) |
Request the latest range measurements. | |
bool | programI2CAddress (uint8_t currentAddress, uint8_t newAddress) |
Requests a command of "change address" for a given SRF10 device. | |
Protected Member Functions | |
bool | checkConnectionAndConnect () |
Tries to connect to the USB device (if disconnected). | |
bool | sendConfigCommands () |
Sends the configuration (max range, gain,. | |
Protected Attributes | |
std::string | m_usbSerialNumber |
A copy of the device serial number (to open the USB FTDI chip). | |
uint8_t | m_gain |
A value between 0 and 16, for gains between 40 and 700 (not linear). | |
float | m_maxRange |
The maximum range in meters, used for the internal device timer (value between 4cm and 11m). | |
std::vector< int32_t > | m_firingOrder |
The order in which sonars will be fired, indexed by their I2C addresses [0,15]. | |
float | m_minTimeBetweenPings |
The minimum time between sonar pings (in seconds). |
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 serial number of the USB device is used to open it on the first call to "doProcess", thus you must call "loadConfig" before this, or manually call "setDeviceSerialNumber". The default serial number is "SONAR001"
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] USB_serialNumber=SONAR001 gain=6 ; Value between 0 and 16, for analog gains between 40 and 700. maxRange=4.0 ; In meters, used for device internal timer. minTimeBetweenPings=0.3 ; In seconds ; The order in which sonars will be fired, indexed by their I2C addresses [0,15] ; Up to 16 devices, but you can put any number of devices (from 1 to 16). firingOrder=0 1 2 3 ¡¡¡FALTA PONER UNA ESTRUCTURILLA PARA ALMACENAR LA POSE3D DE LOS 16 SONARES SOBRE EL ROBOT!!!
Definition at line 69 of file CBoardSonars.h.
mrpt::hwdrivers::CBoardSonars::CBoardSonars | ( | ) |
Constructor.
mrpt::hwdrivers::CBoardSonars::~CBoardSonars | ( | ) | [inline] |
bool mrpt::hwdrivers::CBoardSonars::checkConnectionAndConnect | ( | ) | [protected] |
Tries to connect to the USB device (if disconnected).
bool mrpt::hwdrivers::CBoardSonars::getObservation | ( | mrpt::slam::CObservationRange & | obs | ) |
Request the latest range measurements.
void mrpt::hwdrivers::CBoardSonars::loadConfig | ( | 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::CBoardSonars for the possible parameters.
bool mrpt::hwdrivers::CBoardSonars::programI2CAddress | ( | uint8_t | currentAddress, | |
uint8_t | newAddress | |||
) |
Requests a command of "change address" for a given SRF10 device.
currentAddress and newAddress are the I2C addresses in the range 0 to 15 (mapped to 0xE0 to 0xFE internally).
bool mrpt::hwdrivers::CBoardSonars::queryFirmwareVersion | ( | std::string & | out_firmwareVersion | ) |
Query the firmware version on the device (can be used to test communications).
bool mrpt::hwdrivers::CBoardSonars::sendConfigCommands | ( | ) | [protected] |
Sends the configuration (max range, gain,.
..) to the USB board. Used internally after a successfull connection.
std::vector<int32_t> mrpt::hwdrivers::CBoardSonars::m_firingOrder [protected] |
The order in which sonars will be fired, indexed by their I2C addresses [0,15].
Up to 16 devices, but you can put any number of devices (from 1 to 16).
Definition at line 87 of file CBoardSonars.h.
uint8_t mrpt::hwdrivers::CBoardSonars::m_gain [protected] |
A value between 0 and 16, for gains between 40 and 700 (not linear).
Definition at line 78 of file CBoardSonars.h.
float mrpt::hwdrivers::CBoardSonars::m_maxRange [protected] |
The maximum range in meters, used for the internal device timer (value between 4cm and 11m).
Definition at line 82 of file CBoardSonars.h.
float mrpt::hwdrivers::CBoardSonars::m_minTimeBetweenPings [protected] |
std::string mrpt::hwdrivers::CBoardSonars::m_usbSerialNumber [protected] |
A copy of the device serial number (to open the USB FTDI chip).
Definition at line 74 of file CBoardSonars.h.
Page generated by Doxygen 1.5.8 for MRPT 0.6.5 SVN: at Thu Feb 26 02:18:33 EST 2009 |