Manages communication with the NRP. Uses a REST server to send/receive data. Singleton class. More...
#include <nrp_communication_controller.h>
Public Member Functions | |
~NRPJSONCommunicationController () override | |
NRPJSONCommunicationController (const NRPJSONCommunicationController &other)=delete | |
Delete for singleton. More... | |
NRPJSONCommunicationController & | operator= (const NRPJSONCommunicationController &other)=delete |
Delete for singleton. More... | |
NRPJSONCommunicationController (NRPJSONCommunicationController &&other)=delete | |
Delete for singleton. More... | |
NRPJSONCommunicationController && | operator= (NRPJSONCommunicationController &&other)=delete |
Delete for singleton. More... | |
void | registerStepController (GazeboStepController *stepController) |
Register a step controller. More... | |
void | registerSensorPlugin (gazebo::SensorPlugin *sensorPlugin) |
Register a sensor plugin. More... | |
void | registerModelPlugin (gazebo::ModelPlugin *modelPlugin) |
Register a model plugin. More... | |
![]() | |
EngineJSONServer (const std::string &engineAddress, const std::string &engineName, const std::string &clientAddress) | |
Constructor. Tries to bind to a port and register itself with clientAddress. More... | |
EngineJSONServer ()=delete | |
No dummy servers without name and address. More... | |
virtual | ~EngineJSONServer () |
EngineJSONServer (const EngineJSONServer &)=delete | |
EngineJSONServer & | operator= (const EngineJSONServer &)=delete |
bool | isServerRunning () const |
Is the server running? More... | |
void | startServerAsync () |
Start the server in asynchronous mode. More... | |
void | startServer () |
Start the server synchronously. More... | |
void | shutdownServer () |
Stop running server. More... | |
uint16_t | serverPort () const |
Get running server port. More... | |
std::string | serverAddress () const |
Get server address. More... | |
void | registerDataPack (const std::string &datapackName, JsonDataPackController *interface) |
Registers a datapack. More... | |
void | registerDataPackNoLock (const std::string &datapackName, JsonDataPackController *interface) |
Registers a datapack. Skips locking the mutex. Should only be used if thread-safe access to _datapacksControllers can be guaranteed. More... | |
bool | shutdownFlag () |
Has a shutdown command been received? More... | |
Static Public Member Functions | |
static NRPJSONCommunicationController & | getInstance () |
Get singleton instance. More... | |
static NRPJSONCommunicationController & | resetInstance (const std::string &serverURL, const std::string &engineName, const std::string ®istrationURL) |
Reset server with the given server URL. More... | |
static std::string | createDataPackName (const std::string &modelName, const std::string &objectName) |
Create datapack name from the given model and sensor/joint/link. More... | |
Additional Inherited Members | |
![]() | |
using | mutex_t = std::timed_mutex |
using | lock_t = std::unique_lock< EngineJSONServer::mutex_t > |
![]() | |
void | clearRegisteredDataPacks () |
Remove all registered datapacks. More... | |
virtual nlohmann::json | getDataPackData (const nlohmann::json &reqData) |
Retrieves datapack data. Takes an array of datapack names for which to get data. More... | |
virtual void | setDataPackData (const nlohmann::json &reqData) |
Set datapack data. More... | |
const std::string & | getEngineName () |
Get the Engine name. More... | |
![]() | |
mutex_t | _datapackLock |
Lock access to _datapacks to make execution thread-safe. More... | |
![]() | |
static constexpr std::string_view | GetDataPackInformationRoute = EngineJSONConfigConst::EngineServerGetDataPacksRoute |
static constexpr std::string_view | SetDataPackRoute = EngineJSONConfigConst::EngineServerSetDataPacksRoute |
static constexpr std::string_view | RunLoopStepRoute = EngineJSONConfigConst::EngineServerRunLoopStepRoute |
static constexpr std::string_view | InitializeRoute = EngineJSONConfigConst::EngineServerInitializeRoute |
static constexpr std::string_view | ResetRoute = EngineJSONConfigConst::EngineServerResetRoute |
static constexpr std::string_view | ShutdownRoute = EngineJSONConfigConst::EngineServerShutdownRoute |
Manages communication with the NRP. Uses a REST server to send/receive data. Singleton class.
|
override |
|
delete |
Delete for singleton.
|
delete |
Delete for singleton.
|
inlinestatic |
Create datapack name from the given model and sensor/joint/link.
modelName | Name of the parent model of the controlled object |
objectName | Name of the controlled object (sensor, joint, link, ...) |
|
static |
Get singleton instance.
|
delete |
Delete for singleton.
|
delete |
Delete for singleton.
|
inline |
Register a model plugin.
sensorPlugin | Pointer to model plugin |
|
inline |
Register a sensor plugin.
sensorPlugin | Pointer to sensor plugin |
void NRPJSONCommunicationController::registerStepController | ( | GazeboStepController * | stepController | ) |
Register a step controller.
stepController | Pointer to step controller |
|
static |
Reset server with the given server URL.
serverURL | URL used by server |
engineName | Name of this engine |
registrationURL | URL used to register this engine server's URL |