Robotics StackExchange | Archived questions

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

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 pypubsub tutorial demo talker does not. That is, the subscription works fine but no messages appear. Calling `rclgettopicnamesandtypes()works (i.e., no error is reported), but returns an empty result set. Callingrclgettopicnamesand_types()` a second time after a short wait works fine.

The docs for rclnodeinit() 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.

Asked by Jan Wielemaker on 2021-02-24 08:46:38 UTC

Comments

Did you ever make any progress on this front?

Asked by BrettHemes on 2021-06-16 09:33:50 UTC

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

Asked by Jan Wielemaker on 2021-06-16 09:41:02 UTC

Answers