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

Your problem is that you're using const pointers. const pointers cannot be mutated, which is why you are getting errors.

When you are generating a message for publishing it needs to be a standard shared pointer. When you receive it in your callback it will be a const pointer or else it will be copied.

Note: When you publish a message with a shared pointer you're not allowed to modify it after it has been sent as other parts of the process might be accessing it.

For information on boost pointers I suggest the boost documentation: http://www.boost.org/doc/libs/1_57_0/libs/smart_ptr/shared_ptr.htm Or general reference sites like stack overflow: http://stackoverflow.com/questions/569775/smart-pointers-boost-explained