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 
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 
81  public: std::string Name() const;
82 
85  public: void SetName(const std::string &_name) const;
86 
91  public: std::string AudioDevice() const;
92 
97  public: void SetAudioDevice(const std::string &_device);
98 
103  public: ignition::math::Vector3d WindLinearVelocity() const;
104 
109  public: void SetWindLinearVelocity(const ignition::math::Vector3d &_wind);
110 
116  public: ignition::math::Vector3d Gravity() const;
117 
121  public: void SetGravity(const ignition::math::Vector3d &_gravity);
122 
129  public: ignition::math::Vector3d MagneticField() const;
130 
137  public: void SetMagneticField(const ignition::math::Vector3d &_mag);
138 
141  public: uint64_t ModelCount() const;
142 
148  public: const Model *ModelByIndex(const uint64_t _index) const;
149 
153  public: const Model *ModelByName(const std::string &_name) const;
154 
158  public: bool ModelNameExists(const std::string &_name) const;
159 
162  public: uint64_t ActorCount() const;
163 
169  public: const Actor *ActorByIndex(const uint64_t _index) const;
170 
174  public: bool ActorNameExists(const std::string &_name) const;
175 
178  public: uint64_t FrameCount() const;
179 
186  public: const Frame *FrameByIndex(const uint64_t _index) const;
187 
192  public: const Frame *FrameByName(const std::string &_name) const;
193 
197  public: bool FrameNameExists(const std::string &_name) const;
198 
201  public: uint64_t LightCount() const;
202 
208  public: const Light *LightByIndex(const uint64_t _index) const;
209 
213  public: bool LightNameExists(const std::string &_name) const;
214 
219  public: const sdf::Atmosphere *Atmosphere() const;
220 
223  public: void SetAtmosphere(const sdf::Atmosphere &_atmosphere) const;
224 
229  public: sdf::Gui *Gui() const;
230 
233  public: void SetGui(const sdf::Gui &_gui);
234 
239  public: const sdf::Scene *Scene() const;
240 
243  public: void SetScene(const sdf::Scene &_scene);
244 
249  public: sdf::ElementPtr Element() const;
250 
253  public: uint64_t PhysicsCount() const;
254 
261  public: const Physics *PhysicsByIndex(const uint64_t _index) const;
262 
265  public: const Physics *PhysicsDefault() const;
266 
270  public: bool PhysicsNameExists(const std::string &_name) const;
271 
273  private: WorldPrivate *dataPtr = nullptr;
274  };
275  }
276 }
277 #endif
sdf::v9::World::operator=
World & operator=(const World &_world)
Copy assignment operator.
sdf::v9::World::ModelByName
const Model * ModelByName(const std::string &_name) const
Get a model based on a name.
sdf::v9::World::World
World(const World &_world)
Copy constructor.
sdf::v9::World::FrameByName
const Frame * FrameByName(const std::string &_name) const
Get an explicit frame based on a name.
Gui.hh
sdf::v9::World::PhysicsDefault
const Physics * PhysicsDefault() const
Get the default physics profile.
sdf::v9::World::Gravity
ignition::math::Vector3d Gravity() const
Get the acceleration due to gravity.
sdf::v9::World::Name
std::string Name() const
Get the name of the world.
sdf::v9::World::PhysicsNameExists
bool PhysicsNameExists(const std::string &_name) const
Get whether a physics profile name exists.
Scene.hh
sdf
namespace for Simulation Description Format parser
Definition: Actor.hh:33
sdf::v9::World::Load
Errors Load(ElementPtr _sdf)
Load the world based on a element pointer.
sdf::v9::World::~World
~World()
Destructor.
sdf::v9::World::SetAtmosphere
void SetAtmosphere(const sdf::Atmosphere &_atmosphere) const
Set the atmosphere model associated with this world.
sdf::v9::World::ActorNameExists
bool ActorNameExists(const std::string &_name) const
Get whether an actor name exists.
sdf::v9::World::WindLinearVelocity
ignition::math::Vector3d WindLinearVelocity() const
Get the wind linear velocity in the global/world coordinate frame.
sdf::v9::World::FrameCount
uint64_t FrameCount() const
Get the number of explicit frames.
sdf::v9::World::FrameNameExists
bool FrameNameExists(const std::string &_name) const
Get whether an explicit frame name exists.
sdf::v9::World::SetScene
void SetScene(const sdf::Scene &_scene)
Set the Scene parameters associated with this world.
sdf::v9::World::LightByIndex
const Light * LightByIndex(const uint64_t _index) const
Get a light based on an index.
sdf::v9::World::SetGravity
void SetGravity(const ignition::math::Vector3d &_gravity)
Set the acceleration due to gravity.
Types.hh
sdf::v9::World::ModelNameExists
bool ModelNameExists(const std::string &_name) const
Get whether a model name exists.
sdf::v9::Errors
std::vector< Error > Errors
A vector of Error.
Definition: Types.hh:89
sdf::v9::World::Atmosphere
const sdf::Atmosphere * Atmosphere() const
Get a pointer to the atmosphere model associated with this world.
sdf::v9::World::Gui
sdf::Gui * Gui() const
Get a pointer to the Gui associated with this world.
sdf::v9::World::PhysicsByIndex
const Physics * PhysicsByIndex(const uint64_t _index) const
Get a physics profile based on an index.
SDFORMAT_VISIBLE
#define SDFORMAT_VISIBLE
Definition: system_util.hh:48
sdf::v9::World
Definition: World.hh:46
sdf::v9::World::ActorCount
uint64_t ActorCount() const
Get the number of actors.
sdf::v9::World::SetAudioDevice
void SetAudioDevice(const std::string &_device)
Set the audio device name.
sdf::v9::World::SetGui
void SetGui(const sdf::Gui &_gui)
Set the Gui parameters associated with this world.
sdf::v9::World::SetName
void SetName(const std::string &_name) const
Set the name of the world.
sdf::v9::World::Element
sdf::ElementPtr Element() const
Get a pointer to the SDF element that was used during load.
sdf::v9::World::Scene
const sdf::Scene * Scene() const
Get a pointer to the Scene associated with this world.
sdf::v9::Light
Provides a description of a light source.
Definition: Light.hh:63
sdf::v9::Gui
Definition: Gui.hh:35
sdf::v9::World::SetWindLinearVelocity
void SetWindLinearVelocity(const ignition::math::Vector3d &_wind)
Set the wind linear velocity in the global/world coordinate frame.
sdf::v9::World::ModelByIndex
const Model * ModelByIndex(const uint64_t _index) const
Get a model based on an index.
sdf::v9::World::SetMagneticField
void SetMagneticField(const ignition::math::Vector3d &_mag)
Set the magnetic vector in Tesla, expressed in a coordinate frame defined by the SphericalCoordinate.
sdf::v9::Frame
A Frame element descibes the properties associated with an explicit frame defined in a Model or World...
Definition: Frame.hh:42
sdf::v9::World::LightCount
uint64_t LightCount() const
Get the number of lights.
sdf::v9::World::operator=
World & operator=(World &&_world)
Move assignment operator.
sdf::v9::Physics
The physics element specifies the type and properties of a dynamics engine.
Definition: Physics.hh:39
sdf::v9::ElementPtr
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:53
sdf::v9::Actor
Provides a description of an actor.
Definition: Actor.hh:278
sdf::v9::World::World
World()
Default constructor.
sdf::v9::Model
Definition: Model.hh:44
sdf::v9::World::World
World(World &&_world) noexcept
Move constructor.
system_util.hh
sdf::v9::World::MagneticField
ignition::math::Vector3d MagneticField() const
Get the magnetic vector in Tesla, expressed in a coordinate frame defined by the SphericalCoordinates...
sdf::v9::World::LightNameExists
bool LightNameExists(const std::string &_name) const
Get whether a light name exists.
sdf::v9::World::ModelCount
uint64_t ModelCount() const
Get the number of models.
sdf::v9::World::AudioDevice
std::string AudioDevice() const
Get the audio device name.
sdf::v9::Atmosphere
The Atmosphere class contains information about an atmospheric model and related parameters such as t...
Definition: Atmosphere.hh:47
Atmosphere.hh
sdf::v9::World::PhysicsCount
uint64_t PhysicsCount() const
Get the number of physics profiles.
sdf::v9::Scene
Definition: Scene.hh:37
Element.hh
sdf::v9::World::FrameByIndex
const Frame * FrameByIndex(const uint64_t _index) const
Get an explicit frame based on an index.
sdf::v9::World::ActorByIndex
const Actor * ActorByIndex(const uint64_t _index) const
Get an actor based on an index.