ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

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
1

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

Question Tools

1 follower

Stats

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

Seen: 2,486 times

Last updated: Jan 20 '16