class mrpt::hwdrivers::CBoardENoses

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>...
#include <mrpt/hwdrivers/CBoardENoses.h>

class CBoardENoses: public mrpt::hwdrivers::CGenericSensor
{
public:
    // construction

    CBoardENoses();

    //
methods

    bool setActiveChamber(unsigned char chamber);
    bool queryFirmwareVersion(std::string& out_firmwareVersion);
    bool getObservation(mrpt::obs::CObservationGasSensors& outObservation);
    virtual void doProcess();
    virtual void initialize();
    void setSerialPort(const std::string& port);
    std::string getSerialPort() const;
    void setSerialPortBaud(unsigned int baud);
    unsigned int getSerialPortBaud() const;
};

Inherited Members

public:
    //
methods

    CGenericSensor& operator = (const CGenericSensor&);
    virtual void doProcess() = 0;

Construction

CBoardENoses()

Constructor.

Parameters:

serialNumberUSBdevice

The serial number (text) of the device to open. The constructor will try to open the device. You can check if it failed calling “isOpen()”.

Methods

bool setActiveChamber(unsigned char chamber)

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

Send to the MCE-nose the next Active Chamber.

Returns:

true on success, false on communications errors or device not found.

bool 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 getObservation(mrpt::obs::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.

virtual 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.

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

virtual void initialize()

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

Parameters:

This

method must throw an exception with a descriptive message if some critical error is found.

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.

Example strings: “COM1”, “ttyUSB0”, …

void setSerialPortBaud(unsigned int baud)

Set the serial port baud rate (default: 115200)