17 #ifndef _GAZEBO_SENSORMANAGER_HH_ 18 #define _GAZEBO_SENSORMANAGER_HH_ 20 #include <boost/thread.hpp> 42 class GZ_SENSORS_VISIBLE SimTimeEvent
45 public: common::Time time;
48 public: boost::condition_variable *condition;
53 class GZ_SENSORS_VISIBLE SimTimeEventHandler
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:
bool Running()
const;
123 public:
void GetSensorTypes(std::vector<std::string> &_types)
const;
132 public: std::string CreateSensor(sdf::ElementPtr _elem,
133 const std::string &_worldName,
134 const std::string &_parentName,
144 public:
void OnCreateSensor(sdf::ElementPtr _elem,
145 const std::string &_worldName,
146 const std::string &_parentName,
147 const uint32_t _parentId);
152 public:
SensorPtr GetSensor(
const std::string &_name)
const;
156 public:
Sensor_V GetSensors()
const;
160 public:
void RemoveSensor(
const std::string &_name);
163 public:
void RemoveSensors();
167 public:
bool SensorsInitialized();
170 public:
void ResetLastUpdateTimes();
174 private:
void AddSensor(
SensorPtr _sensor);
182 private:
class SensorContainer
185 public: SensorContainer();
188 public:
virtual ~SensorContainer();
204 public:
bool Running()
const;
209 public:
virtual void Update(
bool _force =
false);
213 public:
void AddSensor(
SensorPtr _sensor);
220 public:
SensorPtr GetSensor(
const std::string &_name,
221 bool _useLeafName =
false)
const;
226 public:
bool RemoveSensor(
const std::string &_name);
229 public:
void RemoveSensors();
232 public:
void ResetLastUpdateTimes();
236 private:
void RunLoop();
246 private:
bool initialized;
249 private: boost::thread *runThread;
252 private:
mutable boost::recursive_mutex mutex;
256 private: boost::condition_variable runCondition;
263 private:
class ImageSensorContainer :
public SensorContainer
268 public:
virtual void Update(
bool _force =
false);
274 private:
bool initialized;
277 private:
bool removeAllSensors;
280 private:
mutable boost::recursive_mutex mutex;
286 private: std::vector<std::string> removeSensors;
289 private:
typedef std::vector<SensorContainer*> SensorContainer_V;
292 private: SensorContainer_V sensorContainers;
298 private:
friend class SensorContainer;
301 private: SimTimeEventHandler *simTimeEventHandler;
305 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
Class to manage and update all sensors.
Definition: SensorManager.hh:88
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.