Ask Your Question
2

Callback function to a Class member function

asked Feb 22

Haikal Pribadi gravatar image Haikal Pribadi
41 1 7

updated Feb 22

Hi all, this question might have just a trivial answer, but because i'm new to ROS and might be looking at the wrong places, I still can't figure it out. So, I want to create a service where the callback function would call a function of an Object (e.g. Board.executeCommand() ) . First, is it even possible? If it is, how do you do it? Thank you all..

EDIT: By the way, i'm using C++ as the language.

delete close flag offensive retag edit

Comments

You should specify which language -- in Python it is as simple as using class_instance.method_name, in C++, you will have to use Boost::Bind.

fergs (Feb 22)edit

Uh, i forgot to mention that. I'm using C++. I'll edit my question. Could help explaining a little bit how to use Boost::Bind ? cause i'm originally a Java programmer, and still learning C++ as well. Thanks..

Haikal Pribadi (Feb 22)edit

1 Answer

Sort by ยป oldest newest most voted
3

answered Feb 22

Cav gravatar image Cav
140 3 11

You'll find your answer here: UsingClassMethodsAsCallbacks

link delete flag offensive edit

Comments

exactly !!! this is the link i've been looking for. Thank you Cav!

Haikal Pribadi (Feb 22)edit

Your answer

Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
[hide preview]

Question tools

Follow

subscribe to rss feed

Stats

Asked: Feb 22

Seen: 105 times

Last updated: Feb 22