Publisher - Subscriber communication
Hello,
My implementation is the following: 1. I have created a node that subscribes to two topics (Listener node). 2. There are two more nodes each of which has one Publisher
I have noticed that if I run the Listener node first (using rosrun) and post the messages using ROS_INFO nothing is printed. This makes sense since the Publishers haven'r ran yet. However, when I start the Publishers I still see nothing printed. This is strange, since if I start the two Publisher nodes first and then the listener everything seems OK.
My question is: Is there a specific sequence according to which the nodes should be started in order the Publishers and Subscribers to communicate correctly ?
Thank you
Update:
my package is called "nodes" containing nodes "complete_test1" and "FL_leg_control"
The complete_test1 node is an example from webots in order to communicate with the robot model. The FL_leg_control is a node I have build in order to calculate the torques needed to drive the robot's legs.
The FL_leg_control nodes publishes in the "FL_command_dispatch" topic and subscribes in the "FL_encoders_feedback" topic. The complete_test1 node publishes in the "FL_encoders_feedback" topic and subscribes in the "FL_command_dispatch" topic.
The messages are: 1. LegEncoders 2. LegCommand
and as you can see they are included in the nodes using:
#include "nodes/LegEncoders.h"
#include "nodes/LegCommand.h"
I am sending you (with the following google drive link bellow) the code for these two nodes and the two message types I have created in the "msg" folder.
If you have any problems reading them, please tell me. Thank you in advance
Are all of these nodes running on the same computer?
Yes, they are running on the same computer
The sequence shouldn't matter. But I cannot say for sure unless you post some of the code... What kind of messages are these?
You should post your code, maybe you forgot something... like ros::Spin or you always create a new publisher when you publish or something else like that.
Phew... That's a lot of code. I will be able to look through it later tonight. I'll let you know if I see something.