You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 6, 2023. It is now read-only.
Generally, ROS nodes are spun with rclpy.spin(ros_node).
rclpy.spin creates an event loop, which repeatedly checks for events and handles them
It is essentially an infinite loop that repeatedly calls spin_once()
Publishers have a timer which determines the frequency at which messages are published to a given topic. Each spin of a publisher is triggered by the the timer.
For subscribers, they spin every time a new message is published to the given topic.
Problem
Since block execution in flojoy is function based, the publisher must be created and destroyed every time the ROS_PUBLISHER block is executed. This is inefficient and also poses a problem when the user wants to publish messages repeatedly.
Under normal circumstances, a ROS node will spin indefinitely until the node is killed. However, doing this in a flojoy block would impede the execution of any other blocks.
Proposed Solution
Enable the storage of block states. When a publisher or a subscriber are created, they should be reusable to save resources. This would also allow us to publish a message and return control to the user without blocking execution.
The saved resources solution is similar to how we handle the connections to the Mecademic robot. Check out studio/PYTHON/utils/mecademic_state -- maybe you could use some of our solution or come up with something better that might improve hardware connections in general
It may also be relevant to check out the work on the reactive nodes system, as it addresses a lot of the same problems that this is solving :)
Context
Example of a minimal ROS 2 publisher block:
Generally, ROS nodes are spun with
rclpy.spin(ros_node)
.Publishers have a timer which determines the frequency at which messages are published to a given topic. Each spin of a publisher is triggered by the the timer.
For subscribers, they spin every time a new message is published to the given topic.
Problem
Since block execution in flojoy is function based, the publisher must be created and destroyed every time the
ROS_PUBLISHER
block is executed. This is inefficient and also poses a problem when the user wants to publish messages repeatedly.Under normal circumstances, a ROS node will spin indefinitely until the node is killed. However, doing this in a flojoy block would impede the execution of any other blocks.
Proposed Solution
Enable the storage of block states. When a publisher or a subscriber are created, they should be reusable to save resources. This would also allow us to publish a message and return control to the user without blocking execution.
References
From SyncLinear.com | BLO-92
The text was updated successfully, but these errors were encountered: