ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

Declare your publisher, I do this in main:

ros::Publisher pub_info_left = nh.advertise<sensor_msgs::CameraInfo>("left/camera_info", 1);
sensor_msgs::CameraInfo info_left;

Then, in a callback function or in a while() loop in main do this:

info_left.header.stamp = ros::Time::now();
pub_info_left.publish(info_left);

I have implemented this in an approximate time synchronization node where I subscribe to the image and info topics from two different cameras, set all of their timestamps equal to each other then republish on those four topics here. That would be a more complete code example if the one above is not clear enough.