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

The callback that you point to in the NodeHandle.subscribe(...) parameter has to be a separate callback method. It will be called every time a message is received. In that you may want to store the message (or its value) in a global variable which is read by the method ne that value.

Doc: http://www.ros.org/wiki/roscpp/Overview/Publishers%20and%20Subscribers#Subscriber_Options

Tut: http://www.ros.org/wiki/ROS/Tutorials/WritingPublisherSubscriber%28c%2B%2B%29

click to hide/show revision 2
fighting the char eating monster

The callback that you point to in the NodeHandle.subscribe(...) parameter has to be a separate callback method. It will be called every time a message is received. In that you may want to store the message (or its value) in a global variable which is read by the method ne needing that value.

Doc: http://www.ros.org/wiki/roscpp/Overview/Publishers%20and%20Subscribers#Subscriber_Options

Tut: http://www.ros.org/wiki/ROS/Tutorials/WritingPublisherSubscriber%28c%2B%2B%29