Go to the documentation of this file.
17 #ifndef GZ_SENSORS_MANAGER_HH_
18 #define GZ_SENSORS_MANAGER_HH_
22 #include <type_traits>
25 #include <gz/common/SuppressWarning.hh>
26 #include <gz/common/Time.hh>
27 #include <gz/common/Console.hh>
28 #include <gz/sensors/config.hh>
29 #include <gz/sensors/Export.hh>
37 inline namespace IGNITION_SENSORS_VERSION_NAMESPACE {
81 public:
template<
typename T>
88 T *result =
dynamic_cast<T*
>(this->
Sensor(
id));
91 ignerr <<
"SDF sensor type does not match template type\n";
96 ignerr <<
"Failed to create sensor of type["
97 << _sdf.TypeStr() <<
"]\n";
118 public:
template<
typename T>
125 T *result =
dynamic_cast<T*
>(this->
Sensor(
id));
127 if (
nullptr == result)
129 ignerr <<
"Failed to create sensor [" <<
id <<
"] of type ["
131 <<
"]. SDF sensor type does not match template type."
138 ignerr <<
"Failed to create sensor of type ["
185 public: gz::sensors::Sensor *
Sensor(
197 public:
void RunOnce(
const gz::common::Time &_time,
198 bool _force =
false);
201 public:
void AddPluginPaths(
const std::string &_path);
207 const std::string &_filename, sdf::ElementPtr _sdf);
209 IGN_COMMON_WARN_IGNORE__DLL_INTERFACE_MISSING
212 IGN_COMMON_WARN_RESUME__DLL_INTERFACE_MISSING
T * CreateSensor(sdf::ElementPtr _sdf)
Create a sensor from SDF with a known sensor type.
Definition: gz/sensors/Manager.hh:119
Definition: gz/sensors/AirPressureSensor.hh:32
virtual ~Manager()
destructor
Loads and runs sensors.
Definition: gz/sensors/Manager.hh:52
std::size_t SensorId
A string used to identify a sensor.
Definition: gz/sensors/Sensor.hh:49
const SensorId NO_SENSOR
Definition: gz/sensors/Sensor.hh:50
void AddPluginPaths(const std::string &_path)
Adds colon delimited paths sensor plugins may be.
void RunOnce(const gz::common::Time &_time, bool _force=false)
Run the sensor generation one step.
bool Init()
Initialize the sensor library without rendering or physics.
Sensor * Sensor(SensorId _id)
Get an instance of a loaded sensor by sensor id.
a base sensor class
Definition: gz/sensors/Sensor.hh:60
T * CreateSensor(sdf::Sensor _sdf)
Create a sensor from SDF with a known sensor type.
Definition: gz/sensors/Manager.hh:82
bool Remove(const SensorId _id)
Remove a sensor by ID.