17 #ifndef GAZEBO_PHYSICS_WORLD_HH_ 18 #define GAZEBO_PHYSICS_WORLD_HH_ 33 #include <boost/enable_shared_from_this.hpp> 80 class GZ_PHYSICS_VISIBLE
World :
81 public boost::enable_shared_from_this<World>
86 public:
explicit World(
const std::string &_name =
"");
94 public:
void Load(sdf::ElementPtr _sdf);
98 public:
const sdf::ElementPtr SDF();
103 public:
void Save(
const std::string &_filename);
113 public:
void Run(
const unsigned int _iterations = 0);
117 public:
bool Running()
const;
131 public:
void Clear();
135 public: std::string Name()
const;
160 public: ignition::math::Vector3d Gravity()
const;
164 public:
void SetGravity(
const ignition::math::Vector3d &_gravity);
168 public:
void SetGravitySDF(
const ignition::math::Vector3d &_gravity);
172 public:
virtual ignition::math::Vector3d MagneticField()
const;
176 public:
void SetMagneticField(
const ignition::math::Vector3d &_mag);
180 public:
unsigned int ModelCount()
const;
187 public:
ModelPtr ModelByIndex(
const unsigned int _index)
const;
191 public:
Model_V Models()
const;
195 public:
unsigned int LightCount()
const;
199 public:
Light_V Lights()
const;
208 public:
void ResetTime();
211 public:
void Reset();
215 public:
void PrintEntityTree();
240 public:
bool IsPaused()
const;
244 public:
void SetPaused(
const bool _p);
251 public:
BasePtr BaseByName(
const std::string &_name)
const;
258 public:
ModelPtr ModelByName(
const std::string &_name)
const;
265 public:
LightPtr LightByName(
const std::string &_name)
const;
272 public:
EntityPtr EntityByName(
const std::string &_name)
const;
282 const ignition::math::Vector3d &_pt)
const;
290 const ignition::math::Vector3d &_pt)
const;
294 public:
void SetState(
const WorldState &_state);
299 public:
void InsertModelFile(
const std::string &_sdfFilename);
304 public:
void InsertModelString(
const std::string &_sdfString);
309 public:
void InsertModelSDF(
const sdf::SDF &_sdf);
314 public: std::string StripWorldName(
const std::string &_name)
const;
319 public:
void EnableAllModels();
324 public:
void DisableAllModels();
328 public:
void Step(
const unsigned int _steps);
334 public:
void LoadPlugin(
const std::string &_filename,
335 const std::string &_name,
336 sdf::ElementPtr _sdf);
340 public:
void RemovePlugin(
const std::string &_name);
344 public: std::mutex &WorldPoseMutex()
const;
348 public:
bool PhysicsEnabled()
const;
352 public:
void SetPhysicsEnabled(
const bool _enable);
356 public:
bool WindEnabled()
const;
360 public:
void SetWindEnabled(
const bool _enable);
364 public:
bool AtmosphereEnabled()
const;
368 public:
void SetAtmosphereEnabled(
const bool _enable);
371 public:
void UpdateStateSDF();
375 public:
bool IsLoaded()
const;
379 public:
void ClearModels();
401 public: uint32_t Iterations()
const;
405 public: msgs::Scene SceneMsg()
const;
411 public:
void RunBlocking(
const unsigned int _iterations = 0);
417 public:
void RemoveModel(
ModelPtr _model);
423 public:
void RemoveModel(
const std::string &_name);
427 public:
void ResetPhysicsStates();
435 public:
void _AddDirty(
Entity *_entity);
439 public:
bool SensorsInitialized()
const;
445 public:
void _SetSensorsInitialized(
const bool _init);
456 public: std::string UniqueModelName(
const std::string &_name);
465 private:
ModelPtr ModelById(
const unsigned int _id)
const;
471 private:
void LoadPlugins();
476 private:
void LoadEntities(sdf::ElementPtr _sdf,
BasePtr _parent);
488 public:
LightPtr LoadLight(
const sdf::ElementPtr &_sdf,
504 private:
void RunLoop();
507 private:
void Step();
510 private:
void LogStep();
513 private:
void Update();
517 private:
void OnPause(
bool _p);
520 private:
void OnStep();
524 private:
void OnControl(ConstWorldControlPtr &_data);
528 private:
void OnPlaybackControl(ConstLogPlaybackControlPtr &_data);
532 private:
void OnRequest(ConstRequestPtr &_msg);
538 private:
void BuildSceneMsg(msgs::Scene &_scene,
BasePtr _entity);
542 private:
void JointLog(ConstJointPtr &_msg);
546 private:
void OnFactoryMsg(ConstFactoryPtr &_data);
550 private:
void OnModelMsg(ConstModelPtr &_msg);
553 private:
void ModelUpdateTBB();
556 private:
void ModelUpdateSingleLoop();
560 private:
void LoadPlugin(sdf::ElementPtr _sdf);
565 private:
void FillModelMsg(msgs::Model &_msg,
ModelPtr _model);
569 private:
void ProcessEntityMsgs();
573 private:
void ProcessRequestMsgs();
577 private:
void ProcessFactoryMsgs();
581 private:
void ProcessModelMsgs();
585 private:
void ProcessLightFactoryMsgs();
589 private:
void ProcessLightModifyMsgs();
593 private:
void ProcessPlaybackControlMsgs();
596 private:
bool OnLog(std::ostringstream &_stream);
600 private:
void LogModelResources();
603 private:
void ProcessMessages();
606 private:
void PublishWorldStats();
609 private:
void LogWorker();
612 private:
void RegisterIntrospectionItems();
615 private:
void UnregisterIntrospectionItems();
620 private:
void OnLightFactoryMsg(ConstLightPtr &_msg);
625 private:
void OnLightModifyMsg(ConstLightPtr &_msg);
643 private:
bool PluginInfoService(
const ignition::msgs::StringMsg &_request,
644 ignition::msgs::Plugin_V &_plugins);
648 private: std::unique_ptr<WorldPrivate> dataPtr;
boost::shared_ptr< Actor > ActorPtr
Definition: PhysicsTypes.hh:97
boost::shared_ptr< PresetManager > PresetManagerPtr
Definition: PhysicsTypes.hh:129
Forward declarations for the common classes.
Definition: Animation.hh:26
std::vector< ModelPtr > Model_V
Definition: PhysicsTypes.hh:205
std::vector< LightPtr > Light_V
Definition: PhysicsTypes.hh:221
Forward declarations for transport.
default namespace for gazebo
A complete URI.
Definition: URI.hh:176
boost::shared_ptr< PhysicsEngine > PhysicsEnginePtr
Definition: PhysicsTypes.hh:125
The world provides access to all other object within a simulated environment.
Definition: World.hh:80
Simbody physics engine.
Definition: SimbodyPhysics.hh:42
boost::shared_ptr< SphericalCoordinates > SphericalCoordinatesPtr
Definition: CommonTypes.hh:121
Base class for wind.
Definition: Wind.hh:41
Base class for all physics objects in Gazebo.
Definition: Entity.hh:52
boost::shared_ptr< Entity > EntityPtr
Definition: PhysicsTypes.hh:85
boost::shared_ptr< Road > RoadPtr
Definition: PhysicsTypes.hh:161
boost::shared_ptr< Model > ModelPtr
Definition: PhysicsTypes.hh:93
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
EntityType
Unique identifiers for all entity types.
Definition: Base.hh:81
boost::shared_ptr< Light > LightPtr
Definition: PhysicsTypes.hh:105
Store state information of a physics::World object.
Definition: WorldState.hh:47
This models a base atmosphere class to serve as a common interface to any derived atmosphere models...
Definition: Atmosphere.hh:42
boost::shared_ptr< Base > BasePtr
Definition: PhysicsTypes.hh:77
A Time class, can be used to hold wall- or sim-time.
Definition: Time.hh:44
DART Link class.
Definition: DARTLink.hh:39