Subscribe to a topic and trigger two Callback functions
Hi,
I want to trigger two Callback functions by same message data. And to be able to execute Callbacks at the same rate as publication happens. At the moment I have it with following initialization code. What would be the correct way to do it?
ImuSubscriber = nh.subscribe ("/mikrokopter/fc_debug", 100, &MikrokopterControl::mikoImuCallback, this);
HeightSubscriber = nh.subscribe ("/mikrokopter/fc_debug", 100, &MikrokopterControl::heightCallback, this);
The goal is to call two different Callbacks as far as i understood. I want the published message data into two different functions and they to be executed when ever new data is available from publisher.
Are you trying to call the same callback two times or to call two different callbacks?
I modified the question a bit, hope it's more clear now
Interesting questions... hope to see some answers from pros.. :)
You still seem to be providing the same function in both callbacks. Additionally, I don't fully understand why you need multiple callbacks. Is there a reason you cannot call multiple functions with the message data from a single callback?
No special reason, basically were wondering about if there are some sophisticated ways to do this with ROS. Thanks for the answers!