Methods
None __init__(
self self,
address address,
experiment_folder experiment_folder = "",
config_file config_file = "simulation_config.json",
args args = "",
log_output log_output = True,
server_timeout server_timeout = 10
)
Spawns an NRPCoreSim process in server mode and connects to it
:param str address: the address that will be used by NRPCoreSim server
:param str experiment_folder: path to the folder containing all files needed to execute the experiment.
By default, is an empty string, which is interpreted as the current folder.
:param str config_file: path to the experiment configuration file. It can be an absolute path or
relative to `experiment_folder`.
By default, "simulation_config.json"
:param str args: additional NRPCoreSim command line parameters
:param bool log_output: if True, console output from NRPCoreSim process is hidden and logged into a file named
.console_output.log in the experiment folder. Default is True.
:param int server_timeout: time in seconds for waiting for connection with the NRPCoreSim grpc server.
10 seconds by default.
:param str docker_daemon_address: IP address of the docker daemon used
to launch the experiment in a docker container (more detail below).
'unix:///var/run/docker.sock' by default.
:param str image_name: name of the docker image which will be used to run the experiment (more detail below).
Empty by default.
:param list get_archives: list of archives (files or folders) that should be retrieved from the docker container
when shutting down the simulation (e.g. folder containing logged simulation data)
None __del__(self self)
Deletes the NRP Core objects and kills the server
def initialize(self self)
Calls the initialize() RPC of the NRP Core Server
def run_loop(
self self,
num_iterations num_iterations,
run_async run_async = False
)
Calls the runLoop() RPC of the NRP Core Server
def run_until_timeout(self self, run_async run_async = False)
Calls the runUntilTimeout() RPC of the NRP Core Server
def stop(self self)
Calls the stopLoop() RPC of the NRP Core Server
def reset(self self)
Calls the reset() RPC of the NRP Core Server
def shutdown(self self)
Calls the shutdown() RPC of the NRP Core Server
None set_proto_datapack(
self self,
str datapack_name,
str engine_name,
payload payload
)
Prepares a DataPack that will be sent to NRP Core (and later to an engine)
on the next call to run_loop().
:param str datapack_name: Name of the DataPack
:param str engine_name: Name of the engine to which the DataPack will be passed
:param protobuf.Any payload: Payload of the DataPack, a protobuf message
None set_json_datapack(
self self,
str datapack_name,
str engine_name,
dict payload
)
Prepares a DataPack that will be sent to NRP Core (and later to an engine)
on the next call to run_loop().
:param str datapack_name: Name of the DataPack
:param str engine_name: Name of the engine to which the DataPack will be passed
:param protobuf.Any payload: Payload of the DataPack, a protobuf message