Remove unused concept of CompressedRangeData. (#604)
parent
e479382ecc
commit
0c9f2c4f65
|
@ -33,13 +33,6 @@ message ImuData {
|
||||||
optional transform.proto.Vector3d angular_velocity = 3;
|
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.
|
// Proto representation of ::cartographer::sensor::OdometryData.
|
||||||
message OdometryData {
|
message OdometryData {
|
||||||
optional int64 timestamp = 1;
|
optional int64 timestamp = 1;
|
||||||
|
|
|
@ -37,36 +37,5 @@ RangeData CropRangeData(const RangeData& range_data, const float min_z,
|
||||||
Crop(range_data.misses, min_z, max_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 sensor
|
||||||
} // namespace cartographer
|
} // namespace cartographer
|
||||||
|
|
|
@ -41,21 +41,6 @@ RangeData TransformRangeData(const RangeData& range_data,
|
||||||
// Crops 'range_data' according to the region defined by 'min_z' and 'max_z'.
|
// 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);
|
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 sensor
|
||||||
} // namespace cartographer
|
} // namespace cartographer
|
||||||
|
|
||||||
|
|
|
@ -48,31 +48,6 @@ class RangeDataTest : public ::testing::Test {
|
||||||
std::vector<Eigen::Vector3f> misses_;
|
std::vector<Eigen::Vector3f> 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
|
||||||
} // namespace sensor
|
} // namespace sensor
|
||||||
} // namespace cartographer
|
} // namespace cartographer
|
||||||
|
|
Loading…
Reference in New Issue