Why do I need a 0.1 second sleep after rcl_node_init()

asked 2021-02-24 07:46:38 -0500

Jan Wielemaker gravatar image

I’m too new to see whether this is a bug report or question. I’m writing an rcl for SWI-Prolog (well, in the exploratory phase). I notice that everything works as advertised when I do a 0.1 (now) second sleep after initializing the node using rcl_node_init(). If I do not sleep the node I created shows up in rqt, but not using ros2 node list . Also, subscribing to /turtle1/cmd_vel works, but subscribing to the py_pubsub tutorial demo talker does not. That is, the subscription works fine but no messages appear. Calling rcl_get_topic_names_and_types() works (i.e., no error is reported), but returns an empty result set. Calling rcl_get_topic_names_and_types() a second time after a short wait works fine.

The docs for rcl_node_init() claim the node should be ready after the function returns. Have I missed something?

This is using foxy from the ROS repos on Ubuntu 20.04.

edit retag flag offensive close merge delete

Comments

Did you ever make any progress on this front?

BrettHemes gravatar image BrettHemes  ( 2021-06-16 09:33:50 -0500 )edit

With rclswi and ROS2, yes :) See https://github.com/SWI-Prolog/rclswi. With this issue, I'm afraid not. There were other priorities so for now we are patient and wait :(

Jan Wielemaker gravatar image Jan Wielemaker  ( 2021-06-16 09:41:02 -0500 )edit