ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
A boost shared pointer to the message does appear in the call. That is how you access the message. You can't pass other parameters, because this callback is invoked by ROS whenever a message arrives.
The best way to pass information back to main()
is defining a C++ class in your program with the callback as a member function. It can then update class data as messages arrive.
Alternatively, you could update some global data structure. That is not generally a good practice unless your node is small and simple.