17 #ifndef _GAZEBO_WORLD_HH_
18 #define _GAZEBO_WORLD_HH_
31 #include <boost/thread.hpp>
32 #include <boost/enable_shared_from_this.hpp>
33 #include <boost/shared_ptr.hpp>
69 public boost::enable_shared_from_this<World>
74 public:
explicit World(
const std::string &_name =
"");
82 public:
void Load(sdf::ElementPtr _sdf);
87 public:
void Save(
const std::string &_filename);
97 public:
void Run(
unsigned int _iterations = 0);
101 public:
bool GetRunning()
const;
114 public:
void Clear();
118 public: std::string GetName()
const;
135 public: ignition::math::Vector3d Gravity()
const;
139 public:
void SetGravity(
const ignition::math::Vector3d &_gravity);
143 public:
void SetGravitySDF(
const ignition::math::Vector3d &_gravity);
147 public:
virtual ignition::math::Vector3d MagneticField()
const;
151 public:
void SetMagneticField(
const ignition::math::Vector3d &_mag);
155 public:
unsigned int GetModelCount()
const;
162 public:
ModelPtr GetModel(
unsigned int _index)
const;
166 public:
Model_V GetModels()
const;
170 public:
Light_V Lights()
const;
179 public:
void ResetTime();
182 public:
void Reset();
186 public:
void PrintEntityTree();
211 public:
bool IsPaused()
const;
215 public:
void SetPaused(
bool _p);
222 public:
BasePtr GetByName(
const std::string &_name);
229 public:
ModelPtr GetModel(
const std::string &_name);
243 public:
EntityPtr GetEntity(
const std::string &_name);
263 public:
void SetState(
const WorldState &_state);
268 public:
void InsertModelFile(
const std::string &_sdfFilename);
273 public:
void InsertModelString(
const std::string &_sdfString);
278 public:
void InsertModelSDF(
const sdf::SDF &_sdf);
283 public: std::string StripWorldName(
const std::string &_name)
const;
288 public:
void EnableAllModels();
293 public:
void DisableAllModels();
297 public:
void Step(
unsigned int _steps);
303 public:
void LoadPlugin(
const std::string &_filename,
304 const std::string &_name,
305 sdf::ElementPtr _sdf);
309 public:
void RemovePlugin(
const std::string &_name);
313 public: boost::mutex *GetSetWorldPoseMutex()
const;
317 public:
bool GetEnablePhysicsEngine();
321 public:
void EnablePhysicsEngine(
bool _enable);
324 public:
void UpdateStateSDF();
328 public:
bool IsLoaded()
const;
332 public:
void ClearModels();
354 public: uint32_t GetIterations()
const;
358 public: msgs::Scene GetSceneMsg()
const;
364 public:
void RunBlocking(
unsigned int _iterations = 0);
370 public:
void RemoveModel(
ModelPtr _model);
376 public:
void RemoveModel(
const std::string &_name);
380 public:
void ResetPhysicsStates();
388 public:
void _AddDirty(
Entity *_entity);
392 public:
bool SensorsInitialized()
const;
398 public:
void _SetSensorsInitialized(
const bool _init);
407 private:
ModelPtr GetModelById(
unsigned int _id);
413 private:
void LoadPlugins();
418 private:
void LoadEntities(sdf::ElementPtr _sdf,
BasePtr _parent);
430 private:
LightPtr LoadLight(
const sdf::ElementPtr &_sdf,
446 private:
void RunLoop();
449 private:
void Step();
452 private:
void LogStep();
455 private:
void Update();
459 private:
void OnPause(
bool _p);
462 private:
void OnStep();
466 private:
void OnControl(ConstWorldControlPtr &_data);
470 private:
void OnPlaybackControl(ConstLogPlaybackControlPtr &_data);
474 private:
void OnRequest(ConstRequestPtr &_msg);
480 private:
void BuildSceneMsg(msgs::Scene &_scene,
BasePtr _entity);
484 private:
void JointLog(ConstJointPtr &_msg);
488 private:
void OnFactoryMsg(ConstFactoryPtr &_data);
492 private:
void OnModelMsg(ConstModelPtr &_msg);
495 private:
void ModelUpdateTBB();
498 private:
void ModelUpdateSingleLoop();
502 private:
void LoadPlugin(sdf::ElementPtr _sdf);
507 private:
void FillModelMsg(msgs::Model &_msg,
ModelPtr _model);
511 private:
void ProcessEntityMsgs();
515 private:
void ProcessRequestMsgs();
519 private:
void ProcessFactoryMsgs();
523 private:
void ProcessModelMsgs();
527 private:
void ProcessLightFactoryMsgs();
531 private:
void ProcessLightModifyMsgs();
534 private:
bool OnLog(std::ostringstream &_stream);
537 private:
void ProcessMessages();
540 private:
void PublishWorldStats();
543 private:
void LogWorker();
550 private:
void OnLightMsg(ConstLightPtr &_msg);
555 private:
void OnLightFactoryMsg(ConstLightPtr &_msg);
560 private:
void OnLightModifyMsg(ConstLightPtr &_msg);
boost::shared_ptr< Base > BasePtr
Definition: PhysicsTypes.hh:72
boost::shared_ptr< Model > ModelPtr
Definition: PhysicsTypes.hh:88
A light entity.
Definition: physics/Light.hh:33
#define GZ_PHYSICS_VISIBLE
Definition: system.hh:259
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:39
Forward declarations for transport.
boost::shared_ptr< Light > LightPtr
Definition: PhysicsTypes.hh:96
default namespace for gazebo
std::vector< LightPtr > Light_V
Definition: PhysicsTypes.hh:212
Private data class for World.
Definition: WorldPrivate.hh:44
boost::shared_ptr< PhysicsEngine > PhysicsEnginePtr
Definition: PhysicsTypes.hh:116
The world provides access to all other object within a simulated environment.
Definition: World.hh:68
boost::shared_ptr< Entity > EntityPtr
Definition: PhysicsTypes.hh:80
Simbody physics engine.
Definition: SimbodyPhysics.hh:42
Base class for all physics objects in Gazebo.
Definition: Entity.hh:58
EntityType
Unique identifiers for all entity types.
Definition: Base.hh:84
boost::shared_ptr< Actor > ActorPtr
Definition: PhysicsTypes.hh:92
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
std::vector< ModelPtr > Model_V
Definition: PhysicsTypes.hh:196
Store state information of a physics::World object.
Definition: WorldState.hh:47
boost::shared_ptr< SphericalCoordinates > SphericalCoordinatesPtr
Definition: CommonTypes.hh:140
Base type.
Definition: Base.hh:86
A Time class, can be used to hold wall- or sim-time.
Definition: Time.hh:44
boost::shared_ptr< Road > RoadPtr
Definition: PhysicsTypes.hh:152
boost::shared_ptr< PresetManager > PresetManagerPtr
Definition: PhysicsTypes.hh:120
DART Link class.
Definition: DARTLink.hh:42