From 0c9f2c4f65e74978b6db9e28b11d9ea9ea51647e Mon Sep 17 00:00:00 2001 From: Holger Rapp Date: Thu, 19 Oct 2017 11:19:56 +0200 Subject: [PATCH] Remove unused concept of CompressedRangeData. (#604) --- cartographer/sensor/proto/sensor.proto | 7 ------ cartographer/sensor/range_data.cc | 31 -------------------------- cartographer/sensor/range_data.h | 15 ------------- cartographer/sensor/range_data_test.cc | 25 --------------------- 4 files changed, 78 deletions(-) diff --git a/cartographer/sensor/proto/sensor.proto b/cartographer/sensor/proto/sensor.proto index eb6b0bd..c51ba33 100644 --- a/cartographer/sensor/proto/sensor.proto +++ b/cartographer/sensor/proto/sensor.proto @@ -33,13 +33,6 @@ message ImuData { optional transform.proto.Vector3d angular_velocity = 3; } -// Proto representation of ::cartographer::sensor::CompressedRangeData. -message CompressedRangeData { - optional transform.proto.Vector3f origin = 1; - optional CompressedPointCloud returns = 2; - optional CompressedPointCloud misses = 3; -} - // Proto representation of ::cartographer::sensor::OdometryData. message OdometryData { optional int64 timestamp = 1; diff --git a/cartographer/sensor/range_data.cc b/cartographer/sensor/range_data.cc index 9c2a94b..3bb58b1 100644 --- a/cartographer/sensor/range_data.cc +++ b/cartographer/sensor/range_data.cc @@ -37,36 +37,5 @@ RangeData CropRangeData(const RangeData& range_data, const float min_z, Crop(range_data.misses, min_z, max_z)}; } -proto::CompressedRangeData ToProto( - const CompressedRangeData& compressed_range_data) { - proto::CompressedRangeData proto; - *proto.mutable_origin() = transform::ToProto(compressed_range_data.origin); - *proto.mutable_returns() = compressed_range_data.returns.ToProto(); - *proto.mutable_misses() = compressed_range_data.misses.ToProto(); - return proto; -} - -CompressedRangeData FromProto(const proto::CompressedRangeData& proto) { - return CompressedRangeData{ - transform::ToEigen(proto.origin()), - CompressedPointCloud(proto.returns()), - CompressedPointCloud(proto.misses()), - }; -} - -CompressedRangeData Compress(const RangeData& range_data) { - return CompressedRangeData{ - range_data.origin, - CompressedPointCloud(range_data.returns), - CompressedPointCloud(range_data.misses), - }; -} - -RangeData Decompress(const CompressedRangeData& compressed_range_data) { - return RangeData{compressed_range_data.origin, - compressed_range_data.returns.Decompress(), - compressed_range_data.misses.Decompress()}; -} - } // namespace sensor } // namespace cartographer diff --git a/cartographer/sensor/range_data.h b/cartographer/sensor/range_data.h index 4f069da..26c4b25 100644 --- a/cartographer/sensor/range_data.h +++ b/cartographer/sensor/range_data.h @@ -41,21 +41,6 @@ RangeData TransformRangeData(const RangeData& range_data, // Crops 'range_data' according to the region defined by 'min_z' and 'max_z'. RangeData CropRangeData(const RangeData& range_data, float min_z, float max_z); -// Like RangeData but with compressed point clouds. The point order changes -// when converting from RangeData. -struct CompressedRangeData { - Eigen::Vector3f origin; - CompressedPointCloud returns; - CompressedPointCloud misses; -}; - -proto::CompressedRangeData ToProto( - const CompressedRangeData& compressed_range_data); -CompressedRangeData FromProto(const proto::CompressedRangeData& proto); -CompressedRangeData Compress(const RangeData& range_data); - -RangeData Decompress(const CompressedRangeData& compressed_range_data); - } // namespace sensor } // namespace cartographer diff --git a/cartographer/sensor/range_data_test.cc b/cartographer/sensor/range_data_test.cc index 72d57bf..68cc831 100644 --- a/cartographer/sensor/range_data_test.cc +++ b/cartographer/sensor/range_data_test.cc @@ -48,31 +48,6 @@ class RangeDataTest : public ::testing::Test { std::vector misses_; }; -TEST_F(RangeDataTest, Compression) { - const RangeData expected_data = {origin_, returns_, misses_}; - const RangeData actual_data = Decompress(Compress(expected_data)); - EXPECT_THAT(expected_data.origin, Near(actual_data.origin)); - EXPECT_EQ(3, actual_data.returns.size()); - EXPECT_EQ(1, actual_data.misses.size()); - - // Returns may be reordered, so we compare in an unordered manner. - for (const auto& expected : expected_data.returns) { - EXPECT_THAT(actual_data.returns, Contains(Near(expected))); - } - for (const auto& expected : expected_data.misses) { - EXPECT_THAT(actual_data.misses, Contains(Near(expected))); - } -} - -TEST_F(RangeDataTest, CompressedRangeDataToAndFromProto) { - const auto expected = CompressedRangeData{ - origin_, CompressedPointCloud(returns_), CompressedPointCloud(misses_)}; - const auto actual = FromProto(ToProto(expected)); - EXPECT_THAT(expected.origin, Near(actual.origin)); - EXPECT_EQ(expected.returns, actual.returns); - EXPECT_EQ(expected.misses, actual.misses); -} - } // namespace } // namespace sensor } // namespace cartographer