Rename the setters according to style-guide. (#1032)

just a nit
master
Alexander Belyaev 2018-04-03 18:56:44 +02:00 committed by Wally B. Feed
parent e8b0bfb285
commit 41fc7e38cc
4 changed files with 18 additions and 20 deletions

View File

@ -97,7 +97,7 @@ std::shared_ptr<mapping::Submap2D> MapBuilderContext::UpdateSubmap2D(
} else { } else {
// If the submap is unfinished set the 'num_range_data' to 0 since we // If the submap is unfinished set the 'num_range_data' to 0 since we
// haven't changed the HybridGrid. // haven't changed the HybridGrid.
submap_2d_ptr->SetNumRangeData(0); submap_2d_ptr->set_num_range_data(0);
} }
} }
return submap_2d_ptr; return submap_2d_ptr;
@ -131,7 +131,7 @@ std::shared_ptr<mapping::Submap3D> MapBuilderContext::UpdateSubmap3D(
} else { } else {
// If the submap is unfinished set the 'num_range_data' to 0 since we // If the submap is unfinished set the 'num_range_data' to 0 since we
// haven't changed the HybridGrid. // haven't changed the HybridGrid.
submap_3d_ptr->SetNumRangeData(0); submap_3d_ptr->set_num_range_data(0);
} }
} }
return submap_3d_ptr; return submap_3d_ptr;

View File

@ -70,8 +70,8 @@ Submap2D::Submap2D(const MapLimits& limits, const Eigen::Vector2f& origin)
Submap2D::Submap2D(const proto::Submap2D& proto) Submap2D::Submap2D(const proto::Submap2D& proto)
: Submap(transform::ToRigid3(proto.local_pose())), : Submap(transform::ToRigid3(proto.local_pose())),
probability_grid_(ProbabilityGrid(proto.probability_grid())) { probability_grid_(ProbabilityGrid(proto.probability_grid())) {
SetNumRangeData(proto.num_range_data()); set_num_range_data(proto.num_range_data());
SetFinished(proto.finished()); set_finished(proto.finished());
} }
void Submap2D::ToProto(proto::Submap* const proto, void Submap2D::ToProto(proto::Submap* const proto,
@ -88,8 +88,8 @@ void Submap2D::ToProto(proto::Submap* const proto,
void Submap2D::UpdateFromProto(const proto::Submap& proto) { void Submap2D::UpdateFromProto(const proto::Submap& proto) {
CHECK(proto.has_submap_2d()); CHECK(proto.has_submap_2d());
const auto& submap_2d = proto.submap_2d(); const auto& submap_2d = proto.submap_2d();
SetNumRangeData(submap_2d.num_range_data()); set_num_range_data(submap_2d.num_range_data());
SetFinished(submap_2d.finished()); set_finished(submap_2d.finished());
if (submap_2d.has_probability_grid()) { if (submap_2d.has_probability_grid()) {
probability_grid_ = ProbabilityGrid(submap_2d.probability_grid()); probability_grid_ = ProbabilityGrid(submap_2d.probability_grid());
} }
@ -147,13 +147,13 @@ void Submap2D::InsertRangeData(const sensor::RangeData& range_data,
const RangeDataInserter2D& range_data_inserter) { const RangeDataInserter2D& range_data_inserter) {
CHECK(!finished()); CHECK(!finished());
range_data_inserter.Insert(range_data, &probability_grid_); range_data_inserter.Insert(range_data, &probability_grid_);
SetNumRangeData(num_range_data() + 1); set_num_range_data(num_range_data() + 1);
} }
void Submap2D::Finish() { void Submap2D::Finish() {
CHECK(!finished()); CHECK(!finished());
probability_grid_ = ComputeCroppedProbabilityGrid(probability_grid_); probability_grid_ = ComputeCroppedProbabilityGrid(probability_grid_);
SetFinished(true); set_finished(true);
} }
ActiveSubmaps2D::ActiveSubmaps2D(const proto::SubmapsOptions2D& options) ActiveSubmaps2D::ActiveSubmaps2D(const proto::SubmapsOptions2D& options)

View File

@ -209,8 +209,8 @@ Submap3D::Submap3D(const proto::Submap3D& proto)
common::make_unique<HybridGrid>(proto.high_resolution_hybrid_grid())), common::make_unique<HybridGrid>(proto.high_resolution_hybrid_grid())),
low_resolution_hybrid_grid_( low_resolution_hybrid_grid_(
common::make_unique<HybridGrid>(proto.low_resolution_hybrid_grid())) { common::make_unique<HybridGrid>(proto.low_resolution_hybrid_grid())) {
SetNumRangeData(proto.num_range_data()); set_num_range_data(proto.num_range_data());
SetFinished(proto.finished()); set_finished(proto.finished());
} }
void Submap3D::ToProto(proto::Submap* const proto, void Submap3D::ToProto(proto::Submap* const proto,
@ -230,8 +230,8 @@ void Submap3D::ToProto(proto::Submap* const proto,
void Submap3D::UpdateFromProto(const proto::Submap& proto) { void Submap3D::UpdateFromProto(const proto::Submap& proto) {
CHECK(proto.has_submap_3d()); CHECK(proto.has_submap_3d());
const auto& submap_3d = proto.submap_3d(); const auto& submap_3d = proto.submap_3d();
SetNumRangeData(submap_3d.num_range_data()); set_num_range_data(submap_3d.num_range_data());
SetFinished(submap_3d.finished()); set_finished(submap_3d.finished());
if (submap_3d.has_high_resolution_hybrid_grid()) { if (submap_3d.has_high_resolution_hybrid_grid()) {
high_resolution_hybrid_grid_ = high_resolution_hybrid_grid_ =
submap_3d.has_high_resolution_hybrid_grid() submap_3d.has_high_resolution_hybrid_grid()
@ -271,12 +271,12 @@ void Submap3D::InsertRangeData(const sensor::RangeData& range_data,
high_resolution_hybrid_grid_.get()); high_resolution_hybrid_grid_.get());
range_data_inserter.Insert(transformed_range_data, range_data_inserter.Insert(transformed_range_data,
low_resolution_hybrid_grid_.get()); low_resolution_hybrid_grid_.get());
SetNumRangeData(num_range_data() + 1); set_num_range_data(num_range_data() + 1);
} }
void Submap3D::Finish() { void Submap3D::Finish() {
CHECK(!finished()); CHECK(!finished());
SetFinished(true); set_finished(true);
} }
ActiveSubmaps3D::ActiveSubmaps3D(const proto::SubmapsOptions3D& options) ActiveSubmaps3D::ActiveSubmaps3D(const proto::SubmapsOptions3D& options)

View File

@ -76,15 +76,13 @@ class Submap {
// Number of RangeData inserted. // Number of RangeData inserted.
int num_range_data() const { return num_range_data_; } int num_range_data() const { return num_range_data_; }
void set_num_range_data(const int num_range_data) {
// Whether the submap is finished or not.
bool finished() const { return finished_; }
void SetNumRangeData(const int num_range_data) {
num_range_data_ = num_range_data; num_range_data_ = num_range_data;
} }
void SetFinished(bool finished) { finished_ = finished; } // Whether the submap is finished or not.
bool finished() const { return finished_; }
void set_finished(bool finished) { finished_ = finished; }
private: private:
const transform::Rigid3d local_pose_; const transform::Rigid3d local_pose_;