17 #ifndef _GAZEBO_SENSORMANAGER_HH_
18 #define _GAZEBO_SENSORMANAGER_HH_
20 #include <boost/thread.hpp>
44 public: common::Time time;
47 public: boost::condition_variable *condition;
55 public: SimTimeEventHandler();
58 public:
virtual ~SimTimeEventHandler();
65 public:
void AddRelativeEvent(
const common::Time &_time,
66 boost::condition_variable *_var);
70 private:
void OnUpdate(
const common::UpdateInfo &_info);
73 private: boost::mutex mutex;
76 private: std::list<SimTimeEvent*> events;
101 public:
void Update(
bool _force =
false);
108 public:
void RunThreads();
118 public:
void GetSensorTypes(std::vector<std::string> &_types)
const;
127 public: std::string CreateSensor(sdf::ElementPtr _elem,
128 const std::string &_worldName,
129 const std::string &_parentName,
135 public:
SensorPtr GetSensor(
const std::string &_name)
const;
139 public:
Sensor_V GetSensors()
const;
143 public:
void RemoveSensor(
const std::string &_name);
146 public:
void RemoveSensors();
150 public:
bool SensorsInitialized();
153 public:
void ResetLastUpdateTimes();
157 private:
void AddSensor(
SensorPtr _sensor);
165 private:
class SensorContainer
168 public: SensorContainer();
171 public:
virtual ~SensorContainer();
188 public:
virtual void Update(
bool _force =
false);
192 public:
void AddSensor(
SensorPtr _sensor);
199 public:
SensorPtr GetSensor(
const std::string &_name,
200 bool _useLeafName =
false)
const;
205 public:
bool RemoveSensor(
const std::string &_name);
208 public:
void RemoveSensors();
211 public:
void ResetLastUpdateTimes();
215 private:
void RunLoop();
225 private:
bool initialized;
228 private: boost::thread *runThread;
231 private:
mutable boost::recursive_mutex mutex;
235 private: boost::condition_variable runCondition;
242 private:
class ImageSensorContainer :
public SensorContainer
247 public:
virtual void Update(
bool _force =
false);
253 private:
bool initialized;
256 private:
bool removeAllSensors;
259 private:
mutable boost::recursive_mutex mutex;
265 private: std::vector<std::string> removeSensors;
268 private:
typedef std::vector<SensorContainer*> SensorContainer_V;
271 private: SensorContainer_V sensorContainers;
277 private:
friend class SensorContainer;
280 private: SimTimeEventHandler *simTimeEventHandler;
boost::shared_ptr< Connection > ConnectionPtr
Definition: CommonTypes.hh:147
std::vector< SensorPtr > Sensor_V
Definition: SensorTypes.hh:146
Singleton template class.
Definition: SingletonT.hh:33
default namespace for gazebo
Class to manage and update all sensors.
Definition: SensorManager.hh:87
GAZEBO_VISIBLE void stop()
Stop the sensor generation loop.
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
Forward declarations and typedefs for sensors.
boost::shared_ptr< Sensor > SensorPtr
Definition: SensorTypes.hh:62
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:66