Initialize RangeData in TSDF tests. (#1520)

* Explicitly initialize RangeData.

* Use auto to remove redundancy.

* Ran clang-format.
master
Kevin Daun 2019-02-13 15:40:37 +01:00 committed by Andre Gaschler
parent 2adeb1f3be
commit d7b4656741
3 changed files with 7 additions and 7 deletions

View File

@ -48,7 +48,7 @@ class RangeDataInserterTest2DTSDF : public ::testing::Test {
} }
void InsertPoint() { void InsertPoint() {
sensor::RangeData range_data; auto range_data = sensor::RangeData();
range_data.returns.push_back({Eigen::Vector3f{-0.5f, 3.5f, 0.f}}); range_data.returns.push_back({Eigen::Vector3f{-0.5f, 3.5f, 0.f}});
range_data.origin.x() = -0.5f; range_data.origin.x() = -0.5f;
range_data.origin.y() = -0.5f; range_data.origin.y() = -0.5f;
@ -236,7 +236,7 @@ TEST_F(RangeDataInserterTest2DTSDF, InsertPointQuadraticWeight) {
TEST_F(RangeDataInserterTest2DTSDF, TEST_F(RangeDataInserterTest2DTSDF,
InsertSmallAnglePointWithoutNormalProjection) { InsertSmallAnglePointWithoutNormalProjection) {
sensor::RangeData range_data; auto range_data = sensor::RangeData();
range_data.returns.push_back({Eigen::Vector3f{-0.5f, 3.5f, 0.f}}); range_data.returns.push_back({Eigen::Vector3f{-0.5f, 3.5f, 0.f}});
range_data.returns.push_back({Eigen::Vector3f{5.5f, 3.5f, 0.f}}); range_data.returns.push_back({Eigen::Vector3f{5.5f, 3.5f, 0.f}});
range_data.returns.push_back({Eigen::Vector3f{10.5f, 3.5f, 0.f}}); range_data.returns.push_back({Eigen::Vector3f{10.5f, 3.5f, 0.f}});
@ -263,7 +263,7 @@ TEST_F(RangeDataInserterTest2DTSDF,
TEST_F(RangeDataInserterTest2DTSDF, InsertSmallAnglePointWitNormalProjection) { TEST_F(RangeDataInserterTest2DTSDF, InsertSmallAnglePointWitNormalProjection) {
options_.set_project_sdf_distance_to_scan_normal(true); options_.set_project_sdf_distance_to_scan_normal(true);
range_data_inserter_ = absl::make_unique<TSDFRangeDataInserter2D>(options_); range_data_inserter_ = absl::make_unique<TSDFRangeDataInserter2D>(options_);
sensor::RangeData range_data; auto range_data = sensor::RangeData();
range_data.returns.push_back({Eigen::Vector3f{-0.5f, 3.5f, 0.f}}); range_data.returns.push_back({Eigen::Vector3f{-0.5f, 3.5f, 0.f}});
range_data.returns.push_back({Eigen::Vector3f{5.5f, 3.5f, 0.f}}); range_data.returns.push_back({Eigen::Vector3f{5.5f, 3.5f, 0.f}});
range_data.origin.x() = -0.5f; range_data.origin.x() = -0.5f;
@ -293,7 +293,7 @@ TEST_F(RangeDataInserterTest2DTSDF,
options_.set_update_weight_angle_scan_normal_to_ray_kernel_bandwidth( options_.set_update_weight_angle_scan_normal_to_ray_kernel_bandwidth(
bandwidth); bandwidth);
range_data_inserter_ = absl::make_unique<TSDFRangeDataInserter2D>(options_); range_data_inserter_ = absl::make_unique<TSDFRangeDataInserter2D>(options_);
sensor::RangeData range_data; auto range_data = sensor::RangeData();
range_data.returns.push_back({Eigen::Vector3f{-0.5f, 3.5f, 0.f}}); range_data.returns.push_back({Eigen::Vector3f{-0.5f, 3.5f, 0.f}});
range_data.returns.push_back({Eigen::Vector3f{5.5f, 3.5f, 0.f}}); range_data.returns.push_back({Eigen::Vector3f{5.5f, 3.5f, 0.f}});
range_data.origin.x() = -0.5f; range_data.origin.x() = -0.5f;

View File

@ -56,7 +56,7 @@ class TSDFSpaceCostFunction2DTest : public ::testing::Test {
} }
void InsertPointcloud() { void InsertPointcloud() {
sensor::RangeData range_data; auto range_data = sensor::RangeData();
for (float x = -.5; x < 0.5f; x += 0.1) { for (float x = -.5; x < 0.5f; x += 0.1) {
range_data.returns.push_back({Eigen::Vector3f{x, 1.0f, 0.f}}); range_data.returns.push_back({Eigen::Vector3f{x, 1.0f, 0.f}});
} }

View File

@ -61,8 +61,8 @@ RangefinderPoint CompressedPointCloud::ConstIterator::operator*() const {
return {current_point_}; return {current_point_};
} }
CompressedPointCloud::ConstIterator& CompressedPointCloud::ConstIterator:: CompressedPointCloud::ConstIterator&
operator++() { CompressedPointCloud::ConstIterator::operator++() {
--remaining_points_; --remaining_points_;
if (remaining_points_ > 0) { if (remaining_points_ > 0) {
ReadNextPoint(); ReadNextPoint();