ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Yes this will work. You can create nodehandles anywhere in your process after ros::init. After ros::spin() has finished, your class instance goes out of scope, thereby its destructor (possibly implicitly created by compiler) is called. It will also destruct your member NodeHandle and thereby shutdown subscribers.