Ignition Gazebo

API Reference

2.10.0

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. Currently supports attaching a plugin to an entity given its type and name, but it can't tell apart multiple entities with the same name in different parts of the entity tree. More...
 

Public Member Functions

 ServerConfig ()
 Constructor. More...
 
 ServerConfig (const ServerConfig &_config)
 Copy constructor. More...
 
 ~ServerConfig ()
 Destructor. More...
 
void AddPlugin (const PluginInfo &_info)
 Instruct simulation to attach a plugin to a specific entity when simulation starts. More...
 
const std::string LogPlaybackPath () const
 Get path to recorded states to play back. More...
 
const std::string LogRecordPath () const
 Get path to place recorded states. 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::list< PluginInfo > & Plugins () const
 Get all the plugins that should be loaded. 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 SetLogPlaybackPath (const std::string &_playbackPath)
 Set path to recorded states to play back. More...
 
void SetLogRecordPath (const std::string &_recordPath)
 Set path to place recorded states. 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 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...
 

Public Attributes

void const bool _distributed
 Set whether the server is using the distributed sim system. 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

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

◆ LogPlaybackPath()

const std::string LogPlaybackPath ( ) const

Get path to recorded states to play back.

Returns
Path to recorded states

◆ LogRecordPath()

const std::string LogRecordPath ( ) const

Get path to place recorded states.

Returns
Path to place recorded states

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

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

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

◆ SetLogPlaybackPath()

void SetLogPlaybackPath ( const std::string _playbackPath)

Set path to recorded states to play back.

Parameters
[in]_playbackPathPath to recorded states

◆ SetLogRecordPath()

void SetLogRecordPath ( const std::string _recordPath)

Set path to place recorded states.

Parameters
[in]_recordPathPath to place recorded states

◆ 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

◆ 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]_fileFull 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

Member Data Documentation

◆ _distributed

void const bool _distributed

Set whether the server is using the distributed sim system.

Parameters
[in]_distributeSimulationValue to set.
Deprecated:
SetNetworkRole(const std::string &_role) is used to indicate if distributed simulation is enabled.

The documentation for this class was generated from the following file: