hku-mars / FAST-LIVO

A Fast and Tightly-coupled Sparse-Direct LiDAR-Inertial-Visual Odometry (LIVO).
GNU General Public License v2.0
1.24k stars 198 forks source link

A question about function sync_package #55

Closed PengKunPROO closed 1 year ago

PengKunPROO commented 1 year ago

Hello! I'm learning slam and found fast-livo is an excellent work to fuse the camera and lidar.But in data processing stage,which I refer to the function sync_package, I got a little puzzled about this: if(meas.lidar->points.size() <= 1) { mtx_buffer.lock(); if (img_buffer.size()>0) // temp method, ignore img topic when no lidar points, keep sync { lidar_buffer.pop_front(); img_buffer.pop_front(); } mtx_buffer.unlock(); sig_buffer.notify_all(); // ROS_ERROR("out sync"); return false; }

I just wondering if we should keep the time buffer and lidar_buffer aligned when a frame has few points and we discard the points of this frame.Is there should add "time_buffer.pop_front()" below the lidar_buffer.pop_front() line?

xuankuzcr commented 1 year ago

Hello,

Based on the code you provided, it seems that the sync_package() function discards lidar points and tries to keep the image buffer and lidar buffer synchronized when the number of lidar points in the current measurement is less than or equal to 1. In this case, it may be necessary to remove the corresponding timestamp from the time buffer to ensure that the timestamps stay aligned with the data. Therefore, adding a time_buffer.pop_front() after the lidar_buffer.pop_front() line might be necessary.

PengKunPROO commented 1 year ago

Ok, thanks for your reply! I will modify it in the program