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

Revision history [back]

As @kramer has pointed out, you have no ros::spin() function in your main, meaning that a) no callbacks get processed and b) main returns immediately, destroying Foo.

Even after adding ros::spin(), Bar will still die earlier than you expect, because it will be destroyed when the initParam function returns.

Please read about lifetime, scope, and blocking on stackoverflow.