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

Publishing a message makes a copy and sends it over the network. ROS doesn't let you send pointers between nodes, because those nodes aren't running in the same memory space, and may not even be running on the same machine.

If you don't need to publish this data structure, and just want to pass it around within your own code, you can just declare a class or a struct containing the pointers, like:

struct ImageWithCameraInfo {
    sensor_msgs::ImageConstPtr image;
    sensor_msgs::CameraInfoConstPtr info;
};