ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Wrapping function callback around a method (function)

asked 2014-09-02 10:32:16 -0600

alfa_80 gravatar image

updated 2014-09-02 22:44:48 -0600

I would like to know if there there a way to wrap a ROS class callback function in a method to be used as a convenience API. I know that we could possibly achieve this via adapter design pattern, but then when this is coupled with middleware constructs it is harder to see or implement.

Anyone has an idea?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-09-02 14:09:58 -0600

paulbovbel gravatar image

updated 2014-09-02 14:10:56 -0600

You can certainly wrap ROS callback functions, however I can't think of an application for that approach, since you would need to manually provide the data the callback expects (whether message or request/response arguments). If you mean, can you reuse a generic function as a ROS callback, you can also use boost::bind to bind a function with arbitrary arguments.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-09-02 10:32:16 -0600

Seen: 145 times

Last updated: Sep 02 '14