Gazebo Gazebo

API Reference

3.15.1
ServerConfig Class Reference

Configuration parameters for a Server. An instance of this object can be used to construct a Server with a particular configuration. More...

#include <ignition/gazebo/ServerConfig.hh>

Classes

class  PluginInfo
 Information about a plugin that should be loaded by the server. More...
 

Public Member Functions

 ServerConfig ()
 Constructor. More...
 
 ServerConfig (const ServerConfig &_config)
 Copy constructor. More...
 
 ~ServerConfig ()
 Destructor. More...
 
void AddLogRecordTopic (const std::string &_topic)
 Add a topic to record. More...
 
void AddPlugin (const PluginInfo &_info)
 Instruct simulation to attach a plugin to a specific entity when simulation starts. More...
 
void AddPlugins (const std::list< PluginInfo > &_plugins)
 Add multiple plugins to the simulation. More...
 
void ClearLogRecordTopics ()
 Clear topics to record. This will remove all topics set using AddLogRecordTopic. More...
 
bool LogIgnoreSdfPath () const
 Get whether to ignore the path specified in SDF. More...
 
const std::string LogPlaybackPath () const
 Get path to recorded states to play back. More...
 
PluginInfo LogPlaybackPlugin () const
 Generate PluginInfo for Log playback based on the internal state of this ServerConfig object: More...
 
std::string LogRecordCompressPath () const
 Get file path to compress log files to. More...
 
const std::string LogRecordPath () const
 Get path to place recorded states. More...
 
PluginInfo LogRecordPlugin () const
 Generate PluginInfo for Log recording based on the internal state of this ServerConfig object: More...
 
bool LogRecordResources () const
 Get whether meshes and material files are recorded. More...
 
const std::vector< std::string > & LogRecordTopics () const
 Get the topics to record that were added using AddLogRecordTopic. More...
 
std::string NetworkRole () const
 Get the network role. See SetNetworkRole(const std::string &_role) for more information about distributed simulation and network roles. More...
 
unsigned int NetworkSecondaries () const
 Get the number of secondary servers that a primary server should expect. More...
 
ServerConfigoperator= (const ServerConfig &_cfg)
 Equal operator. More...
 
const std::stringPhysicsEngine () const
 Physics engine plugin library to load. More...
 
const std::list< PluginInfo > & Plugins () const
 Get all the plugins that should be loaded. More...
 
const std::stringRenderEngineGui () const
 Render engine plugin library to load. More...
 
const std::stringRenderEngineServer () const
 Render engine plugin library to load. More...
 
const std::stringResourceCache () const
 Path to where simulation resources, such as models downloaded from fuel.ignitionrobotics.org, should be stored. More...
 
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. More...
 
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. More...
 
unsigned int Seed () const
 The given random seed. More...
 
void SetLogIgnoreSdfPath (bool _ignore)
 Set whether to ignore the path specified in SDF. Path in SDF should be ignored if a record path is specified on the command line, for example. More...
 
void SetLogPlaybackPath (const std::string &_playbackPath)
 Set path to recorded states to play back. More...
 
void SetLogRecordCompressPath (const std::string &_path)
 Set file path to compress log files to. More...
 
void SetLogRecordPath (const std::string &_recordPath)
 Set path to place recorded states. More...
 
void SetLogRecordResources (bool _recordResources)
 Set whether meshes and material files are recorded. More...
 
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). More...
 
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. More...
 
void SetPhysicsEngine (const std::string &_physicsEngine)
 Set the physics engine plugin library. More...
 
void SetRenderEngineGui (const std::string &_renderEngineGui)
 Set the render engine gui plugin library. More...
 
void SetRenderEngineServer (const std::string &_renderEngineServer)
 Set the render engine server plugin library. More...
 
void SetResourceCache (const std::string &_path)
 Set the path to where simulation resources, such as models downloaded from fuel.ignitionrobotics.org, should be stored. More...
 
bool SetSdfFile (const std::string &_file)
 Set an SDF file to be used with the server. More...
 
bool SetSdfString (const std::string &_sdfString)
 Set an SDF string to be used by the server. More...
 
void SetSeed (unsigned int _seed)
 Set the random seed. More...
 
void SetUpdateRate (const double &_hz)
 Set the update rate in Hertz. Value <=0 are ignored. More...
 
void SetUseLevels (const bool _levels)
 Get whether the server is using the level system. More...
 
void SetUseLogRecord (const bool _record)
 Set whether the server is recording states. More...
 
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. More...
 
std::optional< std::chrono::steady_clock::duration > UpdatePeriod () const
 Get the update period duration. More...
 
std::optional< double > UpdateRate () const
 Get the update rate in Hertz. More...
 
bool UseDistributedSimulation () const
 Get whether the server is using the distributed sim system. More...
 
bool UseLevels () const
 Get whether the server is using the level system. More...
 
bool UseLogRecord () const
 Get whether the server is recording states. More...
 

Detailed Description

Configuration parameters for a Server. An instance of this object can be used to construct a Server with a particular configuration.

Constructor & Destructor Documentation

◆ ServerConfig() [1/2]

Constructor.

◆ ServerConfig() [2/2]

ServerConfig ( const ServerConfig _config)

