rclpy icon indicating copy to clipboard operation
rclpy copied to clipboard

Addition of a ``wait_for_node()`` function

Open adityapande-1995 opened this issue 4 years ago • 4 comments

Feature request

Feature description

It would be nice to have a wait_for_node(node_name, timeout) function which would wait for a particular node to show up, and block for a specified time. Further, we can have a set of wait_for_* functions which could wait for parameters, services, topics to show up.

Implementation considerations

This feature was mentioned in https://github.com/ros2/launch_ros/pull/263. Related feature exists in rcl (https://github.com/ros2/rcl/pull/907) but it hasn't been ported to rclcpp (https://github.com/ros2/rclcpp/pull/1621) due to a design issue.

adityapande-1995 avatar Sep 14 '21 21:09 adityapande-1995

+1 for a function like this, but if I understand correctly, ros2/rcl#907 looks for publisher/subscriber counts on a named topic, right? Which is close enough in spirit, but I guess that isn't the API this issue would want to have wrapped in rclpy.

aprotyas avatar Sep 14 '21 21:09 aprotyas

Right. The implementation I have in https://github.com/ros2/launch_ros/pull/263 is pretty basic, and definitely not efficient. Not sure where to implement this feature though, maybe in rcl and then wrap it in rclpy and rclcpp

adityapande-1995 avatar Sep 14 '21 22:09 adityapande-1995

maybe in rcl and then wrap it in rclpy and rclcpp

I think that's the way to go because I see utility for all of the wait_for_* methods in the client libraries.

aprotyas avatar Sep 14 '21 22:09 aprotyas

A basic implementation is added here : https://github.com/ros2/examples/blob/200a16c2290e09a26eaa91f201555887cbb3e379/launch_testing/launch_testing_examples/launch_testing_examples/check_multiple_nodes_launch_test.py#L84

adityapande-1995 avatar Jan 28 '22 17:01 adityapande-1995

FYI I think this has been closed by https://github.com/ros2/rclpy/pull/930! That has been released into Iron (not backported into Humble AFAICT)

dhood avatar Jun 08 '23 14:06 dhood

Good call. I'll go ahead and close this one out, thanks!

clalancette avatar Jun 08 '23 14:06 clalancette