17 #ifndef _GAZEBO_SENSORMANAGER_HH_ 18 #define _GAZEBO_SENSORMANAGER_HH_ 20 #include <boost/thread.hpp> 25 #include <condition_variable> 46 class GZ_SENSORS_VISIBLE SimTimeEvent
49 public: common::Time time;
52 public: boost::condition_variable *condition;
57 class GZ_SENSORS_VISIBLE SimTimeEventHandler
60 public: SimTimeEventHandler();
63 public:
virtual ~SimTimeEventHandler();
70 public:
void AddRelativeEvent(
const common::Time &_time,
71 boost::condition_variable *_var);
75 private:
void OnUpdate(
const common::UpdateInfo &_info);
78 private: boost::mutex mutex;
81 private: std::list<SimTimeEvent*> events;
106 public:
void Update(
bool _force =
false);
113 public:
void RunThreads();
123 public:
bool Running()
const;
127 public:
void GetSensorTypes(std::vector<std::string> &_types)
const;
136 public: std::string CreateSensor(sdf::ElementPtr _elem,
137 const std::string &_worldName,
138 const std::string &_parentName,
148 public:
void OnCreateSensor(sdf::ElementPtr _elem,
149 const std::string &_worldName,
150 const std::string &_parentName,
151 const uint32_t _parentId);
156 public:
SensorPtr GetSensor(
const std::string &_name)
const;
160 public:
Sensor_V GetSensors()
const;
164 public:
void RemoveSensor(
const std::string &_name);
167 public:
void RemoveSensors();
171 public:
bool SensorsInitialized();
174 public:
void ResetLastUpdateTimes();
178 private:
void AddSensor(
SensorPtr _sensor);
186 private:
class SensorContainer
189 public: SensorContainer();
192 public:
virtual ~SensorContainer();
208 public:
bool Running()
const;
213 public:
virtual void Update(
bool _force =
false);
217 public:
void AddSensor(
SensorPtr _sensor);
224 public:
SensorPtr GetSensor(
const std::string &_name,
225 bool _useLeafName =
false)
const;
230 public:
bool RemoveSensor(
const std::string &_name);
233 public:
void RemoveSensors();
236 public:
void ResetLastUpdateTimes();
240 private:
void RunLoop();
250 private:
bool initialized;
253 private: boost::thread *runThread;
256 private:
mutable boost::recursive_mutex mutex;
260 private: boost::condition_variable runCondition;
267 private:
class ImageSensorContainer :
public SensorContainer
272 public:
virtual void Update(
bool _force =
false);
275 private: std::condition_variable conditionPrerendered;
281 private:
bool initialized;
284 private:
bool removeAllSensors;
287 private:
mutable boost::recursive_mutex mutex;
293 private: std::vector<std::string> removeSensors;
296 private:
typedef std::vector<SensorContainer*> SensorContainer_V;
299 private: SensorContainer_V sensorContainers;
305 private:
friend class SensorContainer;
308 private: SimTimeEventHandler *simTimeEventHandler;
312 private: std::map<std::string, physics::WorldPtr> worlds;
std::shared_ptr< Sensor > SensorPtr
Definition: SensorTypes.hh:64
void stop()
Stop the sensor generation loop.
Forward declarations for the common classes.
Definition: Animation.hh:26
Singleton template class.
Definition: SingletonT.hh:33
default namespace for gazebo
sensors
Definition: SensorManager.hh:36
Class to manage and update all sensors.
Definition: SensorManager.hh:92
boost::shared_ptr< Connection > ConnectionPtr
Definition: CommonTypes.hh:134
std::vector< SensorPtr > Sensor_V
Definition: SensorTypes.hh:152
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
Forward declarations and typedefs for sensors.
#define GZ_SINGLETON_DECLARE(visibility, n1, n2, singletonType)
Helper to declare typed SingletonT.
Definition: SingletonT.hh:61