10 #ifndef CGenericSensor_H 11 #define CGenericSensor_H 68 typedef std::multimap< mrpt::system::TTimeStamp, mrpt::utils::CSerializablePtr >
TListObservations;
69 typedef std::pair< mrpt::system::TTimeStamp, mrpt::utils::CSerializablePtr >
TListObsPair;
103 typedef stlplus::smart_ptr<const CGenericSensor>
ConstPtr;
144 void appendObservations(
const std::vector<mrpt::utils::CSerializablePtr> &
obj);
149 appendObservations(std::vector<mrpt::utils::CSerializablePtr>(1,
obj));
165 virtual void loadConfig_sensorSpecific(
207 virtual void doProcess() = 0;
211 void getObservations( TListObservations &lstObjects );
227 m_external_images_format = ext;
232 m_external_images_jpeg_quality =
quality;
235 return m_external_images_jpeg_quality;
244 #define SENSOR_CLASS_ID(class_name) \ 245 static_cast<const mrpt::hwdrivers::TSensorClassId*>(& mrpt::hwdrivers::class_name::class##class_name) 247 #define SENSOR_IS_CLASS( ptrObj, class_name ) (ptrObj->GetRuntimeClass()==SENSOR_CLASS_ID(class_name)) 252 #define DEFINE_GENERIC_SENSOR(class_name) \ 254 static mrpt::hwdrivers::CGenericSensor::CLASSINIT_GENERIC_SENSOR _init_##class_name;\ 256 static mrpt::hwdrivers::TSensorClassId class##class_name; \ 257 virtual const mrpt::hwdrivers::TSensorClassId* GetRuntimeClass() const; \ 258 static mrpt::hwdrivers::CGenericSensor* CreateObject(); \ 259 static void doRegister() \ 260 { CGenericSensor::registerClass( SENSOR_CLASS_ID( class_name ) ); } 264 #define IMPLEMENTS_GENERIC_SENSOR(class_name, NameSpace) \ 265 mrpt::hwdrivers::CGenericSensor* NameSpace::class_name::CreateObject() \ 266 { return static_cast<hwdrivers::CGenericSensor*>( new NameSpace::class_name ); } \ 267 mrpt::hwdrivers::TSensorClassId NameSpace::class_name::class##class_name = { \ 268 #class_name, NameSpace::class_name::CreateObject }; \ 269 const mrpt::hwdrivers::TSensorClassId* NameSpace::class_name::GetRuntimeClass() const \ 270 { return SENSOR_CLASS_ID(class_name); } TListObservations m_objList
The queue of objects to be returned by getObservations.
A generic interface for a wide-variety of sensors designed to be used in the application RawLogGrabbe...
size_t m_grab_decimation_counter
Used when "m_grab_decimation" is enabled.
This class provides simple critical sections functionality.
double m_process_rate
See CGenericSensor.
synch::CCriticalSection m_csObjList
The critical section for m_objList.
std::multimap< mrpt::system::TTimeStamp, mrpt::utils::CSerializablePtr > TListObservations
virtual void setPathForExternalImages(const std::string &directory)
Set the path where to save off-rawlog image files (will be ignored in those sensors where this is not...
double getProcessRate() const
#define MRPT_MAKE_ALIGNED_OPERATOR_NEW
std::string m_sensorLabel
See CGenericSensor.
void enableVerbose(bool enabled=true)
Enable or disable extra debug info dumped to std::cout during sensor operation.
GLsizei GLsizei GLuint * obj
unsigned int getExternalImageJPEGQuality() const
This class allows loading and storing values and vectors of different types from a configuration text...
const char * className
Class name.
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
static void registerClass(const TSensorClassId *pNewClass)
Register a class into the internal list of "CGenericSensor" descendents.
CLASSINIT_GENERIC_SENSOR(const TSensorClassId *pNewClass)
TSensorState getState() const
The current state of the sensor.
The base class of classes that cannot be copied: compile-time errors will be issued on any copy opera...
std::map< std::string, const TSensorClassId * > registered_sensor_classes_t
Used in registerClass.
void setExternalImageFormat(const std::string &ext)
Set the extension ("jpg","gif","png",...) that determines the format of images saved externally The d...
size_t m_max_queue_len
See CGenericSensor.
stlplus::smart_ptr< CGenericSensor > CGenericSensorPtr
GLsizei const GLchar ** string
void setExternalImageJPEGQuality(const unsigned int quality)
The quality of JPEG compression, when external images is enabled and the format is "jpg"...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
size_t m_grab_decimation
If set to N>=2, only 1 out of N observations will be saved to m_objList.
std::pair< mrpt::system::TTimeStamp, mrpt::utils::CSerializablePtr > TListObsPair
std::string getSensorLabel() const
unsigned int m_external_images_jpeg_quality
For JPEG images, the quality (default=95%).
class HWDRIVERS_IMPEXP CGenericSensor
void setSensorLabel(const std::string &sensorLabel)
TSensorState
The current state of the sensor.
static CGenericSensorPtr createSensorPtr(const std::string &className)
Just like createSensor, but returning a smart pointer to the newly created sensor object...
virtual void initialize()
This method can or cannot be implemented in the derived class, depending on the need for it...
void appendObservation(const mrpt::utils::CSerializablePtr &obj)
Like appendObservations() but for just one observation.
std::string m_external_images_format
The extension ("jpg","gif","png",...) that determines the format of images saved externally.
bool isVerboseEnabled() const
void BASE_IMPEXP registerClass(const mrpt::utils::TRuntimeClassId *pNewClass)
Register a class into the MRPT internal list of "CSerializable" descendents.
Auxiliary structure used for CSerializable runtime class ID support.
std::string m_path_for_external_images
The path where to save off-rawlog images: empty means save images embedded in the rawlog...
A structure for runtime ID class type information in the context of hwdrivers::CGenericSensor.
stlplus::smart_ptr< const CGenericSensor > ConstPtr