Copy constructor.

Parameters
[in]_configServerConfig to copy.

◆ ~ServerConfig()

Destructor.

Member Function Documentation

◆ AddLogRecordTopic()

void AddLogRecordTopic ( const std::string _topic)

Add a topic to record.

Parameters
[in]_topicTopic 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]_infoInformation about the plugin to load.

◆ AddPlugins()

void AddPlugins ( const std::list< PluginInfo > &  _plugins)

Add multiple plugins to the simulation.

Parameters
[in]_pluginsList of Information about the plugin to load.

◆ ClearLogRecordTopics()

void ClearLogRecordTopics ( )

Clear topics to record. This will remove all topics set using AddLogRecordTopic.

◆ LogIgnoreSdfPath()

bool LogIgnoreSdfPath ( ) const

Get whether to ignore the path specified in SDF.

Returns
Whether to ignore the path specified in SDF TODO(anyone) Deprecate on Dome, SDF path will always be ignored.

◆ 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

◆ LogRecordPlugin()

PluginInfo LogRecordPlugin ( ) const

Generate PluginInfo for Log recording based on the internal state of this ServerConfig object:

See also
UseLogRecord
LogRecordPath
LogRecordResources
LogRecordCompressPath
LogRecordTopics

◆ 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.
See also
SetNetworkRole(const std::string &_role)

◆ NetworkSecondaries()

unsigned int NetworkSecondaries ( ) const

Get the number of secondary servers that a primary server should expect.

Returns
Number of secondary servers.
See also
SetNetworkSecondaries(unsigned int _secondaries)

◆ operator=()

ServerConfig& operator= ( const ServerConfig _cfg)

Equal operator.

Parameters
[in]_cfgServerConfig to copy.
Returns
Reference to this class.

◆ 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.

◆ RenderEngineServer()

const std::string& RenderEngineServer ( ) const

Render engine plugin library to load.

Returns
File containing render engine library.

◆ ResourceCache()

const std::string& ResourceCache ( ) const

Path to where simulation resources, such as models downloaded from fuel.ignitionrobotics.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 ~/.ignition/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.

◆ 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.

◆ SetLogIgnoreSdfPath()

void SetLogIgnoreSdfPath ( bool  _ignore)

Set whether to ignore the path specified in SDF. Path in SDF should be ignored if a record path is specified on the command line, for example.

Parameters
[in]_ignoreWhether to ignore the path specified in SDF TODO(anyone) Deprecate on Dome, SDF path will always be ignored.

◆ SetLogPlaybackPath()

void SetLogPlaybackPath ( const std::string _playbackPath)

Set path to recorded states to play back.

Parameters
[in]_playbackPathPath to recorded states

◆ SetLogRecordCompressPath()

void SetLogRecordCompressPath ( const std::string _path)

Set file path to compress log files to.

Parameters
[in]_pathFile path to compress log files to

◆ SetLogRecordPath()

void SetLogRecordPath ( const std::string _recordPath)

Set path to place recorded states.

Parameters
[in]_recordPathPath to place recorded states

◆ SetLogRecordResources()

void SetLogRecordResources ( bool  _recordResources)

Set whether meshes and material files are recorded.

Parameters
[in]_recordResourcesValue 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]_roleNetwork role, one of [primary, secondary].
Note
Setting a network role enables distributed simulation.
See also
SetNetworkSecondaries(unsigned int _secondaries)

◆ 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]_secondariesNumber of secondary servers.
See also
SetNetworkRole(const std::string &_role)
NetworkRole() const

◆ SetPhysicsEngine()

void SetPhysicsEngine ( const std::string _physicsEngine)

Set the physics engine plugin library.

Parameters
[in]_physicsEngineFile containing physics engine library.

◆ SetRenderEngineGui()

void SetRenderEngineGui ( const std::string _renderEngineGui)

Set the render engine gui plugin library.

Parameters
[in]_renderEngineGuiFile containing render engine library.

◆ SetRenderEngineServer()

void SetRenderEngineServer ( const std::string _renderEngineServer)

Set the render engine server plugin library.

Parameters
[in]_renderEngineServerFile containing render engine library.

◆ SetResourceCache()

void SetResourceCache ( const std::string _path)

Set the path to where simulation resources, such as models downloaded from fuel.ignitionrobotics.org, should be stored.

Parameters
[in]_pathPath to a location on disk. An empty string indicates that the default value will be used, which is currently ~/.ignition/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]_fileFull path to an SDF file.
Returns
(reserved for future 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]_sdfStringFull path to an SDF file.
Returns
(reserved for future use)

◆ SetSeed()

void SetSeed ( unsigned int  _seed)

Set the random seed.

Parameters
[in]_seedThe seed.

◆ SetUpdateRate()

void SetUpdateRate ( const double &  _hz)

Set the update rate in Hertz. Value <=0 are ignored.

Parameters
[in]_hzThe 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]_levelsValue to set.

◆ SetUseLogRecord()

void SetUseLogRecord ( const bool  _record)

Set whether the server is recording states.

Parameters
[in]_recordValue to set

◆ Timestamp()

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
See also
SetNetworkRole(const std::string &_role)

◆ 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: