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

Callback function to a Class member function

asked 2012-02-21 21:00:12 -0600

Haikal Pribadi gravatar image

updated 2012-02-21 22:17:35 -0600

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.

edit retag flag offensive close merge delete

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 gravatar image fergs  ( 2012-02-21 21:19:07 -0600 )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 gravatar image Haikal Pribadi  ( 2012-02-21 22:17:11 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
12

answered 2012-02-21 23:10:15 -0600

Cav gravatar image

You'll find your answer here: UsingClassMethodsAsCallbacks

edit flag offensive delete link more

Comments

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

Haikal Pribadi gravatar image Haikal Pribadi  ( 2012-02-21 23:16:33 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2012-02-21 21:00:12 -0600

Seen: 15,384 times

Last updated: Feb 21 '12