Gazebo Gazebo

API Reference

6.16.0
Breadcrumbs.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_SYSTEMS_BREADCRUMBS_HH_
18 #define GZ_GAZEBO_SYSTEMS_BREADCRUMBS_HH_
19 
20 #include <memory>
21 #include <optional>
22 #include <set>
23 #include <string>
24 #include <unordered_map>
25 #include <vector>
26 
27 #include <sdf/Element.hh>
28 #include <sdf/Geometry.hh>
29 #include <sdf/Root.hh>
30 
31 #include <gz/transport/Node.hh>
32 #include <gz/math/Pose3.hh>
33 
34 #include "gz/sim/Model.hh"
36 #include "gz/sim/System.hh"
37 
38 namespace ignition
39 {
40 namespace gazebo
41 {
42 // Inline bracket to help doxygen filtering.
43 inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE {
44 namespace systems
45 {
89  : public System,
90  public ISystemConfigure,
91  public ISystemPreUpdate
92  {
94  public: Breadcrumbs() = default;
95 
96  // Documentation inherited
97  public: void Configure(const Entity &_entity,
100  EventManager &_eventMgr) override;
101 
102  // Documentation inherited
103  public: void PreUpdate(
104  const gz::sim::UpdateInfo &_info,
105  gz::sim::EntityComponentManager &_ecm) override;
106 
108  private: void OnDeploy(const msgs::Empty &_msg);
109 
114  public: bool MakeStatic(Entity _entity, EntityComponentManager &_ecm);
115 
117  private: bool initialized{false};
118 
120  private: transport::Node node;
121 
123  private: Model model{kNullEntity};
124 
126  private: Entity worldEntity{kNullEntity};
127 
129  public: std::unique_ptr<SdfEntityCreator> creator{nullptr};
130 
132  private: int maxDeployments{-1};
133 
135  private: int numDeployments{0};
136 
138  private: sdf::Root modelRoot;
139 
141  private: bool isPerformer{false};
142 
145  private: bool allowRenaming{false};
146 
148  private: std::optional<sdf::Geometry> performerGeometry;
149 
151  private: std::vector<bool> pendingCmds;
152 
154  private: std::set<Entity> pendingGeometryUpdate;
155 
157  private: std::mutex pendingCmdsMutex;
158 
160  private: std::chrono::steady_clock::duration disablePhysicsTime =
161  std::chrono::steady_clock::duration::zero();
162 
165  autoStaticEntities;
166 
168  private: sdf::Model staticModelToSpawn;
169 
172 
174  public: bool topicStatistics{false};
175 
178  };
179  }
180 }
181 }
182 }
183 
184 #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.
STL class.
The EntityComponentManager constructs, deletes, and returns components and entities....
Definition: gz/sim/EntityComponentManager.hh:66
STL class.
std::string topic
Name of the deploy topic.
Definition: Breadcrumbs.hh:177
This class provides wrappers around entities and components which are more convenient and straight-fo...
Definition: gz/sim/Model.hh:60
bool MakeStatic(Entity _entity, EntityComponentManager &_ecm)
Make an entity static.
The EventManager is used to send/receive notifications of simulator events.
Definition: gz/sim/EventManager.hh:54
bool topicStatistics
True when topic statistics are enabled.
Definition: Breadcrumbs.hh:174
Information passed to systems on the update callback.
Definition: include/gz/sim/Types.hh:38
const Entity kNullEntity
Indicates a non-existant or invalid Entity.
Definition: gz/sim/Entity.hh:61
A system for creating Breadcrumbs in the form of models that can get deployed/spawned at the location...
Definition: Breadcrumbs.hh:88
Interface for a system that uses the PreUpdate phase.
Definition: gz/sim/System.hh:121
Component< NoData, class ModelTag > Model
A component that identifies an entity as being a model.
Definition: gz/sim/components/Model.hh:111
Interface for a system that implements optional configuration.
Definition: gz/sim/System.hh:90
Entity worldEntity(const Entity &_entity, const EntityComponentManager &_ecm)
Get the world to which the given entity belongs.
Base class for a System.
Definition: gz/sim/System.hh:75
std::unique_ptr< SdfEntityCreator > creator
Creator interface.
Definition: Breadcrumbs.hh:129
transport::Node::Publisher remainingPub
Publishes remaining deployments.
Definition: Breadcrumbs.hh:171
STL class.
STL class.
void PreUpdate(const gz::sim::UpdateInfo &_info, gz::sim::EntityComponentManager &_ecm) override
void Configure(const Entity &_entity, const std::shared_ptr< const sdf::Element > &_sdf, EntityComponentManager &_ecm, EventManager &_eventMgr) override
Configure the system.