ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
There are some possiblities to publish outside the while loop, e. g.
--> publishing in a subcriber callback (suitable if your node dows only few processing and your published out message only depends on the incoming messages, e. g. for any kind of republishers) --> publishing in a timer callback (if you want to publish at constant rate outside the while (ros::ok()) loop )
Note that you should set up your publisher before initializing the Subscriber/Timer and your publisher should be visible inside the callback (local publisher object not possible anymore).