ROS2 Problem with Simple Talker/Listener with Python Socket
Hi everyone.
I'm running ROS2 on some Docker Containers. I got some complex structure, but the main part that I need help with is this first one:
The first Container (actually two containers runs the same code) works as a talker, generating a JSON message with his id, and three random information. Then, this container sends the message via ROS2 topic.
The second Container works as a listener, it stays on a loop listenning to the same topic that the first container sends the message, and for each message received, it stores on a queue, and once the queue gets to some size, it sends to a 3rd container via Python Socket.
My problem is: sometime the code works just fine and sometimes it doesn't. The first container aways prints the message as it is sending to the second container, something like:
"[INFO] [1617227109.900281800] [minimal_publisher]: Publishing: "{"id": 2, "sugar": 24, "metabolism": 4, "vision": 4}""
But sometimes this message is not readed by the second container. If I keep sending messages from the first container, some of them gets to the second, and some doesn't.
I'm not sure if my problem is on the talker, or on the listener, or on the Docker, or even in the Python code.
Anyone that could help me? Thanks
Talker code: https://pastebin.com/iS2Jfrcw Listener code: https://pastebin.com/KdRdNRCr
PS: Don't worry about the extra code, most of it is releated from some debbugs I'm working on Docker or on the parts of the system that comes after the message send by the Python Socket.