Go to the documentation of this file.
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;
87 inline void setSensorLabel(
const std::string& sensorLabel) { m_sensorLabel=sensorLabel; }
143 void appendObservations(
const std::vector<mrpt::utils::CSerializablePtr> &obj);
148 appendObservations(std::vector<mrpt::utils::CSerializablePtr>(1, obj));
164 virtual void loadConfig_sensorSpecific(
166 const std::string §ion ) = 0;
176 static CGenericSensor* createSensor(
const std::string &className);
195 const std::string §ion );
206 virtual void doProcess() = 0;
210 void getObservations( TListObservations &lstObjects );
226 m_external_images_format = ext;
231 m_external_images_jpeg_quality = quality;
234 return m_external_images_jpeg_quality;
243 #define SENSOR_CLASS_ID(class_name) \
244 static_cast<const mrpt::hwdrivers::TSensorClassId*>(& mrpt::hwdrivers::class_name::class##class_name)
246 #define SENSOR_IS_CLASS( ptrObj, class_name ) (ptrObj->GetRuntimeClass()==SENSOR_CLASS_ID(class_name))
251 #define DEFINE_GENERIC_SENSOR(class_name) \
253 static mrpt::hwdrivers::CGenericSensor::CLASSINIT_GENERIC_SENSOR _init_##class_name;\
255 static mrpt::hwdrivers::TSensorClassId class##class_name; \
256 virtual const mrpt::hwdrivers::TSensorClassId* GetRuntimeClass() const; \
257 static mrpt::hwdrivers::CGenericSensor* CreateObject(); \
258 static void doRegister() \
259 { CGenericSensor::registerClass( SENSOR_CLASS_ID( class_name ) ); }
263 #define IMPLEMENTS_GENERIC_SENSOR(class_name, NameSpace) \
264 mrpt::hwdrivers::CGenericSensor* NameSpace::class_name::CreateObject() \
265 { return static_cast<hwdrivers::CGenericSensor*>( new NameSpace::class_name ); } \
266 mrpt::hwdrivers::TSensorClassId NameSpace::class_name::class##class_name = { \
267 #class_name, NameSpace::class_name::CreateObject }; \
268 const mrpt::hwdrivers::TSensorClassId* NameSpace::class_name::GetRuntimeClass() const \
269 { return SENSOR_CLASS_ID(class_name); }
void setExternalImageJPEGQuality(const unsigned int quality)
The quality of JPEG compression, when external images is enabled and the format is "jpg".
static std::map< std::string, const TSensorClassId * > m_knownClasses
Used in registerClass.
const char * className
Class name.
std::pair< mrpt::system::TTimeStamp, mrpt::utils::CSerializablePtr > TListObsPair
TSensorState getState() const
The current state of the sensor
std::multimap< mrpt::system::TTimeStamp, mrpt::utils::CSerializablePtr > TListObservations
Auxiliary structure used for CSerializable runtime class ID support.
static CGenericSensorPtr createSensorPtr(const std::string &className)
Just like createSensor, but returning a smart pointer to the newly created sensor object.
std::string m_path_for_external_images
The path where to save off-rawlog images: empty means save images embedded in the rawlog.
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
void enableVerbose(bool enabled=true)
Enable or disable extra debug info dumped to std::cout during sensor operation.
size_t m_max_queue_len
See CGenericSensor.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
double m_process_rate
See CGenericSensor.
TSensorState
The current state of the sensor.
size_t m_grab_decimation_counter
Used when "m_grab_decimation" is enabled.
unsigned int getExternalImageJPEGQuality() const
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...
std::string m_external_images_format
The extension ("jpg","gif","png",...) that determines the format of images saved externally.
#define MRPT_MAKE_ALIGNED_OPERATOR_NEW
void setExternalImageFormat(const std::string &ext)
Set the extension ("jpg","gif","png",...) that determines the format of images saved externally The d...
double getProcessRate() const
CLASSINIT_GENERIC_SENSOR(const TSensorClassId *pNewClass)
This class provides simple critical sections functionality.
This class allows loading and storing values and vectors of different types from a configuration text...
void setSensorLabel(const std::string &sensorLabel)
The base class of classes that cannot be copied: compile-time errors will be issued on any copy opera...
std::string m_sensorLabel
See CGenericSensor.
A generic interface for a wide-variety of sensors designed to be used in the application RawLogGrabbe...
void appendObservation(const mrpt::utils::CSerializablePtr &obj)
Like appendObservations() but for just one observation.
A structure for runtime ID class type information in the context of hwdrivers::CGenericSensor.
TListObservations m_objList
The queue of objects to be returned by getObservations.
unsigned int m_external_images_jpeg_quality
For JPEG images, the quality (default=95%).
static void registerClass(const TSensorClassId *pNewClass)
Register a class into the internal list of "CGenericSensor" descendents.
bool isVerboseEnabled() const
void BASE_IMPEXP registerClass(const mrpt::utils::TRuntimeClassId *pNewClass)
Register a class into the MRPT internal list of "CSerializable" descendents.
class HWDRIVERS_IMPEXP CGenericSensor
stlplus::smart_ptr< CGenericSensor > CGenericSensorPtr
synch::CCriticalSection m_csObjList
The critical section for m_objList.
std::string getSensorLabel() const
virtual void initialize()
This method can or cannot be implemented in the derived class, depending on the need for it.
size_t m_grab_decimation
If set to N>=2, only 1 out of N observations will be saved to m_objList.
Page generated by Doxygen 1.8.16 for MRPT 1.4.0 SVN: at Mon Oct 14 23:11:08 UTC 2019 | | |