NRP Core  1.4.1
EngineClientInterface Class Referenceabstract

Interface to engines. More...

#include <engine_client_interface.h>

Inheritance diagram for EngineClientInterface:
PtrTemplates< EngineClientInterface > EngineClient< ENGINE, SCHEMA > EngineClient< GazeboEngineGrpcNRPClient, SCHEMA > EngineClient< GazeboEngineJSONNRPClient, SCHEMA > EngineClient< NestEngineJSONNRPClient, SCHEMA > EngineClient< NestEngineServerNRPClient, NestServerConfigConst::EngineSchema > EngineClient< PySimNRPClient, SCHEMA > EngineClient< PythonEngineGRPCNRPClient, SCHEMA > EngineClient< PythonEngineJSONNRPClient, SCHEMA >

Public Member Functions

 EngineClientInterface (ProcessLauncherInterface::unique_ptr &&launcher)
 
virtual ~EngineClientInterface ()
 
virtual const std::string engineName () const =0
 Get Engine Name. More...
 
virtual const nlohmann::jsonengineConfig () const =0
 Get engine config data. More...
 
virtual nlohmann::jsonengineConfig ()=0
 Get engine config data. More...
 
virtual const std::vector< std::string > engineProcStartParams () const =0
 Get all Engine Process Startup parameters. More...
 
virtual pid_t launchEngine ()
 Launch the engine. More...
 
virtual void initialize ()=0
 Initialize engine. More...
 
virtual void reset ()=0
 Reset engine. More...
 
virtual void shutdown ()=0
 Shutdown engine. More...
 
virtual SimulationTime getEngineTimestep () const =0
 Get engine timestep. More...
 
virtual SimulationTime getEngineTime () const =0
 Get current engine time. More...
 
virtual const std::string engineSchema () const =0
 Get json schema for this specific engine type. More...
 
virtual void runLoopStepAsync (SimulationTime timeStep)=0
 Starts a single loop step in a separate thread. More...
 
virtual void runLoopStepAsyncGet (SimulationTime timeOut)=0
 Waits and gets the results of the loop step started by EngineClientInterface::runLoopStepAsync() More...
 
virtual void sendDataPacksToEngine (const datapacks_set_t &dataPacks)=0
 Sends datapacks to engine. More...
 
virtual datapacks_vector_t getDataPacksFromEngine (const datapack_identifiers_set_t &datapackIdentifiers)=0
 Gets requested datapacks from engine. More...
 

Protected Attributes

ProcessLauncherInterface::unique_ptr _process
 Process Launcher. Will be used to stop process at end. More...
 

Additional Inherited Members

- Public Types inherited from PtrTemplates< EngineClientInterface >
using shared_ptr = std::shared_ptr< EngineClientInterface >
 
using const_shared_ptr = std::shared_ptr< const EngineClientInterface >
 
using unique_ptr = std::unique_ptr< EngineClientInterface >
 
using const_unique_ptr = std::unique_ptr< const EngineClientInterface >
 

Detailed Description

Interface to engines.

Constructor & Destructor Documentation

◆ EngineClientInterface()

EngineClientInterface::EngineClientInterface ( ProcessLauncherInterface::unique_ptr &&  launcher)
explicit

◆ ~EngineClientInterface()

EngineClientInterface::~EngineClientInterface ( )
virtualdefault

Member Function Documentation

◆ engineConfig() [1/2]

virtual const nlohmann::json& EngineClientInterface::engineConfig ( ) const
pure virtual

Get engine config data.

Implemented in EngineClient< ENGINE, SCHEMA >.

◆ engineConfig() [2/2]

◆ engineName()

virtual const std::string EngineClientInterface::engineName ( ) const
pure virtual

Get Engine Name.

Returns
Returns engine name

Implemented in EngineClient< ENGINE, SCHEMA >.

◆ engineProcStartParams()

virtual const std::vector<std::string> EngineClientInterface::engineProcStartParams ( ) const
pure virtual

◆ engineSchema()

virtual const std::string EngineClientInterface::engineSchema ( ) const
pure virtual

Get json schema for this specific engine type.

Returns
Returns URI of engine schema
Exceptions
Throwson error

Implemented in EngineClient< ENGINE, SCHEMA >.

◆ getDataPacksFromEngine()

◆ getEngineTime()

virtual SimulationTime EngineClientInterface::getEngineTime ( ) const
pure virtual

Get current engine time.

Returns
Returns engine time

Implemented in EngineClient< ENGINE, SCHEMA >.

◆ getEngineTimestep()

virtual SimulationTime EngineClientInterface::getEngineTimestep ( ) const
pure virtual

Get engine timestep.

Exceptions
Throwson error

Implemented in EngineClient< ENGINE, SCHEMA >.

◆ initialize()

◆ launchEngine()

◆ reset()

◆ runLoopStepAsync()

virtual void EngineClientInterface::runLoopStepAsync ( SimulationTime  timeStep)
pure virtual

◆ runLoopStepAsyncGet()

virtual void EngineClientInterface::runLoopStepAsyncGet ( SimulationTime  timeOut)
pure virtual

Waits and gets the results of the loop step started by EngineClientInterface::runLoopStepAsync()

The function should be called after calling EngineClientInterface::runLoopStepAsync(). It should join the worker thread and retrieve the results of the loop step.

Parameters
timeOutTimeout of the loop step. If it's less or equal to 0, the function will wait indefinitely.

Implemented in EngineClient< ENGINE, SCHEMA >, EngineClient< PySimNRPClient, SCHEMA >, EngineClient< GazeboEngineGrpcNRPClient, SCHEMA >, EngineClient< NestEngineJSONNRPClient, SCHEMA >, EngineClient< NestEngineServerNRPClient, NestServerConfigConst::EngineSchema >, EngineClient< GazeboEngineJSONNRPClient, SCHEMA >, EngineClient< PythonEngineJSONNRPClient, SCHEMA >, and EngineClient< PythonEngineGRPCNRPClient, SCHEMA >.

◆ sendDataPacksToEngine()

◆ shutdown()

Member Data Documentation

◆ _process

ProcessLauncherInterface::unique_ptr EngineClientInterface::_process
protected

Process Launcher. Will be used to stop process at end.


The documentation for this class was generated from the following files: