| 38 | } |
| 39 | |
| 40 | void StereoBuffer::addStereoFrame(const sensor_msgs::ImageConstPtr& left_img, |
| 41 | const sensor_msgs::ImageConstPtr& right_img) { |
| 42 | // Timestamp is in nanoseconds |
| 43 | Timestamp timestamp = left_img->header.stamp.toNSec(); |
| 44 | |
| 45 | if (stereo_buffer_.size() == 0) { |
| 46 | // if only frame |
| 47 | earliest_timestamp_ = timestamp; |
| 48 | } |
| 49 | |
| 50 | // create packet |
| 51 | StereoPacket sp; |
| 52 | sp.timestamp = timestamp; |
| 53 | sp.left_ros_img = left_img; |
| 54 | sp.right_ros_img = right_img; |
| 55 | |
| 56 | // Update buffer and time |
| 57 | stereo_buffer_.push_back(sp); |
| 58 | latest_timestamp_ = timestamp; |
| 59 | return; |
| 60 | } |
| 61 | |
| 62 | void StereoBuffer::removeNext() { |
| 63 | // Remove next pair of stereo frames |
no test coverage detected