.. index:: pair: class; NRPJSONCommunicationController .. _doxid-class_n_r_p_j_s_o_n_communication_controller: class NRPJSONCommunicationController ==================================== .. toctree:: :hidden: Overview ~~~~~~~~ Manages communication with the NRP. Uses a REST server to send/receive data. Singleton class. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class NRPJSONCommunicationController: public :ref:`EngineJSONServer` { public: // construction :ref:`NRPJSONCommunicationController`(const NRPJSONCommunicationController& other); :ref:`NRPJSONCommunicationController`(NRPJSONCommunicationController&& other); // methods NRPJSONCommunicationController& :ref:`operator =` (const NRPJSONCommunicationController& other); NRPJSONCommunicationController&& :ref:`operator =` (NRPJSONCommunicationController&& other); void :ref:`registerStepController`(:ref:`GazeboStepController`* stepController); void :ref:`registerSensorPlugin`(gazebo::SensorPlugin* sensorPlugin); void :ref:`registerModelPlugin`(gazebo::ModelPlugin* modelPlugin); static NRPJSONCommunicationController& :ref:`getInstance`(); static NRPJSONCommunicationController& :ref:`resetInstance`( const std::string& serverURL, const std::string& engineName, const std::string& registrationURL ); 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:`EngineJSONServer::mutex_t`> :ref:`lock_t`; // methods :ref:`EngineJSONServer`& :ref:`operator =` (const :ref:`EngineJSONServer`&); bool :ref:`isServerRunning`() const; void :ref:`startServerAsync`(); void :ref:`startServer`(); void :ref:`shutdownServer`(); uint16_t :ref:`serverPort`() const; std::string :ref:`serverAddress`() const; void :ref:`registerDataPack`( const std::string& datapackName, :ref:`JsonDataPackController`* interface ); void :ref:`registerDataPackNoLock`( const std::string& datapackName, :ref:`JsonDataPackController`* interface ); virtual :ref:`SimulationTime` :ref:`runLoopStep`(:ref:`SimulationTime` timeStep) = 0; virtual :ref:`nlohmann::json` :ref:`initialize`( const :ref:`nlohmann::json`& data, :ref:`EngineJSONServer::lock_t`& datapackLock ) = 0; virtual :ref:`nlohmann::json` :ref:`reset`(:ref:`EngineJSONServer::lock_t`& datapackLock) = 0; virtual :ref:`nlohmann::json` :ref:`shutdown`(const :ref:`nlohmann::json`& data) = 0; bool :ref:`shutdownFlag`(); .. _details-class_n_r_p_j_s_o_n_communication_controller: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Manages communication with the NRP. Uses a REST server to send/receive data. Singleton class. Construction ------------ .. index:: pair: function; NRPJSONCommunicationController .. _doxid-class_n_r_p_j_s_o_n_communication_controller_1ad507939391dd8f014958e1d40711e2bf: .. ref-code-block:: cpp :class: doxyrest-title-code-block NRPJSONCommunicationController(const NRPJSONCommunicationController& other) Delete for singleton. .. index:: pair: function; NRPJSONCommunicationController .. _doxid-class_n_r_p_j_s_o_n_communication_controller_1ae07613121608f43f044db225bff2b600: .. ref-code-block:: cpp :class: doxyrest-title-code-block NRPJSONCommunicationController(NRPJSONCommunicationController&& other) Delete for singleton. Methods ------- .. index:: pair: function; operator= .. _doxid-class_n_r_p_j_s_o_n_communication_controller_1aec1875e65b1ffb32e474037d3d6d1145: .. ref-code-block:: cpp :class: doxyrest-title-code-block NRPJSONCommunicationController& operator = (const NRPJSONCommunicationController& other) Delete for singleton. .. index:: pair: function; operator= .. _doxid-class_n_r_p_j_s_o_n_communication_controller_1a5093cbab9eaaba7a1541b94539087afb: .. ref-code-block:: cpp :class: doxyrest-title-code-block NRPJSONCommunicationController&& operator = (NRPJSONCommunicationController&& other) Delete for singleton. .. index:: pair: function; registerStepController .. _doxid-class_n_r_p_j_s_o_n_communication_controller_1a9e2cb1afacda96d45c972fb52e83bda8: .. 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_j_s_o_n_communication_controller_1a89fa4b70af4e1e5bc96f163e99352b3b: .. 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_j_s_o_n_communication_controller_1a937b1d3ec25b418b24dc473885b80ca0: .. 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; getInstance .. _doxid-class_n_r_p_j_s_o_n_communication_controller_1a8d2a189fd615c6faf18bfbdb310647f3: .. ref-code-block:: cpp :class: doxyrest-title-code-block static NRPJSONCommunicationController& getInstance() Get singleton instance. .. rubric:: Returns: Gets instance of :ref:`NRPJSONCommunicationController ` .. index:: pair: function; resetInstance .. _doxid-class_n_r_p_j_s_o_n_communication_controller_1adc1224c551c0bae66f4405ba8fe389f1: .. ref-code-block:: cpp :class: doxyrest-title-code-block static NRPJSONCommunicationController& resetInstance( const std::string& serverURL, const std::string& engineName, const std::string& registrationURL ) Reset server with the given server URL. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - serverURL - URL used by server * - engineName - Name of this engine * - registrationURL - URL used to register this engine server's URL .. rubric:: Returns: Returns reference to server instance .. index:: pair: function; createDataPackName .. _doxid-class_n_r_p_j_s_o_n_communication_controller_1aba1a5b06526fea7c974854d7fccebebf: .. 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 model 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