Main MRPT website > C++ reference
MRPT logo
Public Member Functions | Protected Member Functions | Protected Attributes

mrpt::hwdrivers::CBoardENoses Class Reference


Detailed Description

A class for interfacing an e-Noses via a FTDI USB link.

Implemented for the board v1.0 designed by 2007 @ ISA (University of Malaga).

  PARAMETERS IN THE ".INI"-LIKE CONFIGURATION STRINGS:
 -------------------------------------------------------
   [supplied_section_name]
    USB_serialname=ENOSE001   // USB FTDI pipe: will open only if COM_port_* are not set or empty

    COM_port_WIN = COM1       // Serial port to connect to.
    COM_port_LIN = ttyS0

    COM_baudRate = 115200

    ; 3D position (in meters) of the master +slave eNoses
    enose_poses_x=<MASTER X> <SLAVE#1 X> <SLAVE#2 X> <SLAVE#3 X>...
    enose_poses_y=<MASTER Y> <SLAVE#1 Y> <SLAVE#2 Y> <SLAVE#3 Y>...
    enose_poses_z=<MASTER Z> <SLAVE#1 Z> <SLAVE#2 Z> <SLAVE#3 Z>...

    ; 3D pose angles (in degrees) of the master +slave eNoses
    enose_poses_yaw=<MASTER YAW> <SLAVE#1 YAW> <SLAVE#2 YAW> <SLAVE#3 YAW>...
    enose_poses_pitch=<MASTER PITCH> <SLAVE#1 PITCH> <SLAVE#2 PITCH> <SLAVE#3 PITCH>...
    enose_poses_roll=<MASTER ROLL> <SLAVE#1 ROLL> <SLAVE#2 ROLL> <SLAVE#3 ROLL>...

Definition at line 62 of file CBoardENoses.h.

#include <mrpt/hwdrivers/CBoardENoses.h>

Inheritance diagram for mrpt::hwdrivers::CBoardENoses:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 CBoardENoses ()
 Constructor.
virtual ~CBoardENoses ()
 Destructor.
bool setActiveChamber (unsigned char chamber)
 Set the active chamber (afected by poluted air) on the device.
bool queryFirmwareVersion (std::string &out_firmwareVersion)
 Query the firmware version on the device (can be used to test communications).
bool getObservation (mrpt::slam::CObservationGasSensors &outObservation)
 Request the master eNose the latest readings from all the eNoses.
void doProcess ()
 This method should be called periodically (at least at 1Hz to capture ALL the real-time data) It is thread safe, i.e.
virtual void initialize ()
 Tries to open the camera, after setting all the parameters with a call to loadConfig.
void setSerialPort (const std::string &port)
 If not an empty string, will open that serial port, otherwise will try to open USB FTDI device "m_usbSerialNumber" The default is an empty string.
std::string getSerialPort () const
void setSerialPortBaud (unsigned int baud)
 Set the serial port baud rate (default: 115200)
unsigned int getSerialPortBaud () const

Protected Member Functions

mrpt::utils::CStreamcheckConnectionAndConnect ()
 Tries to connect to the USB device (if disconnected).
void loadConfig_sensorSpecific (const mrpt::utils::CConfigFileBase &configSource, const std::string &section)
 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::CBoardENoses for the possible parameters.

Protected Attributes

std::string m_usbSerialNumber
 A copy of the device serial number (to open the USB FTDI chip)
mrpt::system::TTimeStamp initial_timestamp
bool first_reading
std::string m_COM_port
 If not an empty string (default), will open that serial port, otherwise will try to open USB FTDI device "m_usbSerialNumber".
unsigned int m_COM_baud
 Default=115200.
CInterfaceFTDIm_stream_FTDI
 FTDI comms pipe (when not in serial port mode)
CSerialPortm_stream_SERIAL
 Serial port comms.
std::vector< float > enose_poses_x
 The 3D pose of the master + N slave eNoses on the robot (meters & radians)
std::vector< float > enose_poses_y
std::vector< float > enose_poses_z
std::vector< float > enose_poses_yaw
std::vector< float > enose_poses_pitch
std::vector< float > enose_poses_roll

Constructor & Destructor Documentation

mrpt::hwdrivers::CBoardENoses::CBoardENoses (  )

Constructor.

Parameters:
serialNumberUSBdeviceThe serial number (text) of the device to open. The constructor will try to open the device. You can check if it failed calling "isOpen()".
virtual mrpt::hwdrivers::CBoardENoses::~CBoardENoses (  ) [virtual]

Destructor.


Member Function Documentation

