ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
From a brief look at your code. Your problem is that you are publishing only once immediately. If the topic communications have not been setup yet in the background your single publish will likely get dropped. Especially since you are publishing immediately at startup.
I suggest that you try publishing your data repeatedly like in the talker listener tutorials. http://wiki.ros.org/ROS/Tutorials/WritingPublisherSubscriber%28c%2B%2B%29