ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

[ROS2 Foxy] Topics sometimes subscribed to and sometimes published to

asked 2022-10-06 09:29:37 -0500

Fubbis gravatar image

I have two Nodes who communicate with a Float32 message topic.

The typical sequence of events are:

  1. Node A starts
  2. Node B starts
  3. Node A waits to subscribe to topic T
  4. Node B creates topic T publisher
  5. Node A successfully subscribes to topic T
  6. Node B sends messages continually on topic T
  7. Node A receives messages on topic T and runs a callback function

But sometimes (maybe 50% of times) everything happens except step 7. Node A says it is subscribed to topic T, Node B says it is publishing on topic T, but the callback is not executed.

Debugging with ros2 topic info /topicT -v says that topic T has 1 subscribers but 0 publishers YET I can see values of /topicT in rqt using the plot plugin. So data IS being published but some subscribers can sometimes not receive the data.

Is this a known error?

My ROS application and all terminals used to run ros2 and rqt use a ROS_DOMAIN_ID and this error only happens some of the time. Mind you, Node A and Node B does a whole lot of other stuff in between each step described above.

edit retag flag offensive close merge delete

Comments

Can you please provide a minimal reproducible example? It will help us better understand the problem and provide you with more reasonable support.

ravijoshi gravatar image ravijoshi  ( 2022-10-11 02:22:14 -0500 )edit

@ravijoshi Sorry but I don't think I can do that. I have found the cause of this problem. It seems to work fine if I remove some of the publishers in Node B. It had two imageTransport camera, two imageTransport, and three other publishers, totalling in 17 topics. Is this too much for a single ROS node?

Fubbis gravatar image Fubbis  ( 2022-10-18 04:55:51 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2022-10-18 06:19:21 -0500

ravijoshi gravatar image

updated 2022-10-18 06:20:53 -0500

I am quoting the comment received above.

It had two imageTransport camera, two imageTransport, and three other publishers, totalling in 17 topics.

This is an interesting bug with ROS Foxy. Please see a detailed report in the following link: https://github.com/ros2/ros2/issues/1301

If possible, please upgrade your ROS distribution. For example, this issue does not occur in ROS Galactic. Or else just reduce the number of ROS publishers.

edit flag offensive delete link more

Comments

Insanely helpful answer. Thanks a lot!

Fubbis gravatar image Fubbis  ( 2022-10-18 09:19:49 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2022-10-06 09:29:37 -0500

Seen: 47 times

Last updated: Oct 18 '22