ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
I would always put a call to spin outside of your constructor. Imagine someone needs to implement your class in his own code, as soon as he calls the constructor the code after constructor won't be executed. I think I've never seen anyone doing spin in the class itself, unless there was a function called loop() that was doing the processing.