Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Found the problem. As say in link text "I guess the problem is that ROS needs some time to register at the core and to establish all subscriber connections". Which means, before publishing any message i should wait just a little time. So i use sleep(5); just before i call the publish() method. I could also write:

while(r_arm_comand_publisher.getNumSubscribers() != 1)
  ROS_INFO_STREAM("\n\tWaiting for subscibers\n number of subs:"<<r_arm_comand_publisher.getNumSubscribers()<<"\n");

but i am working with simulator gazebo, and i start the gazebo first. So there is always at least one subscriber listening.