Gazebo Gazebo

API Reference

6.16.0
gz/sim/SdfEntityCreator.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 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_GAZEBO_CREATEREMOVE_HH_
18 #define GZ_GAZEBO_CREATEREMOVE_HH_
19 
20 #include <memory>
21 
22 #include <sdf/Actor.hh>
23 #include <sdf/Collision.hh>
24 #include <sdf/Gui.hh>
25 #include <sdf/Joint.hh>
26 #include <sdf/Light.hh>
27 #include <sdf/Link.hh>
28 #include <sdf/Model.hh>
29 #include <sdf/ParticleEmitter.hh>
30 #include <sdf/Physics.hh>
31 #include <sdf/Sensor.hh>
32 #include <sdf/Visual.hh>
33 #include <sdf/World.hh>
34 
35 #include <gz/sim/Entity.hh>
37 #include <gz/sim/EventManager.hh>
38 #include <gz/sim/Types.hh>
39 
40 namespace ignition
41 {
42  namespace gazebo
43  {
44  // Inline bracket to help doxygen filtering.
45  inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE {
46  // Forward declarations.
47  class SdfEntityCreatorPrivate;
48  //
58  class IGNITION_GAZEBO_VISIBLE SdfEntityCreator
59  {
65  public: explicit SdfEntityCreator(EntityComponentManager &_ecm,
66  EventManager &_eventManager);
67 
70  public: SdfEntityCreator(const SdfEntityCreator &_creator);
71 
74  public: SdfEntityCreator(SdfEntityCreator &&_creator) noexcept;
75 
79  public: SdfEntityCreator &operator=(SdfEntityCreator &&_creator) noexcept;
80 
84  public: SdfEntityCreator &operator=(const SdfEntityCreator &_creator);
85 
87  public: ~SdfEntityCreator();
88 
93  public: Entity CreateEntities(const sdf::World *_world);
94 
99  public: Entity CreateEntities(const sdf::Model *_model);
100 
105  public: Entity CreateEntities(const sdf::Actor *_actor);
106 
111  public: Entity CreateEntities(const sdf::Light *_light);
112 
117  public: Entity CreateEntities(const sdf::Link *_link);
118 
123  public: Entity CreateEntities(const sdf::Joint *_joint);
124 
130  public: Entity CreateEntities(const sdf::Joint *_joint, bool _resolved);
131 
136  public: Entity CreateEntities(const sdf::Visual *_visual);
137 
142  public: Entity CreateEntities(const sdf::Collision *_collision);
143 
149  public: Entity CreateEntities(const sdf::Sensor *_sensor);
150 
156  public: Entity CreateEntities(const sdf::ParticleEmitter *_emitter);
157 
164  public: void RequestRemoveEntity(const Entity _entity,
165  bool _recursive = true);
166 
171  public: void SetParent(Entity _child, Entity _parent);
172 
179  private: Entity CreateEntities(const sdf::Model *_model,
180  bool _staticParent);
181 
184  };
185  }
186  }
187 }
188 #endif
uint64_t Entity
An Entity identifies a single object in simulation such as a model, link, or light....
Definition: gz/sim/Entity.hh:58
This library is part of the Gazebo project.
The EntityComponentManager constructs, deletes, and returns components and entities....
Definition: gz/sim/EntityComponentManager.hh:66
Component< NoData, class WorldTag > World
A component that identifies an entity as being a world.
Definition: gz/sim/components/World.hh:35
Component< NoData, class JointTag > Joint
A component that identifies an entity as being a joint.
Definition: gz/sim/components/Joint.hh:33
The EventManager is used to send/receive notifications of simulator events.
Definition: gz/sim/EventManager.hh:54
Component< NoData, class CollisionTag > Collision
A component that identifies an entity as being a collision.
Definition: gz/sim/components/Collision.hh:42
SdfEntityCreator(EntityComponentManager &_ecm, EventManager &_eventManager)
Constructor.
Provides convenient functions to spawn entities and load their plugins from SDF elements,...
Definition: gz/sim/SdfEntityCreator.hh:58
Component< sdf::Light, class LightTag, serializers::LightSerializer > Light
This component contains light source information. For more information on lights, see SDF's Light ele...
Definition: gz/sim/components/Light.hh:48
Component< sdf::Actor, class ActorTag, serializers::ActorSerializer > Actor
This component contains actor source information. For more information on actors, see SDF's Actor ele...
Definition: gz/sim/components/Actor.hh:80
SdfEntityCreator & operator=(SdfEntityCreator &&_creator) noexcept
Move assignment operator.
Component< NoData, class ModelTag > Model
A component that identifies an entity as being a model.
Definition: gz/sim/components/Model.hh:111
void RequestRemoveEntity(const Entity _entity, bool _recursive=true)
Request an entity deletion. This will insert the request into a queue. The queue is processed toward ...
Entity CreateEntities(const sdf::World *_world)
Create all entities that exist in the sdf::World object and load their plugins.
Component< NoData, class LinkTag > Link
A component that identifies an entity as being a link.
Definition: gz/sim/components/Link.hh:33
Component< NoData, class VisualTag > Visual
A component that identifies an entity as being a visual.
Definition: gz/sim/components/Visual.hh:80
void SetParent(Entity _child, Entity _parent)
Set an entity's parent entity. This function takes care of updating the EntityComponentManager and ne...
Component< NoData, class SensorTag > Sensor
A component that identifies an entity as being a sensor.
Definition: gz/sim/components/Sensor.hh:35
Component< msgs::ParticleEmitter, class ParticleEmitterTag, serializers::MsgSerializer > ParticleEmitter
A component that contains a particle emitter.
Definition: include/gz/sim/components/ParticleEmitter.hh:37