.. index:: pair: class; NRPGazeboCommunicationController .. _doxid-class_n_r_p_gazebo_communication_controller: class NRPGazeboCommunicationController ====================================== .. toctree:: :hidden: Overview ~~~~~~~~ Manages communication with the NRP. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class NRPGazeboCommunicationController: public :ref:`EngineProtoWrapper` { public: // typedefs typedef std::timed_mutex :target:`mutex_t`; typedef std::unique_lock<:ref:`NRPGazeboCommunicationController::mutex_t`> :target:`lock_t`; // construction :target:`NRPGazeboCommunicationController`( const std::string& engineName, const std::string& protobufPluginsPath, const :ref:`nlohmann::json`& protobufPlugins ); // methods void :ref:`registerDataPackWithLock`( const std::string& datapackName, :ref:`ProtoDataPackController`* interface ); void :ref:`registerStepController`(:ref:`GazeboStepController`* stepController); void :ref:`registerSensorPlugin`(gazebo::SensorPlugin* sensorPlugin); void :ref:`registerModelPlugin`(gazebo::ModelPlugin* modelPlugin); virtual :ref:`SimulationTime` :ref:`runLoopStep`(:ref:`SimulationTime` timeStep); virtual void :ref:`initialize`(const :ref:`nlohmann::json`& data); virtual void :ref:`reset`(); virtual void :ref:`shutdown`(); virtual bool :ref:`initRunFlag`() const; virtual bool :ref:`shutdownFlag`() const; static std::string :ref:`createDataPackName`( const std::string& modelName, const std::string& objectName ); }; Inherited Members ----------------- .. ref-code-block:: cpp :class: doxyrest-overview-inherited-code-block public: // typedefs typedef std::timed_mutex :ref:`mutex_t`; typedef std::unique_lock<:ref:`EngineProtoWrapper::mutex_t`> :ref:`lock_t`; // methods void :ref:`registerDataPack`( const std::string& datapackName, :ref:`ProtoDataPackController`* interface ); unsigned :ref:`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 :ref:`setDataPacks`(const EngineGrpc::SetDataPacksRequest& data); void :ref:`setDataPack`(const EngineGrpc::DataPackMessage& dataPack); std::unique_ptr :ref:`unpackFromAny`(const gpb::Any& data); virtual void :ref:`getDataPacks`( const EngineGrpc::GetDataPacksRequest& request, EngineGrpc::GetDataPacksReply* reply ); bool :ref:`getDataPack`(const std::string& name, EngineGrpc::DataPackMessage* dpMsg); void :ref:`setDataPackMessageData`( gpb::Message* data, EngineGrpc::DataPackMessage* dpMsg ); .. _details-class_n_r_p_gazebo_communication_controller: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Manages communication with the NRP. Implementation of :ref:`EngineProtoWrapper ` to manage a Gazebo Engine Methods ------- .. index:: pair: function; registerDataPackWithLock .. _doxid-class_n_r_p_gazebo_communication_controller_1a5146801ced87a2fa051b8d1324635553: .. ref-code-block:: cpp :class: doxyrest-title-code-block void registerDataPackWithLock( const std::string& datapackName, :ref:`ProtoDataPackController`* interface ) Registers a datapack controller locking the datapack mutex. .. 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; registerStepController .. _doxid-class_n_r_p_gazebo_communication_controller_1a774e03a727d25d02e0ed51b618c6a87e: .. ref-code-block:: cpp :class: doxyrest-title-code-block void registerStepController(:ref:`GazeboStepController`* stepController) Register a step controller. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - stepController - Pointer to step controller .. index:: pair: function; registerSensorPlugin .. _doxid-class_n_r_p_gazebo_communication_controller_1a4c06878dbba81c95b2b027cfeca23305: .. ref-code-block:: cpp :class: doxyrest-title-code-block void registerSensorPlugin(gazebo::SensorPlugin* sensorPlugin) Register a sensor plugin. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - sensorPlugin - Pointer to sensor plugin .. index:: pair: function; registerModelPlugin .. _doxid-class_n_r_p_gazebo_communication_controller_1a2f5ca90e86536680f30b31586397b5a1: .. ref-code-block:: cpp :class: doxyrest-title-code-block void registerModelPlugin(gazebo::ModelPlugin* modelPlugin) Register a model plugin. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - sensorPlugin - Pointer to model plugin .. index:: pair: function; runLoopStep .. _doxid-class_n_r_p_gazebo_communication_controller_1a933e26e8fd394ae1cca40850c691d17d: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual :ref:`SimulationTime` runLoopStep(:ref:`SimulationTime` timeStep) 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 .. index:: pair: function; initialize .. _doxid-class_n_r_p_gazebo_communication_controller_1a429d79ebf22d5c76bb572e1951f7acf9: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual void initialize(const :ref:`nlohmann::json`& data) Initializes the simulation. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - data - Simulation configuration data * - datapackLock - ??? .. index:: pair: function; reset .. _doxid-class_n_r_p_gazebo_communication_controller_1ae3e5f14b3f31a03432212af4c14ba7de: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual void reset() Resets the simulation. .. index:: pair: function; shutdown .. _doxid-class_n_r_p_gazebo_communication_controller_1a1426291fdabcdcac37e7a8f0653a14a5: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual void shutdown() Shutdowns the simulation. .. index:: pair: function; initRunFlag .. _doxid-class_n_r_p_gazebo_communication_controller_1a88a0a5165bdc9f9876ab5c3710249247: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual bool initRunFlag() const Indicates if the simulation was initialized and is running. .. index:: pair: function; shutdownFlag .. _doxid-class_n_r_p_gazebo_communication_controller_1a9907af6c468b5732348db61d1cd2fbf4: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual bool shutdownFlag() const Indicates if shutdown was requested by the client. .. index:: pair: function; createDataPackName .. _doxid-class_n_r_p_gazebo_communication_controller_1a1c525aebb3695b1ed6ebcb14a4b12be0: .. ref-code-block:: cpp :class: doxyrest-title-code-block static std::string createDataPackName( const std::string& modelName, const std::string& objectName ) Create datapack name from the given plugin and sensor/joint/link. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - modelName - Name of the parent model of the controlled object * - objectName - Name of the controlled object (sensor, joint, link, ...) .. rubric:: Returns: Returns datapack name