diff --git a/cartographer/mapping/proto/scan_matching_progress.proto b/cartographer/mapping/proto/scan_matching_progress.proto deleted file mode 100644 index 301ac18..0000000 --- a/cartographer/mapping/proto/scan_matching_progress.proto +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2016 The Cartographer Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto2"; - -package cartographer.mapping.proto; - -// This is how proto2 calls the outer class since there is already a message -// with the same name in the file. -option java_outer_classname = "ScanMatchingProgressOuterClass"; - -message ScanMatchingProgress { - optional int64 num_scans_finished = 1; - optional int64 num_scans_total = 2; -} diff --git a/cartographer/mapping/sparse_pose_graph.h b/cartographer/mapping/sparse_pose_graph.h index 2b46988..c44bf6b 100644 --- a/cartographer/mapping/sparse_pose_graph.h +++ b/cartographer/mapping/sparse_pose_graph.h @@ -23,7 +23,6 @@ #include #include "cartographer/common/lua_parameter_dictionary.h" -#include "cartographer/mapping/proto/scan_matching_progress.pb.h" #include "cartographer/mapping/proto/sparse_pose_graph.pb.h" #include "cartographer/mapping/proto/sparse_pose_graph_options.pb.h" #include "cartographer/mapping/submaps.h" @@ -106,12 +105,6 @@ class SparsePoseGraph { // Computes optimized poses. virtual void RunFinalOptimization() = 0; - // Will once return true whenever new optimized poses are available. - virtual bool HasNewOptimizedPoses() = 0; - - // Returns the scan matching progress. - virtual proto::ScanMatchingProgress GetScanMatchingProgress() = 0; - // Get the current trajectory clusters. virtual std::vector> GetConnectedTrajectories() = 0; @@ -129,15 +122,16 @@ class SparsePoseGraph { // Returns the current optimized trajectory. virtual std::vector GetTrajectoryNodes() = 0; + // Serializes the constraints and trajectories. + proto::SparsePoseGraph ToProto(); + + protected: // TODO(macmason, wohe): Consider replacing this with a GroupSubmapStates, // which would have better separation of concerns. virtual std::vector GetSubmapStates() = 0; // Returns the collection of constraints. virtual std::vector constraints() = 0; - - // Serializes the constraints and trajectories. - proto::SparsePoseGraph ToProto(); }; // Like TrajectoryNodes, SubmapStates arrive in a flat vector, but need to be diff --git a/cartographer/mapping_2d/sparse_pose_graph.cc b/cartographer/mapping_2d/sparse_pose_graph.cc index fddcfb5..3d87be3 100644 --- a/cartographer/mapping_2d/sparse_pose_graph.cc +++ b/cartographer/mapping_2d/sparse_pose_graph.cc @@ -30,7 +30,6 @@ #include "Eigen/Eigenvalues" #include "cartographer/common/make_unique.h" #include "cartographer/common/math.h" -#include "cartographer/mapping/proto/scan_matching_progress.pb.h" #include "cartographer/mapping/sparse_pose_graph/proto/constraint_builder_options.pb.h" #include "cartographer/sensor/compressed_point_cloud.h" #include "cartographer/sensor/voxel_filter.h" @@ -336,7 +335,6 @@ void SparsePoseGraph::RunOptimization() { if (!submap_transforms_.empty()) { optimization_problem_.Solve(constraints_, &submap_transforms_); common::MutexLocker locker(&mutex_); - has_new_optimized_poses_ = true; const auto& node_data = optimization_problem_.node_data(); const size_t num_optimized_poses = node_data.size(); @@ -373,24 +371,6 @@ void SparsePoseGraph::RunOptimization() { } } -bool SparsePoseGraph::HasNewOptimizedPoses() { - common::MutexLocker locker(&mutex_); - if (!has_new_optimized_poses_) { - return false; - } - has_new_optimized_poses_ = false; - return true; -} - -mapping::proto::ScanMatchingProgress -SparsePoseGraph::GetScanMatchingProgress() { - mapping::proto::ScanMatchingProgress progress; - common::MutexLocker locker(&mutex_); - progress.set_num_scans_total(trajectory_nodes_.size()); - progress.set_num_scans_finished(constraint_builder_.GetNumFinishedScans()); - return progress; -} - std::vector SparsePoseGraph::GetTrajectoryNodes() { common::MutexLocker locker(&mutex_); return trajectory_nodes_; diff --git a/cartographer/mapping_2d/sparse_pose_graph.h b/cartographer/mapping_2d/sparse_pose_graph.h index fc0af6e..531542c 100644 --- a/cartographer/mapping_2d/sparse_pose_graph.h +++ b/cartographer/mapping_2d/sparse_pose_graph.h @@ -41,7 +41,6 @@ #include "cartographer/common/thread_pool.h" #include "cartographer/common/time.h" #include "cartographer/kalman_filter/pose_tracker.h" -#include "cartographer/mapping/proto/scan_matching_progress.pb.h" #include "cartographer/mapping/sparse_pose_graph.h" #include "cartographer/mapping/trajectory_connectivity.h" #include "cartographer/mapping_2d/sparse_pose_graph/constraint_builder.h" @@ -86,8 +85,6 @@ class SparsePoseGraph : public mapping::SparsePoseGraph { const Eigen::Vector3d& angular_velocity); void RunFinalOptimization() override; - bool HasNewOptimizedPoses() override; - mapping::proto::ScanMatchingProgress GetScanMatchingProgress() override; std::vector> GetConnectedTrajectories() override; std::vector GetSubmapTransforms( @@ -179,9 +176,6 @@ class SparsePoseGraph : public mapping::SparsePoseGraph { std::map submap_indices_ GUARDED_BY(mutex_); std::vector submap_states_ GUARDED_BY(mutex_); - // Whether to return true on the next call to HasNewOptimizedPoses(). - bool has_new_optimized_poses_ GUARDED_BY(mutex_) = false; - // Connectivity structure of our trajectories. std::vector> connected_components_; // Trajectory to connected component ID. diff --git a/cartographer/mapping_3d/sparse_pose_graph.cc b/cartographer/mapping_3d/sparse_pose_graph.cc index 36da741..8f2b5a9 100644 --- a/cartographer/mapping_3d/sparse_pose_graph.cc +++ b/cartographer/mapping_3d/sparse_pose_graph.cc @@ -30,7 +30,6 @@ #include "Eigen/Eigenvalues" #include "cartographer/common/make_unique.h" #include "cartographer/common/math.h" -#include "cartographer/mapping/proto/scan_matching_progress.pb.h" #include "cartographer/mapping/sparse_pose_graph/proto/constraint_builder_options.pb.h" #include "cartographer/sensor/compressed_point_cloud.h" #include "cartographer/sensor/voxel_filter.h" @@ -331,7 +330,6 @@ void SparsePoseGraph::RunOptimization() { if (!submap_transforms_.empty()) { optimization_problem_.Solve(constraints_, &submap_transforms_); common::MutexLocker locker(&mutex_); - has_new_optimized_poses_ = true; const auto& node_data = optimization_problem_.node_data(); const size_t num_optimized_poses = node_data.size(); @@ -367,24 +365,6 @@ void SparsePoseGraph::RunOptimization() { } } -bool SparsePoseGraph::HasNewOptimizedPoses() { - common::MutexLocker locker(&mutex_); - if (!has_new_optimized_poses_) { - return false; - } - has_new_optimized_poses_ = false; - return true; -} - -mapping::proto::ScanMatchingProgress -SparsePoseGraph::GetScanMatchingProgress() { - mapping::proto::ScanMatchingProgress progress; - common::MutexLocker locker(&mutex_); - progress.set_num_scans_total(trajectory_nodes_.size()); - progress.set_num_scans_finished(constraint_builder_.GetNumFinishedScans()); - return progress; -} - std::vector SparsePoseGraph::GetTrajectoryNodes() { common::MutexLocker locker(&mutex_); return trajectory_nodes_; diff --git a/cartographer/mapping_3d/sparse_pose_graph.h b/cartographer/mapping_3d/sparse_pose_graph.h index 99c3f5b..b042cb1 100644 --- a/cartographer/mapping_3d/sparse_pose_graph.h +++ b/cartographer/mapping_3d/sparse_pose_graph.h @@ -41,7 +41,6 @@ #include "cartographer/common/thread_pool.h" #include "cartographer/common/time.h" #include "cartographer/kalman_filter/pose_tracker.h" -#include "cartographer/mapping/proto/scan_matching_progress.pb.h" #include "cartographer/mapping/sparse_pose_graph.h" #include "cartographer/mapping/trajectory_connectivity.h" #include "cartographer/mapping_3d/sparse_pose_graph/constraint_builder.h" @@ -88,8 +87,6 @@ class SparsePoseGraph : public mapping::SparsePoseGraph { const Eigen::Vector3d& angular_velocity); void RunFinalOptimization() override; - bool HasNewOptimizedPoses() override; - mapping::proto::ScanMatchingProgress GetScanMatchingProgress() override; std::vector> GetConnectedTrajectories() override; std::vector GetSubmapTransforms( @@ -199,9 +196,6 @@ class SparsePoseGraph : public mapping::SparsePoseGraph { std::map submap_indices_ GUARDED_BY(mutex_); std::vector submap_states_ GUARDED_BY(mutex_); - // Whether to return true on the next call to HasNewOptimizedPoses(). - bool has_new_optimized_poses_ GUARDED_BY(mutex_) = false; - // Connectivity structure of our trajectories. std::vector> connected_components_; // Trajectory to connected component ID.