Ignition Gazebo

API Reference

5.1.0
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 IGNITION_GAZEBO_WORLD_HH_
18 #define IGNITION_GAZEBO_WORLD_HH_
19 
20 #include <memory>
21 #include <optional>
22 #include <string>
23 #include <vector>
24 
25 #include <sdf/Atmosphere.hh>
26 #include <ignition/math/Vector3.hh>
27 
28 #include "ignition/gazebo/config.hh"
30 #include "ignition/gazebo/Export.hh"
31 #include "ignition/gazebo/Types.hh"
32 
33 namespace ignition
34 {
35  namespace gazebo
36  {
37  // Inline bracket to help doxygen filtering.
38  inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE {
39  // Forward declarations.
40  class IGNITION_GAZEBO_HIDDEN WorldPrivate;
41  //
60  class IGNITION_GAZEBO_VISIBLE World {
63  public: explicit World(gazebo::Entity _entity = kNullEntity);
64 
67  public: World(const World &_world);
68 
71  public: World(World &&_world) noexcept;
72 
76  public: World &operator=(World &&_world) noexcept;
77 
81  public: World &operator=(const World &_world);
82 
84  public: virtual ~World();
85 
88  public: gazebo::Entity Entity() const;
89 
94  public: bool Valid(const EntityComponentManager &_ecm) const;
95 
100  public: std::optional<std::string> Name(
101  const EntityComponentManager &_ecm) const;
102 
107  public: std::optional<math::Vector3d> Gravity(
108  const EntityComponentManager &_ecm) const;
109 
114  public: std::optional<math::Vector3d> MagneticField(
115  const EntityComponentManager &_ecm) const;
116 
121  public: std::optional<sdf::Atmosphere> Atmosphere(
122  const EntityComponentManager &_ecm) const;
123 
129  public: gazebo::Entity LightByName(const EntityComponentManager &_ecm,
130  const std::string &_name) const;
131 
137  public: gazebo::Entity ActorByName(const EntityComponentManager &_ecm,
138  const std::string &_name) const;
139 
145  public: gazebo::Entity ModelByName(const EntityComponentManager &_ecm,
146  const std::string &_name) const;
147 
152  const EntityComponentManager &_ecm) const;
153 
157  public: std::vector<gazebo::Entity> Actors(
158  const EntityComponentManager &_ecm) const;
159 
163  public: std::vector<gazebo::Entity> Models(
164  const EntityComponentManager &_ecm) const;
165 
170  public: uint64_t LightCount(const EntityComponentManager &_ecm) const;
171 
176  public: uint64_t ActorCount(const EntityComponentManager &_ecm) const;
177 
182  public: uint64_t ModelCount(const EntityComponentManager &_ecm) const;
183 
185  private: std::unique_ptr<WorldPrivate> dataPtr;
186  };
187  }
188  }
189 }
190 #endif
Provides buttons for adding a point, directional, or spot light to the scene.
Definition: Lights.hh:33
Component< sdf::Atmosphere, class AtmosphereTag, serializers::AtmosphereSerializer > Atmosphere
This component holds atmosphere properties of the world.
Definition: Atmosphere.hh:44
Component< math::Vector3d, class GravityTag > Gravity
Store the gravity acceleration.
Definition: Gravity.hh:37
Component< NoData, class WorldTag > World
A component that identifies an entity as being a world.
Definition: components/World.hh:35
STL class.
The EntityComponentManager constructs, deletes, and returns components and entities. A component can be of any class which inherits from components::BaseComponent.
Definition: EntityComponentManager.hh:65
Component< math::Vector3d, class MagneticFieldTag > MagneticField
Stores the 3D magnetic field in teslas.
Definition: MagneticField.hh:37
This class provides wrappers around entities and components which are more convenient and straight-fo...
Definition: World.hh:60
class IGNITION_GAZEBO_HIDDEN WorldPrivate
Definition: World.hh:40
Component< std::string, class NameTag, serializers::StringSerializer > Name
This component holds an entity&#39;s name. The component has no concept of scoped names nor does it care ...
Definition: Name.hh:37
const Entity kNullEntity
Indicates a non-existant or invalid Entity.
Definition: Entity.hh:62
STL class.
This library is part of the Ignition Robotics project.
uint64_t Entity
An Entity identifies a single object in simulation such as a model, link, or light. At its core, an Entity is just an identifier.
Definition: Entity.hh:59