Publishing a topic/message in a callback member function
I attempt to publish a topic/messages in a callback member function (refer here in the answers section), but, it doesn't work. The code is compiled without any complaints, however, when I issue a command to see the published message, say, ros echo -c /topic, it shows nothing there.
Is it not doable publishing it in the callback member function? Are there any alternatives to that?