Ignition Gazebo

API Reference

5.0.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 IGNITION_GAZEBO_SYSTEMS_BREADCRUMBS_HH_
18 #define IGNITION_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 
32 #include <ignition/math/Pose3.hh>
33 
34 #include "ignition/gazebo/Model.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 {
88  : public System,
89  public ISystemConfigure,
90  public ISystemPreUpdate
91  {
93  public: Breadcrumbs() = default;
94 
95  // Documentation inherited
96  public: void Configure(const Entity &_entity,
99  EventManager &_eventMgr) override;
100 
101  // Documentation inherited
102  public: void PreUpdate(
103  const ignition::gazebo::UpdateInfo &_info,
105 
107  private: void OnDeploy(const msgs::Empty &_msg);
108 
113  public: bool MakeStatic(Entity _entity, EntityComponentManager &_ecm);
114 
116  private: bool initialized{false};
117 
119  private: transport::Node node;
120 
122  private: Model model{kNullEntity};
123 
125  private: Entity worldEntity{kNullEntity};
126 
128  public: std::unique_ptr<SdfEntityCreator> creator{nullptr};
129 
131  private: int maxDeployments{-1};
132 
134  private: int numDeployments{0};
135 
137  private: sdf::Root modelRoot;
138 
140  private: bool isPerformer{false};
141 
144  private: bool allowRenaming{false};
145 
147  private: std::optional<sdf::Geometry> performerGeometry;
148 
150  private: std::vector<bool> pendingCmds;
151 
153  private: std::set<Entity> pendingGeometryUpdate;
154 
156  private: std::mutex pendingCmdsMutex;
157 
159  private: std::chrono::steady_clock::duration disablePhysicsTime =
160  std::chrono::steady_clock::duration::zero();
161 
164  autoStaticEntities;
165 
167  private: sdf::Model staticModelToSpawn;
168 
171 
173  public: bool topicStatistics{false};
174 
177  };
178  }
179 }
180 }
181 }
182 
183 #endif
184 
This class provides wrappers around entities and components which are more convenient and straight-fo...
Definition: Model.hh:60
A system for creating Breadcrumbs in the form of models that can get deployed/spawned at the location...
Definition: Breadcrumbs.hh:87
std::string topic
Name of the deploy topic.
Definition: Breadcrumbs.hh:176
Information passed to systems on the update callback.
Definition: Types.hh:36
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
The EventManager is used to send/receive notifications of simulator events.
Definition: EventManager.hh:54
transport::Node::Publisher remainingPub
Publishes remaining deployments.
Definition: Breadcrumbs.hh:170
Interface for a system that implements optional configuration.
Definition: System.hh:88
Component< NoData, class ModelTag > Model
A component that identifies an entity as being a model.
Definition: components/Model.hh:35
const Entity kNullEntity
Indicates a non-existant or invalid Entity.
Definition: Entity.hh:62
STL class.
Entity worldEntity(const Entity &_entity, const EntityComponentManager &_ecm)
Get the world to which the given entity belongs.
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
Interface for a system that uses the PreUpdate phase.
Definition: System.hh:105
Base class for a System.
Definition: System.hh:73