0
$\begingroup$

Rosanswers logo

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.


Originally posted by Haikal Pribadi on ROS Answers with karma: 103 on 2012-02-21

Post score: 5


Original comments

Comment by fergs on 2012-02-21:
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.

Comment by Haikal Pribadi on 2012-02-21:
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..

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

You'll find your answer here: UsingClassMethodsAsCallbacks


Originally posted by Cav with karma: 345 on 2012-02-22

This answer was ACCEPTED on the original site

Post score: 12


Original comments

Comment by Haikal Pribadi on 2012-02-22:
exactly !!! this is the link i've been looking for. Thank you Cav!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.