publisher and rosinit
Hi,
I have a small coding problem while writing publisher. Usually I write publisher inside main function in my code:
pub.publish(data);
after initialize ros, create nodhandle, and define publisher. Similar like this tutorial).
Now, I trying to publish not in my main function. But this could not work since the ros initialization and nodeHandle etc are in main function. And if I write the nodehandle in my one of my subfunction, the nodehandle will also directly off after the subfunction being called.
I was thinking if the rosinit could be initialized before the main function, but still have found the way.
Let me now if someone have suggestion. Thx
Cheers, Kang