# class mrpt::hwdrivers::CGenericSensor¶

A generic interface for a wide-variety of sensors designed to be used in the application RawLogGrabber.

Derived classes should be designed with the following execution flow in mind:

• Object constructor

• CGenericSensor::loadConfig : The following parameters are common to all sensors in rawlog-grabber (they are automatically loaded by rawlog-grabber) - see each class documentation for additional parameters:

• “process_rate”: (Mandatory) The rate in Hertz (Hz) at which the sensor thread should invoke “doProcess”.

• “max_queue_len”: (Optional) The maximum number of objects in the observations queue (default is 200). If overflow occurs, an error message will be issued at run-time.

• “grab_decimation”: (Optional) Grab only 1 out of N observations captured by the sensor (default is 1, i.e. do not decimate).

• CGenericSensor::initialize

• CGenericSensor::doProcess

• CGenericSensor::getObservations

Notice that there are helper methods for managing the internal list of objects (see CGenericSensor::appendObservation).

Class Factory: This is also a factory of derived classes, through the static method CGenericSensor::createSensor

For more details on RawLogGrabber refer to the wiki page: https://www.mrpt.org/Application:RawLogGrabber

#include <mrpt/hwdrivers/CGenericSensor.h>

class CGenericSensor
{
public:
// construction

CGenericSensor();
CGenericSensor(const CGenericSensor&);

//
methods

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

// direct descendants

class C2DRangeFinderAbstract;
class CBoardENoses;
class CBoardSonars;
class CCameraSensor;
class CEnoseModular;
class CGillAnemometer;
class CGPS_NTRIP;
class CGPSInterface;
class CGyroKVHDSP3000;
class CIbeoLuxETH;
class CImpinjRFID;
class CIMUIntersense;
class CIMUXSens_MT4;
class CKinect;
class CNationalInstrumentsDAQ;
class CNTRIPEmitter;
class COpenNI2_RGBD360;
class COpenNI2Sensor;
class CPhidgetInterfaceKitProximitySensors;
class CRaePID;
class CSkeletonTracker;
class CSwissRanger3DCamera;
class CVelodyneScanner;
class CWirelessPower;

## Construction¶

CGenericSensor()

Constructor.

## Methods¶

virtual void doProcess() = 0

This method will be invoked at a minimum rate of “process_rate” (Hz)

Parameters:

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