Skip to content

Stop VIO waiting on the LiDAR buffer in LIVO mode#455

Open
bing8deng wants to merge 1 commit into
hku-mars:mainfrom
bing8deng:fix-livo-vio-gate-wait
Open

Stop VIO waiting on the LiDAR buffer in LIVO mode#455
bing8deng wants to merge 1 commit into
hku-mars:mainfrom
bing8deng:fix-livo-vio-gate-wait

Conversation

@bing8deng

Copy link
Copy Markdown

Problem

sync_packages() rejects every call up front when
lid_raw_data_buffer is empty, before the mode-specific switch
below even runs:

bool LIVMapper::sync_packages(LidarMeasureGroup &meas)
{
  if (lid_raw_data_buffer.empty() && lidar_en) return false;
  ...

In LIVO mode the LIO and VIO steps alternate, and the VIO step
(the case LIO: branch inside the inner switch) never touches
lid_raw_data_buffer at all — it only reads img_buffer and
imu_buffer. Once LIO has drained the LiDAR queue, this one
precondition still forces VIO to stall until the next LiDAR scan
lands, adding pure gate-wait latency before every VIO update with
no benefit. The stall shrinks as LiDAR rate rises (queue refills
sooner) and grows if LiDAR/camera are hardware-synced at a low
rate, which rules out a "sync harder" fix.

Fix

Move the LiDAR-buffer check out of the shared preamble and into
the two switch branches that actually consume the buffer: the
ONLY_LIO case and the LIVO WAIT/VIO case that performs the
LIO step. The LIVO case that performs the VIO step is left
without the check, since it has no dependency on
lid_raw_data_buffer.

Impact

Measured on our platforms this removes on the order of tens of
milliseconds of gate wait per VIO update at 10 Hz LiDAR input.
No behavior change for ONLY_LIO/ONLY_LO modes or for the LIO
half of LIVO mode.

sync_packages() rejects every call up front when
lid_raw_data_buffer is empty, before the mode-specific switch
below even runs. In LIVO mode the LIO and VIO steps alternate,
and the VIO step never touches lid_raw_data_buffer at all - it
only reads img_buffer and imu_buffer. Once LIO has drained the
LiDAR queue, that lone precondition still forces VIO to stall
until the next LiDAR scan lands, adding tens of milliseconds of
pure gate wait before every VIO update with no benefit.

Move the LiDAR-buffer check out of the shared preamble and into
the two switch branches that actually consume the buffer: the
ONLY_LIO case and the LIVO WAIT/VIO case that performs the LIO
step. The LIVO case that performs the VIO step is left without
the check, since it has no dependency on lid_raw_data_buffer.

Measured on our platforms this removes on the order of 30 ms of
gate wait per VIO update at 10 Hz LiDAR input, with the effect
shrinking as LiDAR rate rises and the queue refills sooner.

Signed-off-by: Deng, Bing <[email protected]>
@bing8deng

Copy link
Copy Markdown
Author

@xuankuzcr @XW-HKU Could you please review this patch?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant