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 <ignition/math/Vector3.hh>
22 #include <ignition/utils/ImplPtr.hh>
23 
24 #include "sdf/Atmosphere.hh"
25 #include "sdf/Element.hh"
26 #include "sdf/Gui.hh"
27 #include "sdf/Scene.hh"
28 #include "sdf/Types.hh"
29 #include "sdf/sdf_config.h"
30 #include "sdf/system_util.hh"
31 
32 namespace sdf
33 {
34  // Inline bracket to help doxygen filtering.
35  inline namespace SDF_VERSION_NAMESPACE {
36  //
37 
38  // Forward declare private data class.
39  class Actor;
40  class Frame;
41  class InterfaceModel;
42  class Light;
43  class Model;
44  class ParserConfig;
45  class Physics;
46  struct NestedInclude;
47  struct PoseRelativeToGraph;
48  struct FrameAttachedToGraph;
49  template <typename T> class ScopedGraph;
50 
52  {
54  public: World();
55 
62  public: Errors Load(ElementPtr _sdf);
63 
71  public: Errors Load(sdf::ElementPtr _sdf, const ParserConfig &_config);
72 
75  public: std::string Name() const;
76 
79  public: void SetName(const std::string &_name);
80 
85  public: std::string AudioDevice() const;
86 
91  public: void SetAudioDevice(const std::string &_device);
92 
97  public: ignition::math::Vector3d WindLinearVelocity() const;
98 
103  public: void SetWindLinearVelocity(const ignition::math::Vector3d &_wind);
104 
110  public: ignition::math::Vector3d Gravity() const;
111 
115  public: void SetGravity(const ignition::math::Vector3d &_gravity);
116 
123  public: ignition::math::Vector3d MagneticField() const;
124 
131  public: void SetMagneticField(const ignition::math::Vector3d &_mag);
132 
138  public: uint64_t ModelCount() const;
139 
146  public: const Model *ModelByIndex(const uint64_t _index) const;
147 
155  public: const Model *ModelByName(const std::string &_name) const;
156 
162  public: bool ModelNameExists(const std::string &_name) const;
163 
166  public: uint64_t ActorCount() const;
167 
173  public: const Actor *ActorByIndex(const uint64_t _index) const;
174 
178  public: bool ActorNameExists(const std::string &_name) const;
179 
185  public: uint64_t FrameCount() const;
186 
194  public: const Frame *FrameByIndex(const uint64_t _index) const;
195 
202  public: const Frame *FrameByName(const std::string &_name) const;
203 
209  public: bool FrameNameExists(const std::string &_name) const;
210 
213  public: uint64_t LightCount() const;
214 
220  public: const Light *LightByIndex(const uint64_t _index) const;
221 
225  public: bool LightNameExists(const std::string &_name) const;
226 
231  public: const sdf::Atmosphere *Atmosphere() const;
232 
235  public: void SetAtmosphere(const sdf::Atmosphere &_atmosphere);
236 
241  public: const sdf::Gui *Gui() const;
242 
245  public: void SetGui(const sdf::Gui &_gui);
246 
251  public: const sdf::Scene *Scene() const;
252 
255  public: void SetScene(const sdf::Scene &_scene);
256 
261  public: sdf::ElementPtr Element() const;
262 
265  public: uint64_t PhysicsCount() const;
266 
273  public: const Physics *PhysicsByIndex(const uint64_t _index) const;
274 
277  public: const Physics *PhysicsDefault() const;
278 
282  public: bool PhysicsNameExists(const std::string &_name) const;
283 
288  public: uint64_t InterfaceModelCount() const;
289 
296  public: std::shared_ptr<const InterfaceModel> InterfaceModelByIndex(
297  const uint64_t _index) const;
298 
306  public: const NestedInclude* InterfaceModelNestedIncludeByIndex(
307  const uint64_t _index) const;
308 
313  private: void SetPoseRelativeToGraph(
314  sdf::ScopedGraph<PoseRelativeToGraph> _graph);
315 
320  private: void SetFrameAttachedToGraph(
321  sdf::ScopedGraph<FrameAttachedToGraph> _graph);
322 
325  friend class Root;
326 
328  IGN_UTILS_IMPL_PTR(dataPtr)
329  };
330  }
331 }
332 #endif
Provides a description of a light source.
Definition: Light.hh:63
Provides a description of an actor.
Definition: Actor.hh:190
The physics element specifies the type and properties of a dynamics engine.
Definition: Physics.hh:36
Definition: World.hh:51
A Frame element descibes the properties associated with an explicit frame defined in a Model or World...
Definition: Frame.hh:42
std::vector< Error > Errors
A vector of Error.
Definition: Types.hh:98
The Atmosphere class contains information about an atmospheric model and related parameters such as t...
Definition: Atmosphere.hh:45
Definition: Model.hh:48
Contains the necessary information about an included model file for custom model parsers to be able t...
Definition: InterfaceElements.hh:43
#define SDFORMAT_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system_util.hh:41
Definition: Gui.hh:30
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:53
class SDFORMAT_VISIBLE Element
Definition: Element.hh:49
Definition: Scene.hh:33
Root class that acts as an entry point to the SDF document model.
Definition: Root.hh:54
This class contains configuration options for the libsdformat parser.
Definition: ParserConfig.hh:84
namespace for Simulation Description Format parser
Definition: Actor.hh:33