Gazebo Gazebo

API Reference

3.15.1
gz/sim/rendering/SceneManager.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 
18 #ifndef GZ_GAZEBO_SCENEMANAGER_HH_
19 #define GZ_GAZEBO_SCENEMANAGER_HH_
20 
21 #include <map>
22 #include <memory>
23 #include <string>
24 
25 #include <sdf/Geometry.hh>
26 #include <sdf/Actor.hh>
27 #include <sdf/Light.hh>
28 #include <sdf/Link.hh>
29 #include <sdf/Material.hh>
30 #include <sdf/Model.hh>
31 #include <sdf/Visual.hh>
32 
33 #include <gz/common/KeyFrame.hh>
34 
35 #include <gz/rendering/RenderTypes.hh>
36 
37 #include <gz/sim/config.hh>
38 #include <gz/sim/Entity.hh>
39 #include <gz/sim/rendering/Export.hh>
40 
41 namespace ignition
42 {
43 namespace gazebo
44 {
45 // Inline bracket to help doxygen filtering.
46 inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE {
47  // Forward declaration
48  class SceneManagerPrivate;
49 
51  class IGNITION_GAZEBO_RENDERING_VISIBLE SceneManager
52  {
54  public: SceneManager();
55 
57  public: ~SceneManager();
58 
61  public: void SetScene(rendering::ScenePtr _scene);
62 
65  public: rendering::ScenePtr Scene() const;
66 
69  public: void SetWorldId(Entity _id);
70 
73  public: Entity WorldId() const;
74 
80  public: rendering::VisualPtr CreateModel(Entity _id,
81  const sdf::Model &_model, Entity _parentId = 0);
82 
88  public: rendering::VisualPtr CreateLink(Entity _id,
89  const sdf::Link &_link, Entity _parentId = 0);
90 
96  public: rendering::VisualPtr CreateVisual(Entity _id,
97  const sdf::Visual &_visual, Entity _parentId = 0);
98 
104  public: rendering::VisualPtr CreateCollision(Entity _id,
105  const sdf::Collision &_collision, Entity _parentId = 0);
106 
110  public: rendering::VisualPtr VisualById(Entity _id);
111 
117  public: rendering::VisualPtr CreateActor(Entity _id,
118  const sdf::Actor &_actor, Entity _parentId = 0);
119 
125  public: rendering::LightPtr CreateLight(Entity _id,
126  const sdf::Light &_light, Entity _parentId);
127 
135  public: bool AddSensor(Entity _gazeboId, const std::string &_sensorName,
136  Entity _parentGazeboId = 0);
137 
141  public: bool HasEntity(Entity _id) const;
142 
146  public: rendering::NodePtr NodeById(Entity _id) const;
147 
151  public: rendering::MeshPtr ActorMeshById(Entity _id) const;
152 
157  public: std::map<std::string, math::Matrix4d> ActorMeshAnimationAt(
158  Entity _id, std::chrono::steady_clock::duration _time) const;
159 
162  public: void RemoveEntity(Entity _id);
163 
169  public: Entity EntityFromNode(const rendering::NodePtr &_node) const;
170 
177  private: rendering::GeometryPtr LoadGeometry(const sdf::Geometry &_geom,
178  math::Vector3d &_scale, math::Pose3d &_localPose);
179 
183  private: rendering::MaterialPtr LoadMaterial(
184  const sdf::Material &_material);
185 
192  public: rendering::VisualPtr TopLevelVisual(
193  // NOLINTNEXTLINE
194  rendering::VisualPtr _visual) const;
195 
201  public: rendering::NodePtr TopLevelNode(
202  const rendering::NodePtr &_node) const;
203 
206  private: std::unique_ptr<SceneManagerPrivate> dataPtr;
207  };
208 }
209 }
210 }
211 
212 #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.
STL class.
Component< NoData, class CollisionTag > Collision
A component that identifies an entity as being a collision.
Definition: gz/sim/components/Collision.hh:42
Scene manager class for loading and managing objects in the scene.
Definition: gz/sim/rendering/SceneManager.hh:51
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
Component< sdf::Geometry, class GeometryTag, serializers::GeometrySerializer > Geometry
This component holds an entity's geometry.
Definition: gz/sim/components/Geometry.hh:46
Component< sdf::Scene, class SceneTag, serializers::SceneSerializer > Scene
This component holds scene properties of the world.
Definition: gz/sim/components/Scene.hh:45
STL class.
Component< NoData, class ModelTag > Model
A component that identifies an entity as being a model.
Definition: gz/sim/components/Model.hh:35
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
Component< sdf::Material, class MaterialTag, serializers::MaterialSerializer > Material
This component holds an entity's material.
Definition: gz/sim/components/Material.hh:44