Ask Your Question

How do i publish in a callback function?

asked 2016-01-20 13:24:28 -0500

Gren8 gravatar image

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!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-01-20 14:53:50 -0500

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2016-01-20 13:24:28 -0500

Seen: 2,385 times

Last updated: Jan 20 '16