# Revision history [back]

You want the publisher to be declared as a global object. You create the node handle in your start up routine/constructor and initialise the publisher from that.

 //globally defined
ros::Publisher pub_;