ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A answers.ros.org
Ask Your Question

Revision history [back]

Unfortunately, you didn't give us enough information (e.g. source code) in your question so I can just guess. Here a few things that can go wrong:

  • Are you calling ros::spin() or ros::spinOnce() in a loop somewhere in your program? Spinning will call the timer callbacks.

  • Is your NodeHandle object maybe stack allocated in the constructor and destroyed at the end of it? The live time of timer objects, publishers and subscribers is bound to the NodeHandle they were created with. Make sure that the NodeHandle is a member variable of the class that starts the timer.