ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
What you are measuring is the delay of:
I think the memcpy operation cannot be ignored in terms of timing. You set the header stamp then resize the image and do the memory copy these operations take quite a lot of time!
msg.height = 720;
msg.width = 1280;
msg.data.resize(1280*720*2);
memcpy(msg.data.data(), image_ptr_0, 1280*720*2);
msg.header.stamp.sec = ros::Time::now().sec;
msg.header.stamp.nsec = ros::Time::now().nsec;
What happens to the delay if you set the time-stamp at the end like above?
I suggest measuring the time the image resizing and copy takes.