Configuration parameters for a Server. An instance of this object can be used to construct a Server with a particular configuration. More...
#include <gz/sim/ServerConfig.hh>
Classes | |
class | PluginInfo |
Information about a plugin that should be loaded by the server. More... | |
Public Types | |
enum class | SdfErrorBehavior { EXIT_IMMEDIATELY , CONTINUE_LOADING } |
SDF error behavior. More... | |
enum class | SourceType { kNone , kSdfRoot , kSdfFile , kSdfString } |
Type of SDF source. More... | |
Public Member Functions | |
ServerConfig () | |
Constructor. | |
ServerConfig (const ServerConfig &_config) | |
Copy constructor. | |
~ServerConfig () | |
Destructor. | |
void | AddLogRecordTopic (const std::string &_topic) |
Add a topic to record. | |
void | AddPlugin (const PluginInfo &_info) |
Instruct simulation to attach a plugin to a specific entity when simulation starts. | |
void | AddPlugins (const std::list< PluginInfo > &_plugins) |
Add multiple plugins to the simulation. | |
SdfErrorBehavior | BehaviorOnSdfErrors () const |
Get the behavior when SDF errors are encountered while. | |
void | ClearLogRecordTopics () |
Clear topics to record. This will remove all topics set using AddLogRecordTopic. | |
bool | HeadlessRendering () const |
Get the headless mode. | |
double | InitialSimTime () const |
Get the initial simulation time in seconds. | |
const std::string | LogPlaybackPath () const |
Get path to recorded states to play back. | |
PluginInfo | LogPlaybackPlugin () const |
Generate PluginInfo for Log playback based on the internal state of this ServerConfig object: | |
std::string | LogRecordCompressPath () const |
Get file path to compress log files to. | |
const std::string | LogRecordPath () const |
Get path to place recorded states. | |
std::chrono::steady_clock::duration | LogRecordPeriod () const |
Get time period to record states. | |
PluginInfo | LogRecordPlugin () const |
Generate PluginInfo for Log recording based on the internal state of this ServerConfig object: | |
bool | LogRecordResources () const |
Get whether meshes and material files are recorded. | |
const std::vector< std::string > & | LogRecordTopics () const |
Get the topics to record that were added using AddLogRecordTopic. | |
std::string | NetworkRole () const |
Get the network role. See SetNetworkRole(const std::string &_role) for more information about distributed simulation and network roles. | |
unsigned int | NetworkSecondaries () const |
Get the number of secondary servers that a primary server should expect. | |
ServerConfig & | operator= (const ServerConfig &_cfg) |
Equal operator. | |
const std::string & | PhysicsEngine () const |
Physics engine plugin library to load. | |
const std::list< PluginInfo > & | Plugins () const |
Get all the plugins that should be loaded. | |
const std::string & | RenderEngineGui () const |
Render engine plugin library to load. | |
const std::string & | RenderEngineGuiApiBackend () const |
const std::string & | RenderEngineServer () const |
Render engine plugin library to load. | |
const std::string & | RenderEngineServerApiBackend () const |
const std::string & | ResourceCache () const |
Path to where simulation resources, such as models downloaded from fuel.gazebosim.org, should be stored. | |
std::string | SdfFile () const |
Get the SDF file that has been set. An empty string will be returned if an SDF file has not been set. | |
std::optional< sdf::Root > & | SdfRoot () const |
Get the SDF Root DOM object. | |
std::string | SdfString () const |
Get the SDF String that has been set. An empty string will be returned if an SDF string has not been set. | |
unsigned int | Seed () const |
The given random seed. | |
void | SetBehaviorOnSdfErrors (SdfErrorBehavior _behavior) |
Set the server behavior when SDF errors are encountered while. | |
void | SetHeadlessRendering (const bool _headless) |
Set the headless mode. | |
void | SetInitialSimTime (const double &_initialSimTime) const |
Set the initial simulation time in seconds. | |
void | SetLogPlaybackPath (const std::string &_playbackPath) |
Set path to recorded states to play back. | |
void | SetLogRecordCompressPath (const std::string &_path) |
Set file path to compress log files to. | |
void | SetLogRecordPath (const std::string &_recordPath) |
Set path to place recorded states. | |
void | SetLogRecordPeriod (const std::chrono::steady_clock::duration &_period) |
Set time period to record states. | |
void | SetLogRecordResources (bool _recordResources) |
Set whether meshes and material files are recorded. | |
void | SetNetworkRole (const std::string &_role) |
Set the network role, which is one of [primary, secondary]. If primary is used, then make sure to also set the numer of network secondaries via SetNetworkSecondaries(unsigned int _secondaries). | |
void | SetNetworkSecondaries (unsigned int _secondaries) |
Set the number of network secondary servers that the primary server should expect. This value is valid only when SetNetworkRole("primary") is also used. | |
void | SetPhysicsEngine (const std::string &_physicsEngine) |
Set the physics engine plugin library. | |
void | SetRenderEngineGui (const std::string &_renderEngineGui) |
Set the render engine gui plugin library. | |
void | SetRenderEngineGuiApiBackend (const std::string &_apiBackend) |
Set the render engine gui API backend. | |
void | SetRenderEngineServer (const std::string &_renderEngineServer) |
Set the render engine server plugin library. | |
void | SetRenderEngineServerApiBackend (const std::string &_apiBackend) |
Set the render engine server API backend. | |
void | SetResourceCache (const std::string &_path) |
Set the path to where simulation resources, such as models downloaded from fuel.gazebosim.org, should be stored. | |
bool | SetSdfFile (const std::string &_file) |
Set an SDF file to be used with the server. | |
void | SetSdfRoot (const sdf::Root &_root) const |
Set the SDF Root DOM object. The sdf::Root object will take precendence over ServerConfig::SdfString() and ServerConfig::SdfFile(). | |
bool | SetSdfString (const std::string &_sdfString) |
Set an SDF string to be used by the server. | |
void | SetSeed (unsigned int _seed) |
Set the random seed. | |
void | SetUpdateRate (const double &_hz) |
Set the update rate in Hertz. Value <=0 are ignored. | |
void | SetUseLevels (const bool _levels) |
Get whether the server is using the level system. | |
void | SetUseLogRecord (const bool _record) |
Set whether the server is recording states. | |
SourceType | Source () const |
Get the type of source. | |
const std::chrono::time_point< std::chrono::system_clock > & | Timestamp () const |
Get the timestamp of this ServerConfig. This is the system time when this ServerConfig was created. The timestamp is used internally to create log file paths so that both state and console logs are co-located. | |
std::optional< std::chrono::steady_clock::duration > | UpdatePeriod () const |
Get the update period duration. | |
std::optional< double > | UpdateRate () const |
Get the update rate in Hertz. | |
bool | UseDistributedSimulation () const |
Get whether the server is using the distributed sim system. | |
bool | UseLevels () const |
Get whether the server is using the level system. | |
bool | UseLogRecord () const |
Get whether the server is recording states. | |
Detailed Description
Configuration parameters for a Server. An instance of this object can be used to construct a Server with a particular configuration.
Member Enumeration Documentation
◆ SdfErrorBehavior
|
strong |
◆ SourceType
|
strong |
Constructor & Destructor Documentation
◆ ServerConfig() [1/2]
ServerConfig | ( | ) |
Constructor.
◆ ServerConfig() [2/2]
ServerConfig | ( | const ServerConfig & | _config | ) |
Copy constructor.
- Parameters
-
[in] _config ServerConfig to copy.
◆ ~ServerConfig()
~ServerConfig | ( | ) |
Destructor.
Member Function Documentation
◆ AddLogRecordTopic()
void AddLogRecordTopic | ( | const std::string & | _topic | ) |
Add a topic to record.
- Parameters
-
[in] _topic Topic name, which can include wildcards.
◆ AddPlugin()
void AddPlugin | ( | const PluginInfo & | _info | ) |
Instruct simulation to attach a plugin to a specific entity when simulation starts.
- Parameters
-
[in] _info Information about the plugin to load.
◆ AddPlugins()
void AddPlugins | ( | const std::list< PluginInfo > & | _plugins | ) |
Add multiple plugins to the simulation.
- Parameters
-
[in] _plugins List of Information about the plugin to load.
◆ BehaviorOnSdfErrors()
SdfErrorBehavior BehaviorOnSdfErrors | ( | ) | const |
Get the behavior when SDF errors are encountered while.
loading the server.
- Returns
- Server behavior when SDF errors are encounted.
◆ ClearLogRecordTopics()
void ClearLogRecordTopics | ( | ) |
Clear topics to record. This will remove all topics set using AddLogRecordTopic.
◆ HeadlessRendering()
bool HeadlessRendering | ( | ) | const |
Get the headless mode.
- Returns
- True if headless mode is enable, false otherwise.
◆ InitialSimTime()
double InitialSimTime | ( | ) | const |
Get the initial simulation time in seconds.
- Returns
- The initial simulation time in seconds.
◆ LogPlaybackPath()
const std::string LogPlaybackPath | ( | ) | const |
Get path to recorded states to play back.
- Returns
- Path to recorded states
◆ LogPlaybackPlugin()
PluginInfo LogPlaybackPlugin | ( | ) | const |
Generate PluginInfo for Log playback based on the internal state of this ServerConfig object:
- See also
- LogPlaybackPath
◆ LogRecordCompressPath()
std::string LogRecordCompressPath | ( | ) | const |
Get file path to compress log files to.
- Returns
- File path to compress log files to
◆ LogRecordPath()
const std::string LogRecordPath | ( | ) | const |
Get path to place recorded states.
- Returns
- Path to place recorded states
◆ LogRecordPeriod()
std::chrono::steady_clock::duration LogRecordPeriod | ( | ) | const |
Get time period to record states.
- Returns
- Time period to record states
◆ LogRecordPlugin()
PluginInfo LogRecordPlugin | ( | ) | const |
Generate PluginInfo for Log recording based on the internal state of this ServerConfig object:
◆ LogRecordResources()
bool LogRecordResources | ( | ) | const |
Get whether meshes and material files are recorded.
- Returns
- True if resources should be recorded.
◆ LogRecordTopics()
const std::vector< std::string > & LogRecordTopics | ( | ) | const |
Get the topics to record that were added using AddLogRecordTopic.
- Returns
- The topics to record.
◆ NetworkRole()
std::string NetworkRole | ( | ) | const |
Get the network role. See SetNetworkRole(const std::string &_role) for more information about distributed simulation and network roles.
- Returns
- The network role.
◆ NetworkSecondaries()
unsigned int NetworkSecondaries | ( | ) | const |
Get the number of secondary servers that a primary server should expect.
- Returns
- Number of secondary servers.
◆ operator=()
ServerConfig & operator= | ( | const ServerConfig & | _cfg | ) |
◆ PhysicsEngine()
const std::string & PhysicsEngine | ( | ) | const |
Physics engine plugin library to load.
- Returns
- File containing physics engine library.
◆ Plugins()
const std::list< PluginInfo > & Plugins | ( | ) | const |
Get all the plugins that should be loaded.
- Returns
- A list of all the plugins specified via AddPlugin(const PluginInfo &).
◆ RenderEngineGui()
const std::string & RenderEngineGui | ( | ) | const |
Render engine plugin library to load.
- Returns
- File containing render engine library.
◆ RenderEngineGuiApiBackend()
const std::string & RenderEngineGuiApiBackend | ( | ) | const |
- Returns
- Api backend for gui. See SetRenderEngineGuiApiBackend()
◆ RenderEngineServer()
const std::string & RenderEngineServer | ( | ) | const |
Render engine plugin library to load.
- Returns
- File containing render engine library.
◆ RenderEngineServerApiBackend()
const std::string & RenderEngineServerApiBackend | ( | ) | const |
- Returns
- Api backend for server. See SetRenderEngineServerApiBackend()
◆ ResourceCache()
const std::string & ResourceCache | ( | ) | const |
Path to where simulation resources, such as models downloaded from fuel.gazebosim.org, should be stored.
- Returns
- Path to a location on disk. An empty string indicates that the default value will be used, which is currently ~/.gz/fuel.
◆ SdfFile()
std::string SdfFile | ( | ) | const |
Get the SDF file that has been set. An empty string will be returned if an SDF file has not been set.
- Returns
- The full path to the SDF file, or empty string.
◆ SdfRoot()
std::optional< sdf::Root > & SdfRoot | ( | ) | const |
Get the SDF Root DOM object.
- Returns
- SDF Root object to use, or std::nullopt if the sdf::Root has not been set via ServerConfig::SetSdfRoot().
◆ SdfString()
std::string SdfString | ( | ) | const |
Get the SDF String that has been set. An empty string will be returned if an SDF string has not been set.
- Returns
- The full contents of the SDF string, or empty string.
◆ Seed()
unsigned int Seed | ( | ) | const |
The given random seed.
- Returns
- The random seed or 0 if not specified.
◆ SetBehaviorOnSdfErrors()
void SetBehaviorOnSdfErrors | ( | SdfErrorBehavior | _behavior | ) |
Set the server behavior when SDF errors are encountered while.
loading the server.
- Parameters
-
[in] _behavior Server behavior when SDF errors are encounted.
◆ SetHeadlessRendering()
void SetHeadlessRendering | ( | const bool | _headless | ) |
Set the headless mode.
- Parameters
-
[in] _headless Set to true to enable headless mode.
◆ SetInitialSimTime()
void SetInitialSimTime | ( | const double & | _initialSimTime | ) | const |
Set the initial simulation time in seconds.
- Parameters
-
[in] _initialSimTime The desired initial simulation time in seconds.
◆ SetLogPlaybackPath()
void SetLogPlaybackPath | ( | const std::string & | _playbackPath | ) |
Set path to recorded states to play back.
- Parameters
-
[in] _playbackPath Path to recorded states
◆ SetLogRecordCompressPath()
void SetLogRecordCompressPath | ( | const std::string & | _path | ) |
Set file path to compress log files to.
- Parameters
-
[in] _path File path to compress log files to
◆ SetLogRecordPath()
void SetLogRecordPath | ( | const std::string & | _recordPath | ) |
Set path to place recorded states.
- Parameters
-
[in] _recordPath Path to place recorded states
◆ SetLogRecordPeriod()
void SetLogRecordPeriod | ( | const std::chrono::steady_clock::duration & | _period | ) |
Set time period to record states.
- Parameters
-
[in] _period Time period to record states
◆ SetLogRecordResources()
void SetLogRecordResources | ( | bool | _recordResources | ) |
Set whether meshes and material files are recorded.
- Parameters
-
[in] _recordResources Value to set
◆ SetNetworkRole()
void SetNetworkRole | ( | const std::string & | _role | ) |
Set the network role, which is one of [primary, secondary]. If primary is used, then make sure to also set the numer of network secondaries via SetNetworkSecondaries(unsigned int _secondaries).
- Parameters
-
[in] _role Network role, one of [primary, secondary].
- Note
- Setting a network role enables distributed simulation.
◆ SetNetworkSecondaries()
void SetNetworkSecondaries | ( | unsigned int | _secondaries | ) |
Set the number of network secondary servers that the primary server should expect. This value is valid only when SetNetworkRole("primary") is also used.
- Parameters
-
[in] _secondaries Number of secondary servers.
◆ SetPhysicsEngine()
void SetPhysicsEngine | ( | const std::string & | _physicsEngine | ) |
Set the physics engine plugin library.
- Parameters
-
[in] _physicsEngine File containing physics engine library.
◆ SetRenderEngineGui()
void SetRenderEngineGui | ( | const std::string & | _renderEngineGui | ) |
Set the render engine gui plugin library.
- Parameters
-
[in] _renderEngineGui File containing render engine library.
◆ SetRenderEngineGuiApiBackend()
void SetRenderEngineGuiApiBackend | ( | const std::string & | _apiBackend | ) |
Set the render engine gui API backend.
- Parameters
-
[in] _apiBackend See –render-engine-gui-api-backend for possible options
◆ SetRenderEngineServer()
void SetRenderEngineServer | ( | const std::string & | _renderEngineServer | ) |
Set the render engine server plugin library.
- Parameters
-
[in] _renderEngineServer File containing render engine library.
◆ SetRenderEngineServerApiBackend()
void SetRenderEngineServerApiBackend | ( | const std::string & | _apiBackend | ) |
Set the render engine server API backend.
- Parameters
-
[in] _apiBackend See –render-engine-server-api-backend for possible options
◆ SetResourceCache()
void SetResourceCache | ( | const std::string & | _path | ) |
Set the path to where simulation resources, such as models downloaded from fuel.gazebosim.org, should be stored.
- Parameters
-
[in] _path Path to a location on disk. An empty string indicates that the default value will be used, which is currently ~/.gz/fuel.
◆ SetSdfFile()
bool SetSdfFile | ( | const std::string & | _file | ) |
Set an SDF file to be used with the server.
Setting the SDF file will override any value set by SetSdfString
.
- Parameters
-
[in] _file Full path to an SDF file.
- Returns
- True if the file was set, false if the file was not set. The file will not be set if the provide _file string is empty.
◆ SetSdfRoot()
void SetSdfRoot | ( | const sdf::Root & | _root | ) | const |
Set the SDF Root DOM object. The sdf::Root object will take precendence over ServerConfig::SdfString() and ServerConfig::SdfFile().
- Parameters
-
[in] _root SDF Root object to use.
◆ SetSdfString()
bool SetSdfString | ( | const std::string & | _sdfString | ) |
Set an SDF string to be used by the server.
Setting the SDF string will override any value set by SetSdfFile
.
- Parameters
-
[in] _sdfString Full path to an SDF file.
- Returns
- (reserved for future use)
◆ SetSeed()
void SetSeed | ( | unsigned int | _seed | ) |
Set the random seed.
- Parameters
-
[in] _seed The seed.
◆ SetUpdateRate()
void SetUpdateRate | ( | const double & | _hz | ) |
Set the update rate in Hertz. Value <=0 are ignored.
- Parameters
-
[in] _hz The desired update rate of the server in Hertz.
◆ SetUseLevels()
void SetUseLevels | ( | const bool | _levels | ) |
Get whether the server is using the level system.
- Parameters
-
[in] _levels Value to set.
◆ SetUseLogRecord()
void SetUseLogRecord | ( | const bool | _record | ) |
Set whether the server is recording states.
- Parameters
-
[in] _record Value to set
◆ Source()
SourceType Source | ( | ) | const |
Get the type of source.
- Returns
- The source type.
◆ Timestamp()
const std::chrono::time_point< std::chrono::system_clock > & Timestamp | ( | ) | const |
Get the timestamp of this ServerConfig. This is the system time when this ServerConfig was created. The timestamp is used internally to create log file paths so that both state and console logs are co-located.
- Returns
- Time when this ServerConfig was created.
◆ UpdatePeriod()
std::optional< std::chrono::steady_clock::duration > UpdatePeriod | ( | ) | const |
Get the update period duration.
- Returns
- The desired update period, or nullopt if an UpdateRate has not been set.
◆ UpdateRate()
std::optional< double > UpdateRate | ( | ) | const |
Get the update rate in Hertz.
- Returns
- The desired update rate of the server in Hertz, or nullopt if an UpdateRate has not been set.
◆ UseDistributedSimulation()
bool UseDistributedSimulation | ( | ) | const |
Get whether the server is using the distributed sim system.
- Returns
- True if the server is set to use the distributed simulation system
◆ UseLevels()
bool UseLevels | ( | ) | const |
Get whether the server is using the level system.
- Returns
- True if the server is set to use the level system
◆ UseLogRecord()
bool UseLogRecord | ( | ) | const |
Get whether the server is recording states.
- Returns
- True if the server is set to record states
The documentation for this class was generated from the following file: