Gazebo Gazebo

API Reference

3.15.1
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/Physics.hh>
30 #include <sdf/Sensor.hh>
31 #include <sdf/Visual.hh>
32 #include <sdf/World.hh>
33 
34 #include <gz/sim/Entity.hh>
36 #include <gz/sim/EventManager.hh>
37 #include <gz/sim/Types.hh>
38 
39 namespace ignition
40 {
41  namespace gazebo
42  {
43  // Inline bracket to help doxygen filtering.
44  inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE {
45  // Forward declarations.
46  class SdfEntityCreatorPrivate;
47  //
57  class IGNITION_GAZEBO_VISIBLE SdfEntityCreator
58  {
64  public: explicit SdfEntityCreator(EntityComponentManager &_ecm,
65  EventManager &_eventManager);
66 
69  public: SdfEntityCreator(const SdfEntityCreator &_creator);
70 
73  public: SdfEntityCreator(SdfEntityCreator &&_creator) noexcept;
74 
78  public: SdfEntityCreator &operator=(SdfEntityCreator &&_creator) noexcept;
79 
83  public: SdfEntityCreator &operator=(const SdfEntityCreator &_creator);
84 
86  public: ~SdfEntityCreator();
87 
92  public: Entity CreateEntities(const sdf::World *_world);
93 
98  public: Entity CreateEntities(const sdf::Model *_model);
99 
104  public: Entity CreateEntities(const sdf::Actor *_actor);
105 
110  public: Entity CreateEntities(const sdf::Light *_light);
111 
116  public: Entity CreateEntities(const sdf::Link *_link);
117 
122  public: Entity CreateEntities(const sdf::Joint *_joint);
123 
128  public: Entity CreateEntities(const sdf::Visual *_visual);
129 
134  public: Entity CreateEntities(const sdf::Collision *_collision);
135 
141  public: Entity CreateEntities(const sdf::Sensor *_sensor);
142 
149  public: void RequestRemoveEntity(const Entity _entity,
150  bool _recursive = true);
151 
156  public: void SetParent(Entity _child, Entity _parent);
157 
167  private: Entity CreateEntities(const sdf::Model *_model,
168  bool _createCanonicalLink, bool _staticParent);
169 
172  };
173  }
174  }
175 }
176 #endif
uint64_t Entity
An Entity identifies a single object in simulation such as a model, link, or light....
Definition: gz/sim/Entity.hh:59
This library is part of the Ignition Robotics project.
The EntityComponentManager constructs, deletes, and returns components and entities....
Definition: gz/sim/EntityComponentManager.hh:65
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:50
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:57
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:48
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:35
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:33
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