0
$\begingroup$

Rosanswers logo

Good evening,

my problem is that i want to subscribe and publish in the same node. I need to publish in a callback function but the nodehandle is initialized in the main(). How can i publish a messages in callback function? Is it possible to use a pointer to a publisher? If yes how could i do that?

Please help!


Originally posted by Gren8 on ROS Answers with karma: 11 on 2016-01-20

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

This is easily possible and you should be able to find many examples of this in existing ROS packages. Some examples: node (inside class), nodelet.


Originally posted by Stefan Kohlbrecher with karma: 24361 on 2016-01-20

This answer was ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.