Gazebo Sim

API Reference

7.7.0
gz/sim/World.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 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 GZ_SIM_WORLD_HH_
18 #define GZ_SIM_WORLD_HH_
19 
20 #include <memory>
21 #include <optional>
22 #include <string>
23 #include <vector>
24 
25 #include <sdf/Atmosphere.hh>
26 #include <gz/math/Vector3.hh>
27 #include <gz/math/SphericalCoordinates.hh>
28 
29 #include "gz/sim/config.hh"
31 #include "gz/sim/Export.hh"
32 #include "gz/sim/Types.hh"
33 
34 namespace gz
35 {
36  namespace sim
37  {
38  // Inline bracket to help doxygen filtering.
39  inline namespace GZ_SIM_VERSION_NAMESPACE {
40  // Forward declarations.
41  class GZ_SIM_HIDDEN WorldPrivate;
42  //
61  class GZ_SIM_VISIBLE World {
64  public: explicit World(sim::Entity _entity = kNullEntity);
65 
68  public: World(const World &_world);
69 
72  public: World(World &&_world) noexcept;
73 
77  public: World &operator=(World &&_world) noexcept;
78 
82  public: World &operator=(const World &_world);
83 
85  public: virtual ~World();
86 
89  public: sim::Entity Entity() const;
90 
95  public: bool Valid(const EntityComponentManager &_ecm) const;
96 
101  public: std::optional<std::string> Name(
102  const EntityComponentManager &_ecm) const;
103 
108  public: std::optional<math::Vector3d> Gravity(
109  const EntityComponentManager &_ecm) const;
110 
115  public: std::optional<math::Vector3d> MagneticField(
116  const EntityComponentManager &_ecm) const;
117 
122  public: std::optional<sdf::Atmosphere> Atmosphere(
123  const EntityComponentManager &_ecm) const;
124 
129  public: std::optional<math::SphericalCoordinates> SphericalCoordinates(
130  const EntityComponentManager &_ecm) const;
131 
135  public: void SetSphericalCoordinates(EntityComponentManager &_ecm,
136  const math::SphericalCoordinates &_sphericalCoordinates);
137 
143  public: sim::Entity LightByName(const EntityComponentManager &_ecm,
144  const std::string &_name) const;
145 
151  public: sim::Entity ActorByName(const EntityComponentManager &_ecm,
152  const std::string &_name) const;
153 
159  public: sim::Entity ModelByName(const EntityComponentManager &_ecm,
160  const std::string &_name) const;
161 
166  const EntityComponentManager &_ecm) const;
167 
171  public: std::vector<sim::Entity> Actors(
172  const EntityComponentManager &_ecm) const;
173 
177  public: std::vector<sim::Entity> Models(
178  const EntityComponentManager &_ecm) const;
179 
184  public: uint64_t LightCount(const EntityComponentManager &_ecm) const;
185 
190  public: uint64_t ActorCount(const EntityComponentManager &_ecm) const;
191 
196  public: uint64_t ModelCount(const EntityComponentManager &_ecm) const;
197 
199  private: std::unique_ptr<WorldPrivate> dataPtr;
200  };
201  }
202  }
203 }
204 #endif