CustomSensorPreloader.h
Go to the documentation of this file.
1 #ifndef GAZEBO_CUSTOM_SENSOR_PRELOADER_CUSTOMSENSORPRELOADER_H
2 #define GAZEBO_CUSTOM_SENSOR_PRELOADER_CUSTOMSENSORPRELOADER_H
3 
4 #include <gazebo/common/Plugin.hh>
5 
6 #include <memory>
7 #include <thread>
8 #include <tuple>
9 #include <unordered_set>
10 
11 namespace gazebo
12 {
13 
17 class CustomSensorPreloader : public SystemPlugin
18 {
19  public: CustomSensorPreloader();
20  public: ~CustomSensorPreloader() override;
21  public: void Load(int _argc, char **_argv) override;
22  public: void Init() override;
23  public: void Reset() override;
24 
29  protected: virtual void DeferredPreloadSensors();
30 
32  typedef void (*registerFuncType)();
33 
41  protected: virtual void ProcessCustomSensor(const std::string& _type,
42  const std::string& _classname,
43  const std::string& _fullname);
44 
46  protected: std::unique_ptr<std::thread> deferredLoadThread;
47 
49  typedef std::tuple<registerFuncType, std::string, std::string, std::string> registerTuple;
51  protected: std::unordered_set<std::shared_ptr<registerTuple> > sensorsToRegister;
52 };
53 
54 }
55 
56 #endif //GAZEBO_CUSTOM_SENSOR_PRELOADER_CUSTOMSENSORPRELOADER_H
gazebo::CustomSensorPreloader::Load
void Load(int _argc, char **_argv) override
Definition: CustomSensorPreloader.cpp:218
gazebo
gazebo::CustomSensorPreloader::Init
void Init() override
Definition: CustomSensorPreloader.cpp:28
gazebo::CustomSensorPreloader::DeferredPreloadSensors
virtual void DeferredPreloadSensors()
We need to register the sensors a little bit later, so we defer the calls to a separate thread.
Definition: CustomSensorPreloader.cpp:108
gazebo::CustomSensorPreloader::registerTuple
std::tuple< registerFuncType, std::string, std::string, std::string > registerTuple
Registration function, type, classname, fullname.
Definition: CustomSensorPreloader.h:49
gazebo::CustomSensorPreloader::Reset
void Reset() override
Definition: CustomSensorPreloader.cpp:224
gazebo::CustomSensorPreloader::~CustomSensorPreloader
~CustomSensorPreloader() override
Definition: CustomSensorPreloader.cpp:20
gazebo::CustomSensorPreloader::deferredLoadThread
std::unique_ptr< std::thread > deferredLoadThread
This thread performs the deferred preloading.
Definition: CustomSensorPreloader.h:46
gazebo::CustomSensorPreloader::CustomSensorPreloader
CustomSensorPreloader()
gazebo::CustomSensorPreloader
Gazebo system plugin which allows using custom sensors.
Definition: CustomSensorPreloader.h:17
gazebo::CustomSensorPreloader::registerFuncType
void(* registerFuncType)()
Type of the RegisterCustomSensor function generated by GZ_REGISTER_STATIC_SENSOR.
Definition: CustomSensorPreloader.h:32
gazebo::CustomSensorPreloader::ProcessCustomSensor
virtual void ProcessCustomSensor(const std::string &_type, const std::string &_classname, const std::string &_fullname)
Store one custom sensor registration function for deferred loading.
Definition: CustomSensorPreloader.cpp:152
gazebo::CustomSensorPreloader::sensorsToRegister
std::unordered_set< std::shared_ptr< registerTuple > > sensorsToRegister
A set of sensors waiting for deferred registration.
Definition: CustomSensorPreloader.h:51


gazebo_custom_sensor_preloader
Author(s): Martin Pecka
autogenerated on Sun Sep 3 2023 02:35:25