class mrpt::hwdrivers::CEnoseModular

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

Implemented for the Mdular board v1.0 designed by 2013 @ MAPIR (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/CEnoseModular.h>

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

    CEnoseModular();

    //
methods

    bool getObservation(mrpt::obs::CObservationGasSensors& outObservation);
    virtual void doProcess();
    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

CEnoseModular()

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

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)