flojoy-ai / blocks

Flojoy Standard Blocks Library (now merged into flojoy-ai/studio)
https://blocks.flojoy.ai
4 stars 1 forks source link

[BLO-91] ROS 2 [RFC]: Initialization and Shutdown of libraries and framework #30

Open IsabelParedes opened 1 year ago

IsabelParedes commented 1 year ago

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¹:

A typical ROS program consists of the following operations:

  • Initialization

  • Create one or more ROS nodes

  • Process node callbacks

  • Shutdown

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:

Proposed Solution

Get some inspiration from Python context-manager but for Flojoy:

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:

References

1: https://docs.ros2.org/foxy/api/rclpy/api/init_shutdown.html

From SyncLinear.com | BLO-91