[ROS2 Foxy] Topics sometimes subscribed to and sometimes published to
I have two Nodes who communicate with a Float32 message topic.
The typical sequence of events are:
- Node A starts
- Node B starts
- Node A waits to subscribe to topic T
- Node B creates topic T publisher
- Node A successfully subscribes to topic T
- Node B sends messages continually on topic T
- 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.
Can you please provide a minimal reproducible example? It will help us better understand the problem and provide you with more reasonable support.
@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?