LivoxIntegration icon indicating copy to clipboard operation
LivoxIntegration copied to clipboard

Problem about sync

Open LitoNeo opened this issue 5 years ago • 1 comments

Hello, I want to know, if it means that I have to write the code to fuse GPS-time and Livox-data-time myself? Or the code exists somewhere?

LitoNeo avatar Nov 29 '19 14:11 LitoNeo

Here is the pseudocode to achieve this synchronization:

// GPS Time Synchronization
static uint64_t LiDAR_time_last;
static uint64_t LiDAR_time_real;

// 1. Read total second of the UTC time, Unit is second.
uint32_t gps_time_s = get_gps_utc_second();
// 2. Read LiDAR point time, Unit is nanosecond.
uint64_t LiDAR_time = get_LiDAR_pack_time();
// 3. Update real time.
if (LiDAR_time < LiDAR_time_last)
{
    //LiDAR time jump indicates the generation of GPS pulse.
    LiDAR_time_real = gps_time_s*(1e9) + LiDAR_time%(1000000000);
}
else
{
    LiDAR_time_real += LiDAR_time - LiDAR_time_last;
}
//Update history
LiDAR_time_last = LiDAR_time;

Livox-SDK avatar Feb 10 '20 08:02 Livox-SDK