Ignition Gazebo

API Reference

3.5.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 <string>
23 #include <ignition/gazebo/config.hh>
25 #include <ignition/gazebo/Export.hh>
28 
29 namespace ignition
30 {
31  namespace gazebo
32  {
33  // Inline bracket to help doxygen filtering.
34  inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE {
35  // Forware declarations
36  class ServerPrivate;
37 
107  class IGNITION_GAZEBO_VISIBLE Server
108  {
113  public: explicit Server(const ServerConfig &_config = ServerConfig());
114 
116  public: ~Server();
117 
124  public: void SetUpdatePeriod(
125  const std::chrono::steady_clock::duration &_updatePeriod,
126  const unsigned int _worldIndex = 0);
127 
143  public: bool Run(const bool _blocking = false,
144  const uint64_t _iterations = 0,
145  const bool _paused = true);
146 
154  public: bool RunOnce(const bool _paused = true);
155 
161  public: bool Running() const;
162 
171  public: std::optional<bool> Running(const unsigned int _worldIndex) const;
172 
180  public: bool SetPaused(const bool _paused,
181  const unsigned int _worldIndex = 0) const;
182 
189  public: std::optional<bool> Paused(
190  const unsigned int _worldIndex = 0) const;
191 
196  public: std::optional<uint64_t> IterationCount(
197  const unsigned int _worldIndex = 0) const;
198 
202  public: std::optional<size_t> EntityCount(
203  const unsigned int _worldIndex = 0) const;
204 
208  public: std::optional<size_t> SystemCount(
209  const unsigned int _worldIndex = 0) const;
210 
217  public: std::optional<bool> AddSystem(
218  const SystemPluginPtr &_system,
219  const unsigned int _worldIndex = 0);
220 
229  public: std::optional<Entity> EntityByName(const std::string &_name,
230  const unsigned int _worldIndex = 0) const;
231 
238  public: bool HasEntity(const std::string &_name,
239  const unsigned int _worldIndex = 0) const;
240 
254  public: bool RequestRemoveEntity(const std::string &_name,
255  bool _recursive = true,
256  const unsigned int _worldIndex = 0);
257 
269  public: bool RequestRemoveEntity(const Entity _entity,
270  bool _recursive = true,
271  const unsigned int _worldIndex = 0);
272 
274  private: std::unique_ptr<ServerPrivate> dataPtr;
275  };
276  }
277  }
278 }
279 
280 #endif
The server instantiates and controls simulation.
Definition: Server.hh:107
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