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

Wrapping function callback around a method (function)

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

alfa_80 gravatar image

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

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 -0500

paulbovbel gravatar image

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

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

Question Tools

1 follower


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

Seen: 197 times

Last updated: Sep 02 '14