mrpt::utils::CStream* mrpt::hwdrivers::CBoardENoses::checkConnectionAndConnect (  ) [protected]

Tries to connect to the USB device (if disconnected).

Returns:
NULL on error, otherwise a stream to be used for comms.
void mrpt::hwdrivers::CBoardENoses::doProcess (  ) [virtual]

This method should be called periodically (at least at 1Hz to capture ALL the real-time data) It is thread safe, i.e.

you can call this from one thread, then to other methods from other threads.

Implements mrpt::hwdrivers::CGenericSensor.

bool mrpt::hwdrivers::CBoardENoses::getObservation ( mrpt::slam::CObservationGasSensors outObservation )

Request the master eNose the latest readings from all the eNoses.

The output observation contains a valid timestamp and 3D positions if "loadConfig" has been called previously.

Returns:
true if OK, false if there were any error.
std::string mrpt::hwdrivers::CBoardENoses::getSerialPort (  ) const [inline]

Definition at line 113 of file CBoardENoses.h.

unsigned int mrpt::hwdrivers::CBoardENoses::getSerialPortBaud (  ) const [inline]

Definition at line 117 of file CBoardENoses.h.

virtual void mrpt::hwdrivers::CBoardENoses::initialize (  ) [virtual]

Tries to open the camera, after setting all the parameters with a call to loadConfig.

Exceptions:
Thismethod must throw an exception with a descriptive message if some critical error is found.

Reimplemented from mrpt::hwdrivers::CGenericSensor.

void mrpt::hwdrivers::CBoardENoses::loadConfig_sensorSpecific ( const mrpt::utils::CConfigFileBase configSource,
const std::string &  section 
) [protected, virtual]

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::CBoardENoses for the possible parameters.

Implements mrpt::hwdrivers::CGenericSensor.

bool mrpt::hwdrivers::CBoardENoses::queryFirmwareVersion ( std::string &  out_firmwareVersion )

Query the firmware version on the device (can be used to test communications).

Returns:
true on success, false on communications errors or device not found.
bool mrpt::hwdrivers::CBoardENoses::setActiveChamber ( unsigned char  chamber )

Set the active chamber (afected by poluted air) on the device.

Returns:
true on success, false on communications errors or device not found.
void mrpt::hwdrivers::CBoardENoses::setSerialPort ( const std::string &  port ) [inline]

If not an empty string, will open that serial port, otherwise will try to open USB FTDI device "m_usbSerialNumber" The default is an empty string.

Example strings: "COM1", "ttyUSB0", ...

Definition at line 112 of file CBoardENoses.h.

void mrpt::hwdrivers::CBoardENoses::setSerialPortBaud ( unsigned int  baud ) [inline]

Set the serial port baud rate (default: 115200)

Definition at line 116 of file CBoardENoses.h.


Member Data Documentation

std::vector<float> mrpt::hwdrivers::CBoardENoses::enose_poses_pitch [protected]

Definition at line 55 of file CBoardENoses.h.

std::vector<float> mrpt::hwdrivers::CBoardENoses::enose_poses_roll [protected]

Definition at line 55 of file CBoardENoses.h.

std::vector<float> mrpt::hwdrivers::CBoardENoses::enose_poses_x [protected]

The 3D pose of the master + N slave eNoses on the robot (meters & radians)

Definition at line 55 of file CBoardENoses.h.

std::vector<float> mrpt::hwdrivers::CBoardENoses::enose_poses_y [protected]

Definition at line 55 of file CBoardENoses.h.

std::vector<float> mrpt::hwdrivers::CBoardENoses::enose_poses_yaw [protected]

Definition at line 55 of file CBoardENoses.h.

std::vector<float> mrpt::hwdrivers::CBoardENoses::enose_poses_z [protected]

Definition at line 55 of file CBoardENoses.h.

Definition at line 42 of file CBoardENoses.h.

Definition at line 41 of file CBoardENoses.h.

Default=115200.

Definition at line 45 of file CBoardENoses.h.

If not an empty string (default), will open that serial port, otherwise will try to open USB FTDI device "m_usbSerialNumber".

Definition at line 44 of file CBoardENoses.h.

FTDI comms pipe (when not in serial port mode)

Definition at line 50 of file CBoardENoses.h.

Serial port comms.

Definition at line 52 of file CBoardENoses.h.

A copy of the device serial number (to open the USB FTDI chip)

Definition at line 40 of file CBoardENoses.h.




Page generated by Doxygen 1.7.2 for MRPT 0.9.4 SVN: at Mon Jan 10 22:46:17 UTC 2011