Ignition Gazebo

API Reference

7.0.0~pre1
ServerConfig.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_SERVERCONFIG_HH_
18 #define IGNITION_GAZEBO_SERVERCONFIG_HH_
19 
20 #include <chrono>
21 #include <list>
22 #include <memory>
23 #include <optional> // NOLINT(*)
24 #include <string>
25 #include <vector>
26 #include <sdf/Element.hh>
27 #include <ignition/gazebo/config.hh>
28 #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  // Forward declarations.
37  class ServerConfigPrivate;
38 
43  class IGNITION_GAZEBO_VISIBLE ServerConfig
44  {
45  class PluginInfoPrivate;
52  public: class IGNITION_GAZEBO_VISIBLE PluginInfo
53  {
55  public: PluginInfo();
56 
58  public: ~PluginInfo();
59 
71  public: PluginInfo(const std::string &_entityName,
72  const std::string &_entityType,
73  const std::string &_filename,
74  const std::string &_name,
75  const sdf::ElementPtr &_sdf);
76 
79  public: PluginInfo(const PluginInfo &_info);
80 
84  public: PluginInfo &operator=(const PluginInfo &_info);
85 
90  public: const std::string &EntityName() const;
91 
96  public: void SetEntityName(const std::string &_entityName);
97 
102  public: const std::string &EntityType() const;
103 
108  public: void SetEntityType(const std::string &_entityType);
109 
112  public: const std::string &Filename() const;
113 
118  public: void SetFilename(const std::string &_filename);
119 
123  public: const std::string &Name() const;
124 
128  public: void SetName(const std::string &_name);
129 
132  public: const sdf::ElementPtr &Sdf() const;
133 
136  public: void SetSdf(const sdf::ElementPtr &_sdf);
137 
140  };
141 
143  public: ServerConfig();
144 
147  public: ServerConfig(const ServerConfig &_config);
148 
150  public: ~ServerConfig();
151 
158  public: bool SetSdfFile(const std::string &_file);
159 
163  public: std::string SdfFile() const;
164 
171  public: bool SetSdfString(const std::string &_sdfString);
172 
176  public: std::string SdfString() const;
177 
180  public: void SetUpdateRate(const double &_hz);
181 
185  public: std::optional<double> UpdateRate() const;
186 
189  public: bool UseLevels() const;
190 
193  public: void SetUseLevels(const bool _levels);
194 
199  public: bool UseDistributedSimulation() const;
200 
207  public: void SetNetworkSecondaries(unsigned int _secondaries);
208 
213  public: unsigned int NetworkSecondaries() const;
214 
222  public: void SetNetworkRole(const std::string &_role);
223 
229  public: std::string NetworkRole() const;
230 
233  public: bool UseLogRecord() const;
234 
237  public: void SetUseLogRecord(const bool _record);
238 
241  public: const std::string LogRecordPath() const;
242 
245  public: void SetLogRecordPath(const std::string &_recordPath);
246 
249  public: void AddLogRecordTopic(const std::string &_topic);
250 
253  public: void ClearLogRecordTopics();
254 
258  public: const std::vector<std::string> &LogRecordTopics() const;
259 
262  public: const std::string LogPlaybackPath() const;
263 
266  public: void SetLogPlaybackPath(const std::string &_playbackPath);
267 
270  public: bool LogRecordResources() const;
271 
274  public: void SetLogRecordResources(bool _recordResources);
275 
278  public: std::string LogRecordCompressPath() const;
279 
282  public: void SetLogRecordCompressPath(const std::string &_path);
283 
286  public: unsigned int Seed() const;
287 
290  public: void SetSeed(unsigned int _seed);
291 
295  public: std::optional<std::chrono::steady_clock::duration>
296  UpdatePeriod() const;
297 
303  public: const std::string &ResourceCache() const;
304 
310  public: void SetResourceCache(const std::string &_path);
311 
314  public: const std::string &PhysicsEngine() const;
315 
318  public: void SetPhysicsEngine(const std::string &_physicsEngine);
319 
322  public: const std::string &RenderEngineServer() const;
323 
326  public: const std::string &RenderEngineGui() const;
327 
330  public: void SetHeadlessRendering(const bool _headless);
331 
334  public: bool HeadlessRendering() const;
335 
338  public: void SetRenderEngineServer(
339  const std::string &_renderEngineServer);
340 
343  public: void SetRenderEngineGui(const std::string &_renderEngineGui);
344 
348  public: void AddPlugin(const PluginInfo &_info);
349 
352  public: void AddPlugins(const std::list<PluginInfo> &_plugins);
353 
361  public: PluginInfo LogRecordPlugin() const;
362 
366  public: PluginInfo LogPlaybackPlugin() const;
367 
371  public: const std::list<PluginInfo> &Plugins() const;
372 
376  public: ServerConfig &operator=(const ServerConfig &_cfg);
377 
384  Timestamp() const;
385 
387  private: std::unique_ptr<ServerConfigPrivate> dataPtr;
388  };
389 
394  IGNITION_GAZEBO_VISIBLE
395  parsePluginsFromFile(const std::string &_fname);
396 
401  IGNITION_GAZEBO_VISIBLE
402  parsePluginsFromString(const std::string &_str);
403 
420  //
423  //
426  IGNITION_GAZEBO_VISIBLE
427  loadPluginInfo(bool _isPlayback = false);
428  }
429  }
430 }
431 
432 #endif
std::list< ServerConfig::PluginInfo > loadPluginInfo(bool _isPlayback=false)
Load plugin information, following ordering.
Configuration parameters for a Server. An instance of this object can be used to construct a Server w...
Definition: ServerConfig.hh:43
STL class.
std::list< ServerConfig::PluginInfo > parsePluginsFromFile(const std::string &_fname)
Parse plugins from XML configuration file.
std::list< ServerConfig::PluginInfo > parsePluginsFromString(const std::string &_str)
Parse plugins from XML configuration string.
Component< std::string, class NameTag, serializers::StringSerializer > Name
This component holds an entity&#39;s name. The component has no concept of scoped names nor does it care ...
Definition: Name.hh:37
STL class.
STL class.
std::chrono::steady_clock::time_point Timestamp
Information about a plugin that should be loaded by the server.
Definition: ServerConfig.hh:52
This library is part of the Ignition Robotics project.