125 std::map<std::string, const TSensorClassId*>;
177 const std::vector<mrpt::serialization::CSerializable::Ptr>& obj);
183 std::vector<mrpt::serialization::CSerializable::Ptr>(1, obj));
194 const std::string& section) = 0;
231 const std::string& section);
288 !std::is_copy_constructible_v<CGenericSensor> &&
289 !std::is_copy_assignable_v<CGenericSensor>,
292 #define SENSOR_CLASS_ID(class_name) \ 293 static_cast<const mrpt::hwdrivers::TSensorClassId*>( \ 294 &mrpt::hwdrivers::class_name::class##class_name) 296 #define SENSOR_IS_CLASS(ptrObj, class_name) \ 297 (ptrObj->GetRuntimeClass() == SENSOR_CLASS_ID(class_name)) 302 #define DEFINE_GENERIC_SENSOR(class_name) \ 304 static mrpt::hwdrivers::TSensorClassId class##class_name; \ 305 const mrpt::hwdrivers::TSensorClassId* GetRuntimeClass() const override; \ 306 static mrpt::hwdrivers::CGenericSensor* CreateObject(); \ 307 static void doRegister() \ 309 CGenericSensor::registerClass(SENSOR_CLASS_ID(class_name)); \ 314 #define IMPLEMENTS_GENERIC_SENSOR(class_name, NameSpace) \ 315 mrpt::hwdrivers::CGenericSensor* NameSpace::class_name::CreateObject() \ 317 return static_cast<hwdrivers::CGenericSensor*>( \ 318 new NameSpace::class_name); \ 320 mrpt::hwdrivers::TSensorClassId NameSpace::class_name::class##class_name = \ 321 {#class_name, NameSpace::class_name::CreateObject}; \ 322 const mrpt::hwdrivers::TSensorClassId* \ 323 NameSpace::class_name::GetRuntimeClass() const \ 325 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.
double m_process_rate
See CGenericSensor.
std::map< std::string, const TSensorClassId * > registered_sensor_classes_t
Used in registerClass.
void appendObservation(const mrpt::serialization::CSerializable::Ptr &obj)
Like appendObservations() but for just one observation.
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
std::pair< mrpt::system::TTimeStamp, mrpt::serialization::CSerializable::Ptr > TListObsPair
std::string m_sensorLabel
See CGenericSensor.
virtual void doProcess()=0
This method will be invoked at a minimum rate of "process_rate" (Hz)
void enableVerbose(bool enabled=true)
Enable or disable extra debug info dumped to std::cout during sensor operation.
void getObservations(TListObservations &lstObjects)
Returns a list of enqueued objects, emptying it (thread-safe).
std::shared_ptr< CGenericSensor > Ptr
static CGenericSensor * createSensor(const std::string &className)
Creates a sensor by a name of the class.
unsigned int getExternalImageJPEGQuality() const
CGenericSensor & operator=(const CGenericSensor &)=delete
CGenericSensor()
Constructor.
void appendObservations(const std::vector< mrpt::serialization::CSerializable::Ptr > &obj)
This method must be called by derived classes to enqueue a new observation in the list to be returned...
mrpt::Clock::time_point TTimeStamp
A system independent time type, it holds the the number of 100-nanosecond intervals since January 1...
MRPT_FILL_ENUM_MEMBER(mrpt::hwdrivers::CGenericSensor, ssInitializing)
This class allows loading and storing values and vectors of different types from a configuration text...
virtual ~CGenericSensor()
Destructor.
const char * className
Class name.
static void registerClass(const TSensorClassId *pNewClass)
Register a class into the internal list of "CGenericSensor" descendents.
static registered_sensor_classes_t & get_registered_sensor_classes()
Access to singleton.
static Ptr createSensorPtr(const std::string &className)
Just like createSensor, but returning a smart pointer to the newly created sensor object...
TSensorState getState() const
The current state of the sensor.
void loadConfig(const mrpt::config::CConfigFileBase &configSource, const std::string §ion)
Loads the generic settings common to any sensor (See CGenericSensor), then call to "loadConfig_sensor...
#define MRPT_ENUM_TYPE_END()
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.
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.
virtual void loadConfig_sensorSpecific(const mrpt::config::CConfigFileBase &configSource, const std::string §ion)=0
Loads specific configuration for the device from a given source of configuration parameters, for example, an ".ini" file, loading from the section "[iniSection]" (see config::CConfigFileBase and derived classes)
std::string getSensorLabel() const
std::multimap< mrpt::system::TTimeStamp, mrpt::serialization::CSerializable::Ptr > TListObservations
unsigned int m_external_images_jpeg_quality
For JPEG images, the quality (default=95%).
std::mutex m_csObjList
The critical section for m_objList.
void setSensorLabel(const std::string &sensorLabel)
TSensorState
The current state of the sensor.
virtual void initialize()
This method can or cannot be implemented in the derived class, depending on the need for it...
virtual const mrpt::hwdrivers::TSensorClassId * GetRuntimeClass() const =0
std::string m_external_images_format
The extension ("jpg","gif","png",...) that determines the format of images saved externally.
bool isVerboseEnabled() const
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_ENUM_TYPE_BEGIN(_ENUM_TYPE_WITH_NS)
A structure for runtime ID class type information in the context of hwdrivers::CGenericSensor.
#define MRPT_UNUSED_PARAM(a)
Determines whether this is an X86 or AMD64 platform.