17 #ifndef _GAZEBO_SENSORMANAGER_HH_ 18 #define _GAZEBO_SENSORMANAGER_HH_ 20 #include <boost/thread.hpp> 45 public: common::Time time;
48 public: boost::condition_variable *condition;
56 public: SimTimeEventHandler();
59 public:
virtual ~SimTimeEventHandler();
66 public:
void AddRelativeEvent(
const common::Time &_time,
67 boost::condition_variable *_var);
71 private:
void OnUpdate(
const common::UpdateInfo &_info);
74 private: boost::mutex mutex;
77 private: std::list<SimTimeEvent*> events;
102 public:
void Update(
bool _force =
false);
109 public:
void RunThreads();
119 public:
void GetSensorTypes(std::vector<std::string> &_types)
const;
128 public: std::string CreateSensor(sdf::ElementPtr _elem,
129 const std::string &_worldName,
130 const std::string &_parentName,
140 public:
void OnCreateSensor(sdf::ElementPtr _elem,
141 const std::string &_worldName,
142 const std::string &_parentName,
143 const uint32_t _parentId);
148 public:
SensorPtr GetSensor(
const std::string &_name)
const;
152 public:
Sensor_V GetSensors()
const;
156 public:
void RemoveSensor(
const std::string &_name);
159 public:
void RemoveSensors();
163 public:
bool SensorsInitialized();
166 public:
void ResetLastUpdateTimes();
170 private:
void AddSensor(
SensorPtr _sensor);
178 private:
class SensorContainer
181 public: SensorContainer();
184 public:
virtual ~SensorContainer();
201 public:
virtual void Update(
bool _force =
false);
205 public:
void AddSensor(
SensorPtr _sensor);
212 public:
SensorPtr GetSensor(
const std::string &_name,
213 bool _useLeafName =
false)
const;
218 public:
bool RemoveSensor(
const std::string &_name);
221 public:
void RemoveSensors();
224 public:
void ResetLastUpdateTimes();
228 private:
void RunLoop();
238 private:
bool initialized;
241 private: boost::thread *runThread;
244 private:
mutable boost::recursive_mutex mutex;
248 private: boost::condition_variable runCondition;
255 private:
class ImageSensorContainer :
public SensorContainer
260 public:
virtual void Update(
bool _force =
false);
266 private:
bool initialized;
269 private:
bool removeAllSensors;
272 private:
mutable boost::recursive_mutex mutex;
278 private: std::vector<std::string> removeSensors;
281 private:
typedef std::vector<SensorContainer*> SensorContainer_V;
284 private: SensorContainer_V sensorContainers;
290 private:
friend class SensorContainer;
293 private: SimTimeEventHandler *simTimeEventHandler;
296 private: std::map<std::string, physics::WorldPtr> worlds;
std::shared_ptr< Sensor > SensorPtr
Definition: SensorTypes.hh:63
Forward declarations for the common classes.
Definition: Animation.hh:33
Singleton template class.
Definition: SingletonT.hh:33
default namespace for gazebo
Class to manage and update all sensors.
Definition: SensorManager.hh:88
GAZEBO_VISIBLE void stop()
Stop the sensor generation loop.
boost::shared_ptr< Connection > ConnectionPtr
Definition: CommonTypes.hh:153
std::vector< SensorPtr > Sensor_V
Definition: SensorTypes.hh:147
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
Forward declarations and typedefs for sensors.
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:59