| 292 | } |
| 293 | |
| 294 | void process() |
| 295 | { |
| 296 | if (!LOOP_CLOSURE) |
| 297 | return; |
| 298 | while (true) |
| 299 | { |
| 300 | sensor_msgs::ImageConstPtr image_msg = NULL; |
| 301 | sensor_msgs::PointCloudConstPtr point_msg = NULL; |
| 302 | nav_msgs::Odometry::ConstPtr pose_msg = NULL; |
| 303 | |
| 304 | // find out the messages with same time stamp |
| 305 | m_buf.lock(); |
| 306 | if(!image_buf.empty() && !point_buf.empty() && !pose_buf.empty()) |
| 307 | { |
| 308 | if (image_buf.front()->header.stamp.toSec() > pose_buf.front()->header.stamp.toSec()) |
| 309 | { |
| 310 | pose_buf.pop(); |
| 311 | printf("throw pose at beginning\n"); |
| 312 | } |
| 313 | else if (image_buf.front()->header.stamp.toSec() > point_buf.front()->header.stamp.toSec()) |
| 314 | { |
| 315 | point_buf.pop(); |
| 316 | printf("throw point at beginning\n"); |
| 317 | } |
| 318 | else if (image_buf.back()->header.stamp.toSec() >= pose_buf.front()->header.stamp.toSec() |
| 319 | && point_buf.back()->header.stamp.toSec() >= pose_buf.front()->header.stamp.toSec()) |
| 320 | { |
| 321 | pose_msg = pose_buf.front(); |
| 322 | pose_buf.pop(); |
| 323 | while (!pose_buf.empty()) |
| 324 | pose_buf.pop(); |
| 325 | while (image_buf.front()->header.stamp.toSec() < pose_msg->header.stamp.toSec()) |
| 326 | image_buf.pop(); |
| 327 | image_msg = image_buf.front(); |
| 328 | image_buf.pop(); |
| 329 | |
| 330 | while (point_buf.front()->header.stamp.toSec() < pose_msg->header.stamp.toSec()) |
| 331 | point_buf.pop(); |
| 332 | point_msg = point_buf.front(); |
| 333 | point_buf.pop(); |
| 334 | } |
| 335 | } |
| 336 | m_buf.unlock(); |
| 337 | |
| 338 | if (pose_msg != NULL) |
| 339 | { |
| 340 | //printf(" pose time %f \n", pose_msg->header.stamp.toSec()); |
| 341 | //printf(" point time %f \n", point_msg->header.stamp.toSec()); |
| 342 | //printf(" image time %f \n", image_msg->header.stamp.toSec()); |
| 343 | // skip fisrt few |
| 344 | if (skip_first_cnt < SKIP_FIRST_CNT) |
| 345 | { |
| 346 | skip_first_cnt++; |
| 347 | continue; |
| 348 | } |
| 349 | |
| 350 | if (skip_cnt < SKIP_CNT) |
| 351 | { |
nothing calls this directly
no test coverage detected