Go to the documentation of this file.
23 #ifndef PYTHON_ENGINE_JSON_NRP_CLIENT_BASE_H
24 #define PYTHON_ENGINE_JSON_NRP_CLIENT_BASE_H
31 #include "nrp_python_json_engine/config/cmake_constants.h"
35 #include <sys/types.h>
37 #include <sys/prctl.h>
44 template<
class ENGINE, const
char* SCHEMA>
51 static constexpr
size_t _killWait = 10;
80 catch(std::exception &e)
83 this->_initErrMsg = e.what();
90 NRPLogger::debug(
"PythonEngineJSONNRPClientBase::initialize(...) completed with no errors.");
100 NRPLogger::debug(
"NestEngineJSONNRPClient:reset()::resp [ {} ]", resp.dump());
102 catch(std::exception &e)
105 std::string msg = e.what();
125 std::string _initErrMsg =
"";
127 virtual const std::vector<std::string> engineProcStartParams()
const override
134 std::string serverOptions = this->
engineConfig().at(
"ServerOptions");
141 #endif // PYTHON_ENGINE_JSON_NRP_CLIENT_BASE_H
std::unique_ptr< ProcessLauncherInterface > unique_ptr
Definition: ptr_templates.h:34
NRP - Python Communicator on the NRP side. Converts DataPackInterface classes from/to JSON objects.
Definition: python_engine_json_nrp_client_base.h:45
NRP - Gazebo Communicator on the NRP side. Converts DataPackInterface classes from/to JSON objects.
Definition: engine_json_nrp_client.h:45
nlohmann::json sendResetCommand(const nlohmann::json &data)
Send a reset command.
Definition: engine_json_nrp_client.h:209
nlohmann::json sendInitCommand(const nlohmann::json &data)
Send an initialization command.
Definition: engine_json_nrp_client.h:192
const nlohmann::json & engineConfig() const override final
Get Engine Configuration.
Definition: engine_client_interface.h:278
static constexpr std::string_view SimulationTimeRatio
Ratio used by SimulationTime.
Definition: python_config.h:62
virtual void shutdown() override
Shutdown engine.
Definition: python_engine_json_nrp_client_base.h:114
static constexpr std::string_view ExtraServerOptionsArg
Parameter name that is used to pass along the server address.
Definition: python_config.h:52
virtual void initialize() override
Initialize engine.
Definition: python_engine_json_nrp_client_base.h:66
PythonEngineJSONNRPClientBase(nlohmann::json &config, ProcessLauncherInterface::unique_ptr &&launcher)
Definition: python_engine_json_nrp_client_base.h:55
virtual void resetEngineTime()
Definition: engine_client_interface.h:359
static EXCEPTION logCreate(LOG_EXCEPTION_T &exception, const std::string &msg, NRPLogger::spdlog_out_fcn_t spdlogCall=NRPLogger::critical)
Definition: nrp_exceptions.h:73
nlohmann::json sendShutdownCommand(const nlohmann::json &data)
Send a shutdown command.
Definition: engine_json_nrp_client.h:226
static void error(const FormatString &fmt, const Args &...args)
NRP logging function with message formatting for error level.
Definition: nrp_logger.h:160
virtual void reset() override
Reset engine.
Definition: python_engine_json_nrp_client_base.h:93
virtual ~PythonEngineJSONNRPClientBase() override
Definition: python_engine_json_nrp_client_base.h:61
static void debug(const FormatString &fmt, const Args &...args)
NRP logging function with message formatting for debug level.
Definition: nrp_logger.h:127
virtual const std::vector< std::string > engineProcStartParams() const override
Get all Engine Process Startup parameters.
Definition: engine_json_nrp_client.h:144
#define NRP_LOGGER_TRACE(...)
trace log macro. It is voided by defining \PRODUCTION_RELEASE
Definition: nrp_logger.h:39
nlohmann::json json
Definition: engine_json_server.cpp:31