Abstract class defining an interface to interact with an Engine with data exchange via protobuf messages. More...
#include <engine_proto_wrapper.h>
Public Types | |
using | mutex_t = std::timed_mutex |
using | lock_t = std::unique_lock< EngineProtoWrapper::mutex_t > |
Public Member Functions | |
EngineProtoWrapper ()=delete | |
No dummy wrappers, only those with name. More... | |
EngineProtoWrapper (const std::string &engineName, const std::string &protobufPluginsPath, const nlohmann::json &protobufPlugins) | |
Constructor. More... | |
virtual | ~EngineProtoWrapper ()=default |
Destructor. More... | |
void | registerDataPack (const std::string &datapackName, ProtoDataPackController *interface) |
Registers a datapack controller with the given name in the engine. More... | |
unsigned | getNumRegisteredDataPacks () |
std::vector< std::string > | getNamesRegisteredDataPacks () |
Get the names of registered datapacks. More... | |
const std::string & | getEngineName () |
Get the Engine name. More... | |
virtual bool | initRunFlag () const =0 |
Indicates if the simulation was initialized and is running. More... | |
virtual bool | shutdownFlag () const =0 |
Indicates if shutdown was requested by the client. More... | |
virtual void | initialize (const nlohmann::json &data)=0 |
Initializes the simulation. More... | |
virtual void | reset ()=0 |
Resets the simulation. More... | |
virtual void | shutdown ()=0 |
Shutdowns the simulation. More... | |
virtual SimulationTime | runLoopStep (const SimulationTime timeStep)=0 |
Runs a single simulation loop step. More... | |
void | setDataPacks (const EngineGrpc::SetDataPacksRequest &data) |
void | setDataPack (const EngineGrpc::DataPackMessage &dataPack) |
std::unique_ptr< gpb::Message > | unpackFromAny (const gpb::Any &data) |
virtual void | getDataPacks (const EngineGrpc::GetDataPacksRequest &request, EngineGrpc::GetDataPacksReply *reply) |
bool | getDataPack (const std::string &name, EngineGrpc::DataPackMessage *dpMsg) |
void | setDataPackMessageData (gpb::Message *data, EngineGrpc::DataPackMessage *dpMsg) |
Protected Member Functions | |
void | clearRegisteredDataPacks () |
ProtoDataPackController * | getDataPackController (const std::string &datapackName) |
Returns the pointer to the DataPackController of the Data Pack with the specified name. More... | |
Protected Attributes | |
bool | _handleDataPackMessage = false |
If true controllers are sent incoming DataPackMessages, if false only the contained data. More... | |
std::vector< std::unique_ptr< protobuf_ops::NRPProtobufOpsIface > > | _protoOps |
std::string | _protoOpsStr = "" |
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.
using EngineProtoWrapper::lock_t = std::unique_lock<EngineProtoWrapper::mutex_t> |
using EngineProtoWrapper::mutex_t = std::timed_mutex |
|
delete |
No dummy wrappers, only those with name.
|
inline |
Constructor.
[in] | engineName | Name of the simulation engine |
|
virtualdefault |
Destructor.
|
inlineprotected |
|
inline |
|
inlineprotected |
Returns the pointer to the DataPackController of the Data Pack with the specified name.
|
inlinevirtual |
|
inline |
Get the Engine name.
|
inline |
Get the names of registered datapacks.
|
inline |
|
pure virtual |
Initializes the simulation.
[in] | data | Simulation configuration data |
[in] | datapackLock | ??? |
Implemented in NRPGazeboCommunicationController.
|
pure virtual |
Indicates if the simulation was initialized and is running.
Implemented in NRPGazeboCommunicationController.
|
inline |
Registers a datapack controller with the given name in the engine.
[in] | datapackName | Name of the datapack to be registered |
[in] | datapackController | Pointer to the datapack controller object that's supposed to be registered in the engine |
|
pure virtual |
Resets the simulation.
Implemented in NRPGazeboCommunicationController.
|
pure virtual |
Runs a single simulation loop step.
[in] | timeStep | Time step by which the simulation should be advanced |
Implemented in NRPGazeboCommunicationController.
|
inline |
|
inline |
|
inline |
|
pure virtual |
Shutdowns the simulation.
Implemented in NRPGazeboCommunicationController.
|
pure virtual |
Indicates if shutdown was requested by the client.
Implemented in NRPGazeboCommunicationController.
|
inline |
|
protected |
If true controllers are sent incoming DataPackMessages, if false only the contained data.
|
protected |
|
protected |