Skip to content

Commit

Permalink
Mulran: fix synchronization of GPS observations
Browse files Browse the repository at this point in the history
  • Loading branch information
jlblancoc committed Feb 9, 2024
1 parent 4e55ff8 commit 2a1c56d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
1 change: 1 addition & 0 deletions mola_demos/mola-cli-launchs/mulran_just_replay.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ modules:
time_warp_scale: 1.0
publish_lidar: true
publish_ground_truth: true
#lidar_to_ground_truth_1to1: false

# =====================
# MolaViz
Expand Down
30 changes: 13 additions & 17 deletions mola_input_mulran_dataset/src/MulranDataset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,21 +108,6 @@ void MulranDataset::initialize(const Yaml& c)

MRPT_LOG_INFO_STREAM("Ouster pointclouds: " << lstPointCloudFiles_.size());

// Extract timestamp from filename:
// 1702378966.xxx
// 1561000444390857630.bin
//
// => Filenames are nanoseconds since UNIX epoch.
for (size_t i = 0; i < lstPointCloudFiles_.size(); i++)
{
// nanoseconds -> seconds
const double t = LidarFileNameToTimestamp(lstPointCloudFiles_[i]);

const Entry entry = {EntryType::Lidar, i};

datasetEntries_.emplace(t, entry);
}

// Load sensors calibration:
const double T_lidar_to_base_data[4 * 4] = {
-9.9998295e-01, -5.8398386e-03, -5.2257060e-06, 1.7042000e00, //
Expand Down Expand Up @@ -214,7 +199,6 @@ void MulranDataset::initialize(const Yaml& c)

std::vector<timestep_t> lidarIdxsToRemove;

// for (size_t i = 0; i < datasetEntries_.size(); i++)
for (const auto& [t, e] : datasetEntries_)
{
if (e.type != EntryType::Lidar) continue;
Expand All @@ -238,8 +222,12 @@ void MulranDataset::initialize(const Yaml& c)
datasetEntries_.emplace(t, entry);
}

for (const timestep_t idx : lidarIdxsToRemove)
// remove in reverse order!
for (auto it = lidarIdxsToRemove.rbegin();
it != lidarIdxsToRemove.rend(); ++it)
{
auto idx = *it;

lstPointCloudFiles_.erase(
std::next(lstPointCloudFiles_.begin(), idx));
}
Expand All @@ -257,6 +245,14 @@ void MulranDataset::initialize(const Yaml& c)
}
}

for (size_t i = 0; i < lstPointCloudFiles_.size(); i++)
{
// nanoseconds -> seconds
const double t = LidarFileNameToTimestamp(lstPointCloudFiles_[i]);
const Entry entry = {EntryType::Lidar, i};
datasetEntries_.emplace(t, entry);
}

replay_next_it_ = datasetEntries_.begin();
initialized_ = true;

Expand Down

0 comments on commit 2a1c56d

Please sign in to comment.