.. index:: pair: class; EngineGrpcClient .. _doxid-class_engine_grpc_client: template class EngineGrpcClient =============================== .. toctree:: :hidden: Overview ~~~~~~~~ .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include template class EngineGrpcClient: public :ref:`EngineClient` { public: // construction :target:`EngineGrpcClient`( :ref:`nlohmann::json`& config, :ref:`ProcessLauncherInterface::unique_ptr`&& launcher ); // methods virtual pid_t :ref:`launchEngine`(); void :target:`connectToServer`(); void :target:`sendInitializeCommand`(const :ref:`nlohmann::json`& data); void :target:`sendResetCommand`(); void :target:`sendShutdownCommand`(const :ref:`nlohmann::json`& data); virtual :ref:`SimulationTime` :ref:`runLoopStepCallback`(const :ref:`SimulationTime` timeStep); virtual :ref:`datapacks_vector_t` :ref:`getDataPacksFromEngine`(const :ref:`datapack_identifiers_set_t`& datapackIdentifiers); virtual void :ref:`sendDataPacksToEngine`(const :ref:`datapacks_set_t`& dataPacks); virtual const std::vector :ref:`engineProcStartParams`() const; std::string :target:`tryBind`(const std::string& address); void :ref:`validateServerAddress`(); const std::string :ref:`serverAddress`() const; }; // direct descendants class :ref:`GazeboEngineGrpcNRPClient`; class :ref:`PythonEngineGRPCNRPClient`; Inherited Members ----------------- .. ref-code-block:: cpp :class: doxyrest-overview-inherited-code-block public: // typedefs typedef std::shared_ptr :ref:`shared_ptr`; typedef std::shared_ptr :ref:`const_shared_ptr`; typedef std::unique_ptr :ref:`unique_ptr`; typedef std::unique_ptr :ref:`const_unique_ptr`; typedef ENGINE :ref:`engine_t`; // classes template class :ref:`EngineLauncher`; // methods virtual const std::string :ref:`engineName`() const = 0; virtual const :ref:`nlohmann::json`& :ref:`engineConfig`() const = 0; virtual :ref:`nlohmann::json`& :ref:`engineConfig`() = 0; virtual const std::vector :ref:`engineProcStartParams`() const = 0; virtual pid_t :ref:`launchEngine`(); virtual void :ref:`initialize`() = 0; virtual void :ref:`reset`() = 0; virtual void :ref:`shutdown`() = 0; virtual :ref:`SimulationTime` :ref:`getEngineTimestep`() const = 0; virtual :ref:`SimulationTime` :ref:`getEngineTime`() const = 0; virtual const std::string :ref:`engineSchema`() const = 0; virtual void :ref:`runLoopStepAsync`(:ref:`SimulationTime` timeStep) = 0; virtual void :ref:`runLoopStepAsyncGet`(:ref:`SimulationTime` timeOut) = 0; virtual void :ref:`sendDataPacksToEngine`(const :ref:`datapacks_set_t`& dataPacks) = 0; virtual :ref:`datapacks_vector_t` :ref:`getDataPacksFromEngine`(const :ref:`datapack_identifiers_set_t`& datapackIdentifiers) = 0; virtual const std::string :ref:`engineName`() const; virtual :ref:`SimulationTime` :ref:`getEngineTimestep`() const; virtual const :ref:`nlohmann::json`& :ref:`engineConfig`() const; virtual :ref:`nlohmann::json`& :ref:`engineConfig`(); virtual const std::string :ref:`engineSchema`() const; virtual :ref:`SimulationTime` :ref:`getEngineTime`() const; virtual void :ref:`runLoopStepAsync`(:ref:`SimulationTime` timeStep); virtual void :ref:`runLoopStepAsyncGet`(:ref:`SimulationTime` timeOut); .. _details-class_engine_grpc_client: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Methods ------- .. index:: pair: function; launchEngine .. _doxid-class_engine_grpc_client_1a21caf0fc4f9ece3da42c512164503aaf: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual pid_t launchEngine() Launch the engine. .. rubric:: Returns: Returns engine process ID on success, throws on failure .. index:: pair: function; runLoopStepCallback .. _doxid-class_engine_grpc_client_1a7c80b9e9a256530bfc371421958d9828: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual :ref:`SimulationTime` runLoopStepCallback(const :ref:`SimulationTime` timeStep) Executes a single loop step. This function is going to be called by runLoopStep using std::async. It will be executed by a worker thread, which allows for runLoopStepFunction from multiple engines to run simultaneously. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - timeStep - A time step by which the simulation should be advanced .. rubric:: Returns: Engine time after loop step execution .. index:: pair: function; getDataPacksFromEngine .. _doxid-class_engine_grpc_client_1ad15735550b7a84076281f17dd1efbe2e: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual :ref:`datapacks_vector_t` getDataPacksFromEngine(const :ref:`datapack_identifiers_set_t`& datapackIdentifiers) Gets requested datapacks from engine. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - datapackNames - All requested datapack ids * - Throws - on error .. rubric:: Returns: Returns all requested datapacks .. index:: pair: function; sendDataPacksToEngine .. _doxid-class_engine_grpc_client_1a17904518bc211e9d05d75fea23b6949d: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual void sendDataPacksToEngine(const :ref:`datapacks_set_t`& dataPacks) Sends datapacks to engine. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - datapacksArray - Array of datapacks that will be send to the engine * - Throws - on error .. rubric:: Returns: Returns SUCCESS if all datapacks could be handles, ERROR otherwise .. index:: pair: function; engineProcStartParams .. _doxid-class_engine_grpc_client_1a015ddb2275454f62601b05be4242b6d7: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual const std::vector engineProcStartParams() const Get all Engine Process Startup parameters. .. index:: pair: function; validateServerAddress .. _doxid-class_engine_grpc_client_1aac80dd4fd907a3d9526f81c95895619b: .. ref-code-block:: cpp :class: doxyrest-title-code-block void validateServerAddress() Validates if server address is already in use. .. index:: pair: function; serverAddress .. _doxid-class_engine_grpc_client_1a724376e7b2ec67a0277d6ccf16fc9ef1: .. ref-code-block:: cpp :class: doxyrest-title-code-block const std::string serverAddress() const Returns the address used by the gRPC server.