Ignition Gazebo

API Reference

6.6.0
Server.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 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_SERVER_HH_
18 #define IGNITION_GAZEBO_SERVER_HH_
19 
20 #include <cstdint>
21 #include <memory>
22 #include <optional>
23 #include <string>
24 #include <ignition/gazebo/config.hh>
26 #include <ignition/gazebo/Export.hh>
29 
30 namespace ignition
31 {
32  namespace gazebo
33  {
34  // Inline bracket to help doxygen filtering.
35  inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE {
36  // Forware declarations
37  class ServerPrivate;
38 
112  class IGNITION_GAZEBO_VISIBLE Server
113  {
118  public: explicit Server(const ServerConfig &_config = ServerConfig());
119 
121  public: ~Server();
122 
129  public: void SetUpdatePeriod(
130  const std::chrono::steady_clock::duration &_updatePeriod,
131  const unsigned int _worldIndex = 0);
132 
148  public: bool Run(const bool _blocking = false,
149  const uint64_t _iterations = 0,
150  const bool _paused = true);
151 
159  public: bool RunOnce(const bool _paused = true);
160 
166  public: bool Running() const;
167 
176  public: std::optional<bool> Running(const unsigned int _worldIndex) const;
177 
185  public: bool SetPaused(const bool _paused,
186  const unsigned int _worldIndex = 0) const;
187 
194  public: std::optional<bool> Paused(
195  const unsigned int _worldIndex = 0) const;
196 
201  public: std::optional<uint64_t> IterationCount(
202  const unsigned int _worldIndex = 0) const;
203 
207  public: std::optional<size_t> EntityCount(
208  const unsigned int _worldIndex = 0) const;
209 
213  public: std::optional<size_t> SystemCount(
214  const unsigned int _worldIndex = 0) const;
215 
222  public: std::optional<bool> AddSystem(
223  const SystemPluginPtr &_system,
224  const unsigned int _worldIndex = 0);
225 
232  public: std::optional<bool> AddSystem(
233  const std::shared_ptr<System> &_system,
234  const unsigned int _worldIndex = 0);
235 
244  public: std::optional<Entity> EntityByName(const std::string &_name,
245  const unsigned int _worldIndex = 0) const;
246 
253  public: bool HasEntity(const std::string &_name,
254  const unsigned int _worldIndex = 0) const;
255 
269  public: bool RequestRemoveEntity(const std::string &_name,
270  bool _recursive = true,
271  const unsigned int _worldIndex = 0);
272 
284  public: bool RequestRemoveEntity(const Entity _entity,
285  bool _recursive = true,
286  const unsigned int _worldIndex = 0);
287 
289  private: std::unique_ptr<ServerPrivate> dataPtr;
290  };
291  }
292  }
293 }
294 
295 #endif
The server instantiates and controls simulation.
Definition: Server.hh:112
Configuration parameters for a Server. An instance of this object can be used to construct a Server w...
Definition: ServerConfig.hh:43
STL class.
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