ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
is this my problem or is this type of message impossible to send?
no, not at all, but you don't seem to give ROS any opportunity to properly send it out to your subscribers, as your program immediately exits after your call to publish(..)
.
That won't work, as all the infrastructure will be teared down before the middleware has had time to process everything.
Add a sleep or delay before your return 0
and things will probably work (provided there are no other problems with your code).
Know that pub/sub is an asynchronous communication system. If you require confirmation or guaranteed delivery, use services.