From 6708930bbfcbadb4f1048c44372d3bdfbe55b063 Mon Sep 17 00:00:00 2001 From: Holger Rapp Date: Fri, 6 Oct 2017 13:21:02 +0200 Subject: [PATCH] Adds 'offset_seconds' to PointCloudWithIntensities. (#571) This is preparing using per-point-unwarping in the `assets_writer` in `cartographer_ros`. Related to googlecartographer/cartographer_ros#521. PAIR=@wohe --- cartographer/io/points_batch.h | 6 +++--- cartographer/io/xray_points_processor.cc | 2 +- cartographer/sensor/point_cloud.h | 5 +++++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/cartographer/io/points_batch.h b/cartographer/io/points_batch.h index e57ed9f..7a068bf 100644 --- a/cartographer/io/points_batch.h +++ b/cartographer/io/points_batch.h @@ -36,8 +36,8 @@ struct PointsBatch { trajectory_id = 0; } - // Time at which this batch has been acquired. - common::Time time; + // Time at which the first point of this batch has been acquired. + common::Time start_time; // Origin of the data, i.e. the location of the sensor in the world at // 'time'. @@ -50,7 +50,7 @@ struct PointsBatch { // Trajectory ID that produced this point. int trajectory_id; - // Geometry of the points in a metric frame. + // Geometry of the points in the map frame. std::vector points; // Intensities are optional and may be unspecified. The meaning of these diff --git a/cartographer/io/xray_points_processor.cc b/cartographer/io/xray_points_processor.cc index 7779271..8b8dcc3 100644 --- a/cartographer/io/xray_points_processor.cc +++ b/cartographer/io/xray_points_processor.cc @@ -216,7 +216,7 @@ void XRayPointsProcessor::Process(std::unique_ptr batch) { Insert(*batch, &aggregations_[0]); } else { for (size_t i = 0; i < floors_.size(); ++i) { - if (!ContainedIn(batch->time, floors_[i].timespans)) { + if (!ContainedIn(batch->start_time, floors_[i].timespans)) { continue; } Insert(*batch, &aggregations_[i]); diff --git a/cartographer/sensor/point_cloud.h b/cartographer/sensor/point_cloud.h index c2801e2..1824782 100644 --- a/cartographer/sensor/point_cloud.h +++ b/cartographer/sensor/point_cloud.h @@ -32,6 +32,11 @@ typedef std::vector PointCloud; struct PointCloudWithIntensities { PointCloud points; std::vector intensities; + + // For each item in 'points', contains the time delta of when it was acquired + // after points[0], i.e. the first entry is always 0.f. If timing + // information is not available all entries will be 0.f. + std::vector offset_seconds; }; // Transforms 'point_cloud' according to 'transform'.