c++ equivalent of callback_args for subscribers? [closed]
Subscribers in rospy can be optionally passed callback_args on creation. This is really handy when you have one callback for multiple incoming topics and you want to do topic-specific stuff for a given message. Equivalent functionality does not appear to be built into c++ subscribers
Is there some way to achieve the same thing in C++?
Context:
I have arbitrary number of multiple incoming topics each with corresponding outgoing topics - and a single callback that does the computation for an incoming topic and needs to publish the results to the correct outgoing topic.
I believe the keywords here are "multiple arguments ros c++ subscriber".
See #q232204 for what I believe is a (random) duplicate.
std::bind(..)
would be the recommended approach these days.See also wiki/roscpp/Overview/Publishers and Subscribers: Callback Types.
If you agree this is a duplicate, could I ask you to please close it as one?
yes, I agree, didn't quite have the language to articulate the question properly, thanks for reply.