Msg is not received in subscriber if publisher is not active before

asked 2023-02-13 06:10:35 -0500

qwertz gravatar image

I have a problem with receiving messages in a subscriber in ROS2. It is a ComposableNode that is started by launch file in a ComposableNodeContainer.

  • If I start publishing in a separate terminal via command line before running the launch file, the topic arrives at the subscriber and the callback function is executed.
  • But if I execute the launch file first and start the publisher afterwards, nothing happens.

What could be the reason for this?

I am running ROS2 Foxy on Ubuntu 20.04. Environment variables:

ROS_VERSION=2
ROS_PYTHON_VERSION=3
ROS_LOCALHOST_ONLY=0
ROS_DISTRO=foxy

Edit: Some further attempts have now revealed that I can fix the problem by changing the order of the ComposableNodes in the composable_node_descriptions of the launch file. This solved the problem for me. But I can't understand the behavior. From my point of view the order should not matter, right?

edit retag flag offensive close merge delete

Comments

Looking for a solution, I read something here about how problems can occur when there is both inter- and intra-process communication. Could this be the cause of the observed behavior?

qwertz gravatar image qwertz  ( 2023-02-13 05:27:22 -0500 )edit