This repository has been archived by the owner on Dec 6, 2023. It is now read-only.
[BLO-91] ROS 2 [RFC]: Initialization and Shutdown of libraries and framework #30
Labels
Improvement
Created by Linear-GitHub Sync
Context
Some frameworks and libraries need to be explicitly initialized and shutdown.
For instance, ROS 2 application typically have several phases as described in the documentation of
[rclpy](https://github.com/ros2/rclpy)
, ROS Client for Python¹:It might also be the case for other workflow which needs explicit setup and teardown of resources (e.g. access to files, connection to database, authentication to a service, etc.)
Problem
Currently, the setup and teardown of the framework has to be defined into a Flojoy Block.
This creates two issues:
[rclpy.init](https://docs.ros2.org/foxy/api/rclpy/api/init_shutdown.html#rclpy.init)
,[rclpy.shutdown](https://docs.ros2.org/foxy/api/rclpy/api/init_shutdown.html#rclpy.shutdown)
or even[rclpy.spin{,\_once,\_until_future_complete}](https://docs.ros2.org/foxy/api/rclpy/api/init_shutdown.html#rclpy.spin)
and were to be used in the same application, this might create alternations of connections and disconnections. This would definitely come with slowness or inefficiencies or even failures due to the[rclpy.Context](https://github.com/ros2/rclpy/blob/b4b4702ecffd923548eadac6d35f3d90d2eb6f91/rclpy/rclpy/context.py#L59-L90)
's client inconsistent state since it is a Singleton.Proposed Solution
Get some inspiration from Python context-manager but for Flojoy:
__enter__
) and when it exit it (in the spirit of__exit__
)The user must not know that such a context exist, but we must have a way to know that they need one so that we can setup the required logic.
Design plan:
Context
which would be subclassed for each frameworkContext
if at least one Block decorator for the framework is usedReferences
1: https://docs.ros2.org/foxy/api/rclpy/api/init_shutdown.html
From SyncLinear.com | BLO-91
The text was updated successfully, but these errors were encountered: