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

This is not a bug but the only reasonable behavior of the API. If your non-const subscriber would receive a reference (no copy) of the original message it can modify the message instance which would effect all other subscribers. Even worst since the order of the subscriber callbacks is not deterministic the overall system behavior would be non-deterministic.

From the perspective of another const subscriber the message instance can change will it is being processed in the callback.

So if you do want to use zero copy your subscriber must specify const in the callback signature.