25 CGenericSensor::CGenericSensor()
26 : m_sensorLabel(
"UNNAMED_SENSOR"),
28 m_path_for_external_images(),
29 m_external_images_format(
"png")
32 const char* sVerbose = getenv(
"MRPT_HWDRIVERS_VERBOSE");
33 m_verbose = (sVerbose !=
nullptr) && atoi(sVerbose) != 0;
49 const std::vector<mrpt::serialization::CSerializable::Ptr>& objs)
57 for (
const auto& obj : objs)
66 timestamp =
dynamic_cast<CAction*
>(obj.get())->timestamp;
68 else if (obj->GetRuntimeClass()->derivedFrom(
71 timestamp =
dynamic_cast<CObservation*
>(obj.get())->timestamp;
100 const auto it = regs.find(className);
101 return it == regs.end() ? nullptr : it->second->ptrCreateObject();
132 sect,
"process_rate", 0);
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.
std::string read_string(const std::string §ion, const std::string &name, const std::string &defaultValue, bool failIfNotFound=false) const
#define THROW_EXCEPTION(msg)
std::pair< mrpt::system::TTimeStamp, mrpt::serialization::CSerializable::Ptr > TListObsPair
std::string m_sensorLabel
See CGenericSensor.
Contains classes for various device interfaces.
void getObservations(TListObservations &lstObjects)
Returns a list of enqueued objects, emptying it (thread-safe).
static CGenericSensor * createSensor(const std::string &className)
Creates a sensor by a name of the class.
int read_int(const std::string §ion, const std::string &name, int defaultValue, bool failIfNotFound=false) const
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...
This class allows loading and storing values and vectors of different types from a configuration text...
virtual ~CGenericSensor()
Destructor.
#define CLASS_ID(T)
Access to runtime class ID for a defined class name.
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.
This namespace contains representation of robot actions and observations.
double read_double(const std::string §ion, const std::string &name, double defaultValue, bool failIfNotFound=false) const
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...
size_t m_max_queue_len
See CGenericSensor.
Declares a class for storing a robot action.
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::multimap< mrpt::system::TTimeStamp, mrpt::serialization::CSerializable::Ptr > TListObservations
Declares a class that represents any robot's observation.
std::mutex m_csObjList
The critical section for m_objList.
A structure for runtime ID class type information in the context of hwdrivers::CGenericSensor.