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

Publisher - Subscriber communication

asked 2015-07-10 11:02:27 -0500

Thanasis gravatar image

updated 2015-07-14 14:52:04 -0500

allenh1 gravatar image

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

https://drive.google.com/folderview?i...

edit retag flag offensive close merge delete

Comments

Are all of these nodes running on the same computer?

ahendrix gravatar image ahendrix  ( 2015-07-10 13:10:34 -0500 )edit

Yes, they are running on the same computer

Thanasis gravatar image Thanasis  ( 2015-07-11 08:22:29 -0500 )edit

The sequence shouldn't matter. But I cannot say for sure unless you post some of the code... What kind of messages are these?

allenh1 gravatar image allenh1  ( 2015-07-12 00:23:06 -0500 )edit

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.

cyborg-x1 gravatar image cyborg-x1  ( 2015-07-12 10:29:27 -0500 )edit

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.

allenh1 gravatar image allenh1  ( 2015-07-14 15:50:31 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-07-15 06:58:17 -0500

Thanasis gravatar image

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.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2015-07-10 11:02:27 -0500

Seen: 251 times

Last updated: Jul 15 '15