Rosanswers logo


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


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


Originally posted by Thanasis on ROS Answers with karma: 16 on 2015-07-10

Post score: 0

Original comments

Comment by ahendrix on 2015-07-10:
Are all of these nodes running on the same computer?

Comment by Thanasis on 2015-07-11:
Yes, they are running on the same computer

Comment by allenh1 on 2015-07-12:
The sequence shouldn't matter. But I cannot say for sure unless you post some of the code... What kind of messages are these?

Comment by cyborg-x1 on 2015-07-12:
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.

Comment by allenh1 on 2015-07-14:
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.


1 Answer 1


Rosanswers logo

Thank you very much for you help. It is a lot of code but the complete_test1 node is based on a node provided by Cyberbotics Webots with the same name (complete_test). What I have added are the topics, the publishers, the subscribers, the callbacks and the message types. Maybe you can check only these parts...

Thank you for your time.

Originally posted by Thanasis with karma: 16 on 2015-07-15

This answer was ACCEPTED on the original site

Post score: 0


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.