gz/sim/Server.hh
Go to the documentation of this file.
Configuration parameters for a Server. An instance of this object can be used to construct a Server w...
Definition: gz/sim/ServerConfig.hh:46
The server instantiates and controls simulation.
Definition: gz/sim/Server.hh:115
Server(const ServerConfig &_config=ServerConfig())
Construct the server using the parameters specified in a ServerConfig.
bool RequestRemoveEntity(const std::string &_name, bool _recursive=true, const unsigned int _worldIndex=0)
Return true if the specified world has an entity with the provided name and the entity was queued for...
std::optional< bool > Paused(const unsigned int _worldIndex=0) const
Get whether a world simulation instance is paused. When paused is true, then simulation for the world...
bool RunOnce(const bool _paused=true)
Run the server once, all systems will be updated once and then this returns. This is a blocking call.
std::optional< bool > Running(const unsigned int _worldIndex) const
Get whether a world simulation instance is running. When running is true, then systems are being upda...
bool HasEntity(const std::string &_name, const unsigned int _worldIndex=0) const
Return true if the specified world has an entity with the provided name.
std::optional< size_t > SystemCount(const unsigned int _worldIndex=0) const
Get the number of systems on the server.
std::optional< bool > AddSystem(const std::shared_ptr< System > &_system, const unsigned int _worldIndex=0)
Add a System to the server. The server must not be running when calling this.
std::optional< uint64_t > IterationCount(const unsigned int _worldIndex=0) const
Get the number of iterations the server has executed.
std::optional< Entity > EntityByName(const std::string &_name, const unsigned int _worldIndex=0) const
Get an Entity based on a name.
std::optional< size_t > EntityCount(const unsigned int _worldIndex=0) const
Get the number of entities on the server.
bool RequestRemoveEntity(const Entity _entity, bool _recursive=true, const unsigned int _worldIndex=0)
Return true if the specified world has an entity with the provided id and the entity was queued for d...
bool Running() const
Get whether the server is running. The server can have zero or more simulation worlds,...
bool Run(const bool _blocking=false, const uint64_t _iterations=0, const bool _paused=true)
Run the server. By default this is a non-blocking call, which means the server runs simulation in a s...
bool SetPaused(const bool _paused, const unsigned int _worldIndex=0) const
Set whether a world simulation instance is paused. When paused is true, then simulation for the world...
std::optional< bool > AddSystem(const SystemPluginPtr &_system, const unsigned int _worldIndex=0)
Add a System to the server. The server must not be running when calling this.
void SetUpdatePeriod(const std::chrono::steady_clock::duration &_updatePeriod, const unsigned int _worldIndex=0)
Set the update period. The update period is the wall-clock time between ECS updates....
gz::plugin::SpecializedPluginPtr< System, ISystemConfigure, ISystemPreUpdate, ISystemUpdate, ISystemPostUpdate > SystemPluginPtr
Definition: gz/sim/SystemPluginPtr.hh:33
uint64_t Entity
An Entity identifies a single object in simulation such as a model, link, or light....
Definition: gz/sim/Entity.hh:58