World.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2017 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 #ifndef SDF_WORLD_HH_
18 #define SDF_WORLD_HH_
19 
20 #include <string>
21 #include <gz/math/Vector3.hh>
22 
23 #include "sdf/Atmosphere.hh"
24 #include "sdf/Element.hh"
25 #include "sdf/Gui.hh"
26 #include "sdf/Scene.hh"
27 #include "sdf/Types.hh"
28 #include "sdf/sdf_config.h"
29 #include "sdf/system_util.hh"
30 
31 namespace sdf
32 {
33  // Inline bracket to help doxygen filtering.
34  inline namespace SDF_VERSION_NAMESPACE {
35  //
36 
37  // Forward declare private data class.
38  class Actor;
39  class Frame;
40  class Light;
41  class Model;
42  class Physics;
43  class WorldPrivate;
44 
46  {
48  public: World();
49 
52  public: World(const World &_world);
53 
56  public: World(World &&_world) noexcept;
57 
61  public: World &operator=(World &&_world);
62 
66  public: World &operator=(const World &_world);
67 
69  public: ~World();
70 
77  public: Errors Load(ElementPtr _sdf);
78 
83  public: Errors ValidateGraphs() const;
84 
87  public: std::string Name() const;
88 
91  public: void SetName(const std::string &_name) const;
92 
97  public: std::string AudioDevice() const;
98 
103  public: void SetAudioDevice(const std::string &_device);
104 
109  public: gz::math::Vector3d WindLinearVelocity() const;
110 
115  public: void SetWindLinearVelocity(const gz::math::Vector3d &_wind);
116 
122  public: gz::math::Vector3d Gravity() const;
123 
127  public: void SetGravity(const gz::math::Vector3d &_gravity);
128 
135  public: gz::math::Vector3d MagneticField() const;
136 
143  public: void SetMagneticField(const gz::math::Vector3d &_mag);
144 
147  public: uint64_t ModelCount() const;
148 
154  public: const Model *ModelByIndex(const uint64_t _index) const;
155 
159  public: const Model *ModelByName(const std::string &_name) const;
160 
164  public: bool ModelNameExists(const std::string &_name) const;
165 
168  public: uint64_t ActorCount() const;
169 
175  public: const Actor *ActorByIndex(const uint64_t _index) const;
176 
180  public: bool ActorNameExists(const std::string &_name) const;
181 
184  public: uint64_t FrameCount() const;
185 
192  public: const Frame *FrameByIndex(const uint64_t _index) const;
193 
198  public: const Frame *FrameByName(const std::string &_name) const;
199 
203  public: bool FrameNameExists(const std::string &_name) const;
204 
207  public: uint64_t LightCount() const;
208 
214  public: const Light *LightByIndex(const uint64_t _index) const;
215 
219  public: bool LightNameExists(const std::string &_name) const;
220 
225  public: const sdf::Atmosphere *Atmosphere() const;
226 
229  public: void SetAtmosphere(const sdf::Atmosphere &_atmosphere) const;
230 
235  public: sdf::Gui *Gui() const;
236 
239  public: void SetGui(const sdf::Gui &_gui);
240 
245  public: const sdf::Scene *Scene() const;
246 
249  public: void SetScene(const sdf::Scene &_scene);
250 
255  public: sdf::ElementPtr Element() const;
256 
259  public: uint64_t PhysicsCount() const;
260 
267  public: const Physics *PhysicsByIndex(const uint64_t _index) const;
268 
271  public: const Physics *PhysicsDefault() const;
272 
276  public: bool PhysicsNameExists(const std::string &_name) const;
277 
279  private: WorldPrivate *dataPtr = nullptr;
280  };
281  }
282 }
283 #endif
Gui.hh
Scene.hh
sdf
namespace for Simulation Description Format parser
Definition: Actor.hh:32
Types.hh
sdf::v9::Errors
std::vector< Error > Errors
A vector of Error.
Definition: Types.hh:89
SDFORMAT_VISIBLE
#define SDFORMAT_VISIBLE
Definition: system_util.hh:48
sdf::v9::World
Definition: World.hh:45
sdf::v9::Light
Provides a description of a light source.
Definition: Light.hh:62
sdf::v9::Gui
Definition: Gui.hh:34
sdf::v9::Frame
A Frame element descibes the properties associated with an explicit frame defined in a Model or World...
Definition: Frame.hh:41
sdf::v9::Physics
The physics element specifies the type and properties of a dynamics engine.
Definition: Physics.hh:38
sdf::v9::ElementPtr
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:53
sdf::v9::Actor
Provides a description of an actor.
Definition: Actor.hh:277
sdf::v9::Model
Definition: Model.hh:43
system_util.hh
sdf::v9::Element
class SDFORMAT_VISIBLE Element
Definition: Element.hh:49
sdf::v9::Atmosphere
The Atmosphere class contains information about an atmospheric model and related parameters such as t...
Definition: Atmosphere.hh:46
Atmosphere.hh
sdf::v9::Scene
Definition: Scene.hh:37
Element.hh