.. index:: pair: class; EngineProtoWrapper .. _doxid-class_engine_proto_wrapper: class EngineProtoWrapper ======================== .. toctree:: :hidden: Overview ~~~~~~~~ Abstract class defining an interface to interact with an Engine with data exchange via protobuf messages. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class EngineProtoWrapper { public: // typedefs typedef std::timed_mutex :target:`mutex_t`; typedef std::unique_lock<:ref:`EngineProtoWrapper::mutex_t`> :target:`lock_t`; // construction :ref:`EngineProtoWrapper`(); :ref:`EngineProtoWrapper`( const std::string& engineName, const std::string& protobufPluginsPath, const :ref:`nlohmann::json`& protobufPlugins ); // methods void :ref:`registerDataPack`( const std::string& datapackName, :ref:`ProtoDataPackController`* interface ); unsigned :target:`getNumRegisteredDataPacks`(); std::vector :ref:`getNamesRegisteredDataPacks`(); const std::string& :ref:`getEngineName`(); virtual bool :ref:`initRunFlag`() const = 0; virtual bool :ref:`shutdownFlag`() const = 0; virtual void :ref:`initialize`(const :ref:`nlohmann::json`& data) = 0; virtual void :ref:`reset`() = 0; virtual void :ref:`shutdown`() = 0; virtual :ref:`SimulationTime` :ref:`runLoopStep`(const :ref:`SimulationTime` timeStep) = 0; void :target:`setDataPacks`(const EngineGrpc::SetDataPacksRequest& data); void :target:`setDataPack`(const EngineGrpc::DataPackMessage& dataPack); std::unique_ptr :target:`unpackFromAny`(const gpb::Any& data); virtual void :target:`getDataPacks`( const EngineGrpc::GetDataPacksRequest& request, EngineGrpc::GetDataPacksReply* reply ); bool :target:`getDataPack`(const std::string& name, EngineGrpc::DataPackMessage* dpMsg); void :target:`setDataPackMessageData`( gpb::Message* data, EngineGrpc::DataPackMessage* dpMsg ); }; // direct descendants class :ref:`NRPGazeboCommunicationController`; .. _details-class_engine_proto_wrapper: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Abstract class defining an interface to interact with an Engine with data exchange via protobuf messages. Derived classes are responsible for implementing simulation initialization, shutdown and run step methods. Construction ------------ .. index:: pair: function; EngineProtoWrapper .. _doxid-class_engine_proto_wrapper_1a8d7c6dd47ed71e6bba79196749880ddd: .. ref-code-block:: cpp :class: doxyrest-title-code-block EngineProtoWrapper() No dummy wrappers, only those with name. .. index:: pair: function; EngineProtoWrapper .. _doxid-class_engine_proto_wrapper_1ab843dfd55d525feeffd131a6b0852dd4: .. ref-code-block:: cpp :class: doxyrest-title-code-block EngineProtoWrapper( const std::string& engineName, const std::string& protobufPluginsPath, const :ref:`nlohmann::json`& protobufPlugins ) Constructor. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - engineName - Name of the simulation engine Methods ------- .. index:: pair: function; registerDataPack .. _doxid-class_engine_proto_wrapper_1a7d671316a41d30a5701693471fd9595c: .. ref-code-block:: cpp :class: doxyrest-title-code-block void registerDataPack( const std::string& datapackName, :ref:`ProtoDataPackController`* interface ) Registers a datapack controller with the given name in the engine. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - datapackName - Name of the datapack to be registered * - datapackController - Pointer to the datapack controller object that's supposed to be registered in the engine .. index:: pair: function; getNamesRegisteredDataPacks .. _doxid-class_engine_proto_wrapper_1a63c4a17bcfb49d88520ead26bfb9dc0b: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::vector getNamesRegisteredDataPacks() Get the names of registered datapacks. .. index:: pair: function; getEngineName .. _doxid-class_engine_proto_wrapper_1a27d1df2f8ad1ba3ee16c3b84d38fa665: .. ref-code-block:: cpp :class: doxyrest-title-code-block const std::string& getEngineName() Get the Engine name. .. index:: pair: function; initRunFlag .. _doxid-class_engine_proto_wrapper_1a6f3beb5e368a842f4a069590d9f97883: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual bool initRunFlag() const = 0 Indicates if the simulation was initialized and is running. .. index:: pair: function; shutdownFlag .. _doxid-class_engine_proto_wrapper_1a300b44054e781d0ed070dcd52779b880: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual bool shutdownFlag() const = 0 Indicates if shutdown was requested by the client. .. index:: pair: function; initialize .. _doxid-class_engine_proto_wrapper_1ac3406c1e14e4551199c6a87548c69bd5: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual void initialize(const :ref:`nlohmann::json`& data) = 0 Initializes the simulation. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - data - Simulation configuration data * - datapackLock - ??? .. index:: pair: function; reset .. _doxid-class_engine_proto_wrapper_1a0556c09a3a8142a5f6317c6bf210dc2c: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual void reset() = 0 Resets the simulation. .. index:: pair: function; shutdown .. _doxid-class_engine_proto_wrapper_1aef9b74102a953358cef4514b4c2d97ee: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual void shutdown() = 0 Shutdowns the simulation. .. index:: pair: function; runLoopStep .. _doxid-class_engine_proto_wrapper_1ad07184924bdfe021967bd51464214648: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual :ref:`SimulationTime` runLoopStep(const :ref:`SimulationTime` timeStep) = 0 Runs a single simulation loop step. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - timeStep - Time step by which the simulation should be advanced .. rubric:: Returns: Engine time after running the step