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

Revision history [back]

click to hide/show revision 1
initial version

You can define publisher as global variable without initializing it. You can later initialize publisher with node handler within main() after ros::init(). In this way you can use publisher outside main within any function.