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

Revision history [back]

click to hide/show revision 1
initial version

Hi jashanvir, one common way to do this is to use define a class and make the callback function a class member : http://wiki.ros.org/roscpp_tutorials/Tutorials/UsingClassMethodsAsCallbacks. In the body of the callback function, you can modify a class attribute, and then get the value in your main() using a get method.

Hi jashanvir, one common way to do this is to use define a class and make the callback function a class member : http://wiki.ros.org/roscpp_tutorials/Tutorials/UsingClassMethodsAsCallbacks. In the body of the callback function, you can modify a class attribute, and then get the value in your main() using a get method.

Edit : I don't think the tutorial is available in Python, but you can have a look at how the callback function is implemented here : http://wiki.ros.org/rospy_tutorials/Tutorials/WritingImagePublisherSubscriber