removed unused member matching_submap_index (ActiveSubmaps3D,ActiveSubmaps2D) (#1238)

Removed the unused member matching_submap_index of ActiveSubmaps3D and ActiveSubmaps2D.
Adjusted the test accordingly.
master
Martin Schwörer 2018-07-06 11:48:25 +02:00 committed by Wally B. Feed
parent 902459e95c
commit 044f53735c
7 changed files with 4 additions and 18 deletions

View File

@ -137,8 +137,6 @@ std::vector<std::shared_ptr<Submap2D>> ActiveSubmaps2D::submaps() const {
return submaps_; return submaps_;
} }
int ActiveSubmaps2D::matching_index() const { return matching_submap_index_; }
void ActiveSubmaps2D::InsertRangeData(const sensor::RangeData& range_data) { void ActiveSubmaps2D::InsertRangeData(const sensor::RangeData& range_data) {
for (auto& submap : submaps_) { for (auto& submap : submaps_) {
submap->InsertRangeData(range_data, range_data_inserter_.get()); submap->InsertRangeData(range_data, range_data_inserter_.get());
@ -169,7 +167,6 @@ std::unique_ptr<GridInterface> ActiveSubmaps2D::CreateGrid(
void ActiveSubmaps2D::FinishSubmap() { void ActiveSubmaps2D::FinishSubmap() {
Submap2D* submap = submaps_.front().get(); Submap2D* submap = submaps_.front().get();
submap->Finish(); submap->Finish();
++matching_submap_index_;
submaps_.erase(submaps_.begin()); submaps_.erase(submaps_.begin());
} }
@ -183,7 +180,6 @@ void ActiveSubmaps2D::AddSubmap(const Eigen::Vector2f& origin) {
submaps_.push_back(common::make_unique<Submap2D>( submaps_.push_back(common::make_unique<Submap2D>(
origin, std::unique_ptr<Grid2D>( origin, std::unique_ptr<Grid2D>(
static_cast<Grid2D*>(CreateGrid(origin).release())))); static_cast<Grid2D*>(CreateGrid(origin).release()))));
LOG(INFO) << "Added submap " << matching_submap_index_ + submaps_.size();
} }
} // namespace mapping } // namespace mapping

View File

@ -79,10 +79,6 @@ class ActiveSubmaps2D {
ActiveSubmaps2D(const ActiveSubmaps2D&) = delete; ActiveSubmaps2D(const ActiveSubmaps2D&) = delete;
ActiveSubmaps2D& operator=(const ActiveSubmaps2D&) = delete; ActiveSubmaps2D& operator=(const ActiveSubmaps2D&) = delete;
// Returns the index of the newest initialized Submap which can be
// used for scan-to-map matching.
int matching_index() const;
// Inserts 'range_data' into the Submap collection. // Inserts 'range_data' into the Submap collection.
void InsertRangeData(const sensor::RangeData& range_data); void InsertRangeData(const sensor::RangeData& range_data);
@ -95,7 +91,6 @@ class ActiveSubmaps2D {
void AddSubmap(const Eigen::Vector2f& origin); void AddSubmap(const Eigen::Vector2f& origin);
const proto::SubmapsOptions2D options_; const proto::SubmapsOptions2D options_;
int matching_submap_index_ = 0;
std::vector<std::shared_ptr<Submap2D>> submaps_; std::vector<std::shared_ptr<Submap2D>> submaps_;
std::unique_ptr<RangeDataInserterInterface> range_data_inserter_; std::unique_ptr<RangeDataInserterInterface> range_data_inserter_;
}; };

View File

@ -61,10 +61,11 @@ TEST(Submap2DTest, TheRightNumberOfRangeDataAreInserted) {
for (const auto& submap : submaps.submaps()) { for (const auto& submap : submaps.submaps()) {
all_submaps.insert(submap); all_submaps.insert(submap);
} }
if (submaps.matching_index() != 0) { if (submaps.submaps().size() > 1) {
EXPECT_LE(kNumRangeData, submaps.submaps().front()->num_range_data()); EXPECT_LE(kNumRangeData, submaps.submaps().front()->num_range_data());
} }
} }
EXPECT_EQ(2, submaps.submaps().size());
int correct_num_range_data = 0; int correct_num_range_data = 0;
for (const auto& submap : all_submaps) { for (const auto& submap : all_submaps) {
if (submap->num_range_data() == kNumRangeData * 2) { if (submap->num_range_data() == kNumRangeData * 2) {

View File

@ -294,8 +294,6 @@ std::vector<std::shared_ptr<Submap3D>> ActiveSubmaps3D::submaps() const {
return submaps_; return submaps_;
} }
int ActiveSubmaps3D::matching_index() const { return matching_submap_index_; }
void ActiveSubmaps3D::InsertRangeData( void ActiveSubmaps3D::InsertRangeData(
const sensor::RangeData& range_data, const sensor::RangeData& range_data,
const Eigen::Quaterniond& gravity_alignment) { const Eigen::Quaterniond& gravity_alignment) {
@ -312,13 +310,11 @@ void ActiveSubmaps3D::InsertRangeData(
void ActiveSubmaps3D::AddSubmap(const transform::Rigid3d& local_submap_pose) { void ActiveSubmaps3D::AddSubmap(const transform::Rigid3d& local_submap_pose) {
if (submaps_.size() > 1) { if (submaps_.size() > 1) {
submaps_.front()->Finish(); submaps_.front()->Finish();
++matching_submap_index_;
submaps_.erase(submaps_.begin()); submaps_.erase(submaps_.begin());
} }
submaps_.emplace_back(new Submap3D(options_.high_resolution(), submaps_.emplace_back(new Submap3D(options_.high_resolution(),
options_.low_resolution(), options_.low_resolution(),
local_submap_pose)); local_submap_pose));
LOG(INFO) << "Added submap " << matching_submap_index_ + submaps_.size();
} }
} // namespace mapping } // namespace mapping

View File

@ -88,10 +88,6 @@ class ActiveSubmaps3D {
ActiveSubmaps3D(const ActiveSubmaps3D&) = delete; ActiveSubmaps3D(const ActiveSubmaps3D&) = delete;
ActiveSubmaps3D& operator=(const ActiveSubmaps3D&) = delete; ActiveSubmaps3D& operator=(const ActiveSubmaps3D&) = delete;
// Returns the index of the newest initialized Submap which can be
// used for scan-to-map matching.
int matching_index() const;
// Inserts 'range_data' into the Submap collection. 'gravity_alignment' is // Inserts 'range_data' into the Submap collection. 'gravity_alignment' is
// used for the orientation of new submaps so that the z axis approximately // used for the orientation of new submaps so that the z axis approximately
// aligns with gravity. // aligns with gravity.

View File

@ -131,6 +131,7 @@ NodeId PoseGraph2D::AddNode(
const SubmapId submap_id = const SubmapId submap_id =
data_.submap_data.Append(trajectory_id, InternalSubmapData()); data_.submap_data.Append(trajectory_id, InternalSubmapData());
data_.submap_data.at(submap_id).submap = insertion_submaps.back(); data_.submap_data.at(submap_id).submap = insertion_submaps.back();
LOG(INFO) << "Inserted submap " << submap_id << ".";
} }
// We have to check this here, because it might have changed by the time we // We have to check this here, because it might have changed by the time we

View File

@ -129,6 +129,7 @@ NodeId PoseGraph3D::AddNode(
const SubmapId submap_id = const SubmapId submap_id =
data_.submap_data.Append(trajectory_id, InternalSubmapData()); data_.submap_data.Append(trajectory_id, InternalSubmapData());
data_.submap_data.at(submap_id).submap = insertion_submaps.back(); data_.submap_data.at(submap_id).submap = insertion_submaps.back();
LOG(INFO) << "Inserted submap " << submap_id << ".";
} }
// We have to check this here, because it might have changed by the time we // We have to check this here, because it might have changed by the time we