ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
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.
2 | No.2 Revision |
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