Gazebo Sim
API Reference
8.7.0
insert_drive_file
Tutorials
library_books
Classes
toc
Namespaces
insert_drive_file
Files
launch
Gazebo Website
Index
List
Hierarchy
Members: All
Members: Functions
Members: Variables
Members: Typedefs
Members: Enumerations
Members: Enumerator
List
Members
Functions
Typedefs
Variables
Enumerations
Enumerator
src
gz-sim
include
gz
sim
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 GZ_SIM_SERVERCONFIG_HH_
18
#define GZ_SIM_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 <sdf/Plugin.hh>
28
#include <sdf/Root.hh>
29
#include <gz/sim/config.hh>
30
#include <gz/sim/Export.hh>
31
32
namespace
gz
33
{
34
namespace
sim
35
{
36
// Inline bracket to help doxygen filtering.
37
inline
namespace
GZ_SIM_VERSION_NAMESPACE {
38
// Forward declarations.
39
class
ServerConfigPrivate;
40
45
class
GZ_SIM_VISIBLE
ServerConfig
46
{
48
public
:
enum class
SourceType
49
{
50
// No source specified.
51
kNone,
52
53
// The source is an SDF Root object.
54
kSdfRoot,
55
56
// The source is an SDF file.
57
kSdfFile,
58
59
// The source is an SDF string.
60
kSdfString,
61
};
62
64
public
:
enum class
SdfErrorBehavior
65
{
67
EXIT_IMMEDIATELY,
69
CONTINUE_LOADING
70
};
71
72
class
PluginInfoPrivate;
79
public
:
class
GZ_SIM_VISIBLE
PluginInfo
80
{
82
public
:
PluginInfo
();
83
85
public
:
~PluginInfo
();
86
95
public
:
PluginInfo
(
const
std::string
&_entityName,
96
const
std::string
&_entityType,
97
const
sdf::Plugin &_plugin);
98
101
public
:
PluginInfo
(
const
PluginInfo
&_info);
102
106
public
:
PluginInfo
&
operator=
(
const
PluginInfo
&_info);
107
112
public
:
const
std::string
&
EntityName
()
const
;
113
118
public
:
void
SetEntityName
(
const
std::string
&_entityName);
119
124
public
:
const
std::string
&
EntityType
()
const
;
125
130
public
:
void
SetEntityType
(
const
std::string
&_entityType);
131
134
public
:
const
sdf::Plugin &
Plugin
()
const
;
135
138
public
: sdf::Plugin &
Plugin
();
139
142
public
:
void
SetPlugin
(
const
sdf::Plugin &_plugin)
const
;
143
145
private
:
std::unique_ptr<ServerConfig::PluginInfoPrivate>
dataPtr;
146
};
147
149
public
:
ServerConfig
();
150
153
public
:
ServerConfig
(
const
ServerConfig
&_config);
154
156
public
:
~ServerConfig
();
157
165
public
:
bool
SetSdfFile
(
const
std::string
&_file);
166
170
public
:
std::string
SdfFile
()
const
;
171
178
public
:
bool
SetSdfString
(
const
std::string
&_sdfString);
179
183
public
:
std::string
SdfString
()
const
;
184
189
public
:
void
SetSdfRoot
(
const
sdf::Root &_root)
const
;
190
194
public
: std::optional<sdf::Root> &
SdfRoot
()
const
;
195
198
public
:
void
SetUpdateRate
(
const
double
&_hz);
199
203
public
: std::optional<double>
UpdateRate
()
const
;
204
208
public
:
void
SetInitialSimTime
(
const
double
&_initialSimTime)
const
;
209
212
public
:
double
InitialSimTime
()
const
;
213
216
public
:
bool
UseLevels
()
const
;
217
220
public
:
void
SetUseLevels
(
const
bool
_levels);
221
226
public
:
bool
UseDistributedSimulation
()
const
;
227
234
public
:
void
SetNetworkSecondaries
(
unsigned
int
_secondaries);
235
240
public
:
unsigned
int
NetworkSecondaries
()
const
;
241
249
public
:
void
SetNetworkRole
(
const
std::string
&_role);
250
256
public
:
std::string
NetworkRole
()
const
;
257
260
public
:
bool
UseLogRecord
()
const
;
261
264
public
:
void
SetUseLogRecord
(
const
bool
_record);
265
268
public
:
const
std::string
LogRecordPath
()
const
;
269
272
public
:
void
SetLogRecordPath
(
const
std::string
&_recordPath);
273
276
public
: std::chrono::steady_clock::duration
LogRecordPeriod
()
const
;
277
280
public
:
void
SetLogRecordPeriod
(
281
const
std::chrono::steady_clock::duration &_period);
282
285
public
:
void
AddLogRecordTopic
(
const
std::string
&_topic);
286
289
public
:
void
ClearLogRecordTopics
();
290
294
public
:
const
std::vector<std::string>
&
LogRecordTopics
()
const
;
295
298
public
:
const
std::string
LogPlaybackPath
()
const
;
299
302
public
:
void
SetLogPlaybackPath
(
const
std::string
&_playbackPath);
303
306
public
:
bool
LogRecordResources
()
const
;
307
310
public
:
void
SetLogRecordResources
(
bool
_recordResources);
311
314
public
:
std::string
LogRecordCompressPath
()
const
;
315
318
public
:
void
SetLogRecordCompressPath
(
const
std::string
&_path);
319
322
public
:
unsigned
int
Seed
()
const
;
323
326
public
:
void
SetSeed
(
unsigned
int
_seed);
327
331
public
: std::optional<std::chrono::steady_clock::duration>
332
UpdatePeriod
()
const
;
333
339
public
:
const
std::string
&
ResourceCache
()
const
;
340
346
public
:
void
SetResourceCache
(
const
std::string
&_path);
347
350
public
:
const
std::string
&
PhysicsEngine
()
const
;
351
354
public
:
void
SetPhysicsEngine
(
const
std::string
&_physicsEngine);
355
358
public
:
const
std::string
&
RenderEngineServer
()
const
;
359
362
public
:
const
std::string
&
RenderEngineGui
()
const
;
363
366
public
:
void
SetHeadlessRendering
(
const
bool
_headless);
367
370
public
:
bool
HeadlessRendering
()
const
;
371
374
public
:
void
SetRenderEngineServer
(
375
const
std::string
&_renderEngineServer);
376
380
public
:
void
SetRenderEngineServerApiBackend
(
381
const
std::string
&_apiBackend);
382
384
const
std::string
&
RenderEngineServerApiBackend
()
const
;
385
388
public
:
void
SetRenderEngineGui
(
const
std::string
&_renderEngineGui);
389
393
public
:
void
SetRenderEngineGuiApiBackend
(
394
const
std::string
&_apiBackend);
395
397
public
:
const
std::string
&
RenderEngineGuiApiBackend
()
const
;
398
402
public
:
void
SetBehaviorOnSdfErrors
(
SdfErrorBehavior
_behavior);
403
407
public
:
SdfErrorBehavior
BehaviorOnSdfErrors
()
const
;
408
412
public
:
void
AddPlugin
(
const
PluginInfo
&_info);
413
416
public
:
void
AddPlugins
(
const
std::list<PluginInfo>
&_plugins);
417
425
public
:
PluginInfo
LogRecordPlugin
()
const
;
426
430
public
:
PluginInfo
LogPlaybackPlugin
()
const
;
431
435
public
:
const
std::list<PluginInfo>
&
Plugins
()
const
;
436
440
public
:
ServerConfig
&
operator=
(
const
ServerConfig
&_cfg);
441
447
public
:
const
std::chrono::time_point<std::chrono::system_clock>
&
448
Timestamp
()
const
;
449
452
public
:
SourceType
Source
()
const
;
453
455
private
:
std::unique_ptr<ServerConfigPrivate>
dataPtr;
456
};
457
461
std::list<ServerConfig::PluginInfo>
462
GZ_SIM_VISIBLE
463
parsePluginsFromFile
(
const
std::string
&_fname);
464
468
std::list<ServerConfig::PluginInfo>
469
GZ_SIM_VISIBLE
470
parsePluginsFromString
(
const
std::string
&_str);
471
488
//
491
//
493
std::list<ServerConfig::PluginInfo>
494
GZ_SIM_VISIBLE
495
loadPluginInfo
(
bool
_isPlayback =
false
);
496
}
497
}
498
}
499
500
#endif