diff --git a/src/python/arcor2_runtime/VERSION b/src/python/arcor2_runtime/VERSION index afaf360d..1cc5f657 100644 --- a/src/python/arcor2_runtime/VERSION +++ b/src/python/arcor2_runtime/VERSION @@ -1 +1 @@ -1.0.0 \ No newline at end of file +1.1.0 \ No newline at end of file diff --git a/src/python/arcor2_runtime/resources.py b/src/python/arcor2_runtime/resources.py index c6a59328..a9981381 100644 --- a/src/python/arcor2_runtime/resources.py +++ b/src/python/arcor2_runtime/resources.py @@ -87,9 +87,24 @@ def stream_joints(robot_inst: Robot) -> None: class Resources: - __slots__ = ("project", "scene", "objects", "args", "executor", "_stream_futures") + __slots__ = ("project", "scene", "objects", "args", "executor", "_stream_futures", "interact_with_scene_service") + + def __init__( + self, + apply_action_mapping: bool = True, + scene_start_timeout: rest.OptTimeout = None, + interact_with_scene_service: bool = True, + ) -> None: + """Initializes Resources class. + + :param apply_action_mapping: Action mapping (name to id) can be disabled when there are no actions. + :param scene_start_timeout: Timeout for calling /system/start on the Scene service. + :param interact_with_scene_service: when set to False, no call to the Scene service will be made. + :return: + """ + + self.interact_with_scene_service = interact_with_scene_service - def __init__(self, apply_action_mapping: bool = True, scene_start_timeout: rest.OptTimeout = None) -> None: models: dict[str, None | Models] = {} scene = self.read_project_data(Scene.__name__.lower(), Scene) @@ -163,7 +178,8 @@ def __init__(self, apply_action_mapping: bool = True, scene_start_timeout: rest. print_event(package_info_event) # in order to prepare a clean environment (clears all configurations and all collisions) - scene_service.stop() + if self.interact_with_scene_service: + scene_service.stop() self.executor = concurrent.futures.ThreadPoolExecutor() futures: list[concurrent.futures.Future] = [] @@ -205,7 +221,8 @@ def __init__(self, apply_action_mapping: bool = True, scene_start_timeout: rest. # the first exception will be available as __context__ raise ResourcesException(" ".join([str(e) for e in exceptions]), exceptions) from exceptions[0] - scene_service.start(scene_start_timeout) + if self.interact_with_scene_service: + scene_service.start(scene_start_timeout) self._stream_futures: list[concurrent.futures.Future] = [] @@ -261,7 +278,8 @@ def __exit__( # this intentionally ignores KeyboardInterrupt (derived from BaseException) print_exception(ex_value) - scene_service.stop() + if self.interact_with_scene_service: + scene_service.stop() self.cleanup_all_objects() return True diff --git a/src/python/arcor2_scene/CHANGELOG.md b/src/python/arcor2_scene/CHANGELOG.md index d5c64e76..97a1e25f 100644 --- a/src/python/arcor2_scene/CHANGELOG.md +++ b/src/python/arcor2_scene/CHANGELOG.md @@ -2,6 +2,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +## [1.1.0] - 2024-01-03 + +### Changed + +- Parameter `interact_with_scene_service` added to the `Resources` class. + ## [1.0.0] - 2023-02-14 ### Changed