Make the MotionFilter internal. (#707)

Also moves it from mapping_3d to mapping since it is used
in both 2D and 3D SLAM.

[RFC=0003](https://github.com/googlecartographer/rfcs/blob/master/text/0003-internal-headers.md)
master
Wolfgang Hess 2017-11-24 14:01:07 +01:00 committed by Wally B. Feed
parent 0084f14c1c
commit 79b83b92b2
11 changed files with 41 additions and 42 deletions

View File

@ -14,13 +14,13 @@
* limitations under the License. * limitations under the License.
*/ */
#include "cartographer/mapping_3d/motion_filter.h" #include "cartographer/internal/mapping/motion_filter.h"
#include "cartographer/transform/transform.h" #include "cartographer/transform/transform.h"
#include "glog/logging.h" #include "glog/logging.h"
namespace cartographer { namespace cartographer {
namespace mapping_3d { namespace mapping {
proto::MotionFilterOptions CreateMotionFilterOptions( proto::MotionFilterOptions CreateMotionFilterOptions(
common::LuaParameterDictionary* const parameter_dictionary) { common::LuaParameterDictionary* const parameter_dictionary) {
@ -57,5 +57,5 @@ bool MotionFilter::IsSimilar(const common::Time time,
return false; return false;
} }
} // namespace mapping_3d } // namespace mapping
} // namespace cartographer } // namespace cartographer

View File

@ -14,18 +14,18 @@
* limitations under the License. * limitations under the License.
*/ */
#ifndef CARTOGRAPHER_MAPPING_3D_MOTION_FILTER_H_ #ifndef CARTOGRAPHER_INTERNAL_MAPPING_MOTION_FILTER_H_
#define CARTOGRAPHER_MAPPING_3D_MOTION_FILTER_H_ #define CARTOGRAPHER_INTERNAL_MAPPING_MOTION_FILTER_H_
#include <limits> #include <limits>
#include "cartographer/common/lua_parameter_dictionary.h" #include "cartographer/common/lua_parameter_dictionary.h"
#include "cartographer/common/time.h" #include "cartographer/common/time.h"
#include "cartographer/mapping_3d/proto/motion_filter_options.pb.h" #include "cartographer/mapping/proto/motion_filter_options.pb.h"
#include "cartographer/transform/rigid_transform.h" #include "cartographer/transform/rigid_transform.h"
namespace cartographer { namespace cartographer {
namespace mapping_3d { namespace mapping {
proto::MotionFilterOptions CreateMotionFilterOptions( proto::MotionFilterOptions CreateMotionFilterOptions(
common::LuaParameterDictionary* parameter_dictionary); common::LuaParameterDictionary* parameter_dictionary);
@ -48,7 +48,7 @@ class MotionFilter {
transform::Rigid3d last_pose_; transform::Rigid3d last_pose_;
}; };
} // namespace mapping_3d } // namespace mapping
} // namespace cartographer } // namespace cartographer
#endif // CARTOGRAPHER_MAPPING_3D_MOTION_FILTER_H_ #endif // CARTOGRAPHER_INTERNAL_MAPPING_MOTION_FILTER_H_

View File

@ -14,13 +14,13 @@
* limitations under the License. * limitations under the License.
*/ */
#include "cartographer/mapping_3d/motion_filter.h" #include "cartographer/internal/mapping/motion_filter.h"
#include "cartographer/common/lua_parameter_dictionary_test_helpers.h" #include "cartographer/common/lua_parameter_dictionary_test_helpers.h"
#include "gmock/gmock.h" #include "gmock/gmock.h"
namespace cartographer { namespace cartographer {
namespace mapping_3d { namespace mapping {
namespace { namespace {
class MotionFilterTest : public ::testing::Test { class MotionFilterTest : public ::testing::Test {
@ -105,5 +105,5 @@ TEST_F(MotionFilterTest, RotationalMotion) {
} }
} // namespace } // namespace
} // namespace mapping_3d } // namespace mapping
} // namespace cartographer } // namespace cartographer

View File

@ -20,13 +20,13 @@
#include <memory> #include <memory>
#include "cartographer/common/time.h" #include "cartographer/common/time.h"
#include "cartographer/internal/mapping/motion_filter.h"
#include "cartographer/mapping/pose_estimate.h" #include "cartographer/mapping/pose_estimate.h"
#include "cartographer/mapping/pose_extrapolator.h" #include "cartographer/mapping/pose_extrapolator.h"
#include "cartographer/mapping_2d/proto/local_trajectory_builder_options.pb.h" #include "cartographer/mapping_2d/proto/local_trajectory_builder_options.pb.h"
#include "cartographer/mapping_2d/scan_matching/ceres_scan_matcher.h" #include "cartographer/mapping_2d/scan_matching/ceres_scan_matcher.h"
#include "cartographer/mapping_2d/scan_matching/real_time_correlative_scan_matcher.h" #include "cartographer/mapping_2d/scan_matching/real_time_correlative_scan_matcher.h"
#include "cartographer/mapping_2d/submaps.h" #include "cartographer/mapping_2d/submaps.h"
#include "cartographer/mapping_3d/motion_filter.h"
#include "cartographer/sensor/imu_data.h" #include "cartographer/sensor/imu_data.h"
#include "cartographer/sensor/odometry_data.h" #include "cartographer/sensor/odometry_data.h"
#include "cartographer/sensor/range_data.h" #include "cartographer/sensor/range_data.h"
@ -94,7 +94,7 @@ class LocalTrajectoryBuilder {
const proto::LocalTrajectoryBuilderOptions options_; const proto::LocalTrajectoryBuilderOptions options_;
ActiveSubmaps active_submaps_; ActiveSubmaps active_submaps_;
mapping_3d::MotionFilter motion_filter_; mapping::MotionFilter motion_filter_;
scan_matching::RealTimeCorrelativeScanMatcher scan_matching::RealTimeCorrelativeScanMatcher
real_time_correlative_scan_matcher_; real_time_correlative_scan_matcher_;
scan_matching::CeresScanMatcher ceres_scan_matcher_; scan_matching::CeresScanMatcher ceres_scan_matcher_;

View File

@ -20,9 +20,9 @@
#include <memory> #include <memory>
#include "cartographer/common/time.h" #include "cartographer/common/time.h"
#include "cartographer/internal/mapping/motion_filter.h"
#include "cartographer/mapping/pose_estimate.h" #include "cartographer/mapping/pose_estimate.h"
#include "cartographer/mapping/pose_extrapolator.h" #include "cartographer/mapping/pose_extrapolator.h"
#include "cartographer/mapping_3d/motion_filter.h"
#include "cartographer/mapping_3d/proto/local_trajectory_builder_options.pb.h" #include "cartographer/mapping_3d/proto/local_trajectory_builder_options.pb.h"
#include "cartographer/mapping_3d/scan_matching/ceres_scan_matcher.h" #include "cartographer/mapping_3d/scan_matching/ceres_scan_matcher.h"
#include "cartographer/mapping_3d/scan_matching/real_time_correlative_scan_matcher.h" #include "cartographer/mapping_3d/scan_matching/real_time_correlative_scan_matcher.h"
@ -82,7 +82,7 @@ class LocalTrajectoryBuilder {
const proto::LocalTrajectoryBuilderOptions options_; const proto::LocalTrajectoryBuilderOptions options_;
ActiveSubmaps active_submaps_; ActiveSubmaps active_submaps_;
MotionFilter motion_filter_; mapping::MotionFilter motion_filter_;
std::unique_ptr<scan_matching::RealTimeCorrelativeScanMatcher> std::unique_ptr<scan_matching::RealTimeCorrelativeScanMatcher>
real_time_correlative_scan_matcher_; real_time_correlative_scan_matcher_;
std::unique_ptr<scan_matching::CeresScanMatcher> ceres_scan_matcher_; std::unique_ptr<scan_matching::CeresScanMatcher> ceres_scan_matcher_;

View File

@ -14,7 +14,7 @@
syntax = "proto3"; syntax = "proto3";
package cartographer.mapping_3d.proto; package cartographer.mapping.proto;
message MotionFilterOptions { message MotionFilterOptions {
// Threshold above which range data is inserted based on time. // Threshold above which range data is inserted based on time.

View File

@ -16,10 +16,10 @@
#include "cartographer/mapping_2d/local_trajectory_builder_options.h" #include "cartographer/mapping_2d/local_trajectory_builder_options.h"
#include "cartographer/internal/mapping/motion_filter.h"
#include "cartographer/mapping_2d/scan_matching/ceres_scan_matcher.h" #include "cartographer/mapping_2d/scan_matching/ceres_scan_matcher.h"
#include "cartographer/mapping_2d/scan_matching/real_time_correlative_scan_matcher.h" #include "cartographer/mapping_2d/scan_matching/real_time_correlative_scan_matcher.h"
#include "cartographer/mapping_2d/submaps.h" #include "cartographer/mapping_2d/submaps.h"
#include "cartographer/mapping_3d/motion_filter.h"
#include "cartographer/sensor/voxel_filter.h" #include "cartographer/sensor/voxel_filter.h"
namespace cartographer { namespace cartographer {
@ -56,9 +56,8 @@ proto::LocalTrajectoryBuilderOptions CreateLocalTrajectoryBuilderOptions(
*options.mutable_ceres_scan_matcher_options() = *options.mutable_ceres_scan_matcher_options() =
scan_matching::CreateCeresScanMatcherOptions( scan_matching::CreateCeresScanMatcherOptions(
parameter_dictionary->GetDictionary("ceres_scan_matcher").get()); parameter_dictionary->GetDictionary("ceres_scan_matcher").get());
*options.mutable_motion_filter_options() = *options.mutable_motion_filter_options() = mapping::CreateMotionFilterOptions(
mapping_3d::CreateMotionFilterOptions( parameter_dictionary->GetDictionary("motion_filter").get());
parameter_dictionary->GetDictionary("motion_filter").get());
options.set_imu_gravity_time_constant( options.set_imu_gravity_time_constant(
parameter_dictionary->GetDouble("imu_gravity_time_constant")); parameter_dictionary->GetDouble("imu_gravity_time_constant"));
*options.mutable_submaps_options() = CreateSubmapsOptions( *options.mutable_submaps_options() = CreateSubmapsOptions(

View File

@ -16,7 +16,7 @@ syntax = "proto3";
package cartographer.mapping_2d.proto; package cartographer.mapping_2d.proto;
import "cartographer/mapping_3d/proto/motion_filter_options.proto"; import "cartographer/mapping/proto/motion_filter_options.proto";
import "cartographer/sensor/proto/adaptive_voxel_filter_options.proto"; import "cartographer/sensor/proto/adaptive_voxel_filter_options.proto";
import "cartographer/mapping_2d/proto/submaps_options.proto"; import "cartographer/mapping_2d/proto/submaps_options.proto";
import "cartographer/mapping_2d/scan_matching/proto/ceres_scan_matcher_options.proto"; import "cartographer/mapping_2d/scan_matching/proto/ceres_scan_matcher_options.proto";
@ -56,7 +56,7 @@ message LocalTrajectoryBuilderOptions {
real_time_correlative_scan_matcher_options = 7; real_time_correlative_scan_matcher_options = 7;
scan_matching.proto.CeresScanMatcherOptions scan_matching.proto.CeresScanMatcherOptions
ceres_scan_matcher_options = 8; ceres_scan_matcher_options = 8;
mapping_3d.proto.MotionFilterOptions motion_filter_options = 13; mapping.proto.MotionFilterOptions motion_filter_options = 13;
// Time constant in seconds for the orientation moving average based on // Time constant in seconds for the orientation moving average based on
// observed gravity via the IMU. It should be chosen so that the error // observed gravity via the IMU. It should be chosen so that the error

View File

@ -16,8 +16,8 @@
#include "cartographer/mapping_3d/local_trajectory_builder_options.h" #include "cartographer/mapping_3d/local_trajectory_builder_options.h"
#include "cartographer/internal/mapping/motion_filter.h"
#include "cartographer/mapping_2d/scan_matching/real_time_correlative_scan_matcher.h" #include "cartographer/mapping_2d/scan_matching/real_time_correlative_scan_matcher.h"
#include "cartographer/mapping_3d/motion_filter.h"
#include "cartographer/mapping_3d/scan_matching/ceres_scan_matcher.h" #include "cartographer/mapping_3d/scan_matching/ceres_scan_matcher.h"
#include "cartographer/mapping_3d/submaps.h" #include "cartographer/mapping_3d/submaps.h"
#include "cartographer/sensor/voxel_filter.h" #include "cartographer/sensor/voxel_filter.h"
@ -55,7 +55,7 @@ proto::LocalTrajectoryBuilderOptions CreateLocalTrajectoryBuilderOptions(
*options.mutable_ceres_scan_matcher_options() = *options.mutable_ceres_scan_matcher_options() =
scan_matching::CreateCeresScanMatcherOptions( scan_matching::CreateCeresScanMatcherOptions(
parameter_dictionary->GetDictionary("ceres_scan_matcher").get()); parameter_dictionary->GetDictionary("ceres_scan_matcher").get());
*options.mutable_motion_filter_options() = CreateMotionFilterOptions( *options.mutable_motion_filter_options() = mapping::CreateMotionFilterOptions(
parameter_dictionary->GetDictionary("motion_filter").get()); parameter_dictionary->GetDictionary("motion_filter").get());
options.set_imu_gravity_time_constant( options.set_imu_gravity_time_constant(
parameter_dictionary->GetDouble("imu_gravity_time_constant")); parameter_dictionary->GetDouble("imu_gravity_time_constant"));

View File

@ -16,7 +16,7 @@ syntax = "proto3";
package cartographer.mapping_3d.proto; package cartographer.mapping_3d.proto;
import "cartographer/mapping_3d/proto/motion_filter_options.proto"; import "cartographer/mapping/proto/motion_filter_options.proto";
import "cartographer/sensor/proto/adaptive_voxel_filter_options.proto"; import "cartographer/sensor/proto/adaptive_voxel_filter_options.proto";
import "cartographer/mapping_2d/scan_matching/proto/real_time_correlative_scan_matcher_options.proto"; import "cartographer/mapping_2d/scan_matching/proto/real_time_correlative_scan_matcher_options.proto";
import "cartographer/mapping_3d/proto/submaps_options.proto"; import "cartographer/mapping_3d/proto/submaps_options.proto";
@ -49,7 +49,7 @@ message LocalTrajectoryBuilderOptions {
real_time_correlative_scan_matcher_options = 14; real_time_correlative_scan_matcher_options = 14;
scan_matching.proto.CeresScanMatcherOptions scan_matching.proto.CeresScanMatcherOptions
ceres_scan_matcher_options = 6; ceres_scan_matcher_options = 6;
MotionFilterOptions motion_filter_options = 7; mapping.proto.MotionFilterOptions motion_filter_options = 7;
// Time constant in seconds for the orientation moving average based on // Time constant in seconds for the orientation moving average based on
// observed gravity via the IMU. It should be chosen so that the error // observed gravity via the IMU. It should be chosen so that the error

View File

@ -121,6 +121,19 @@ cartographer.mapping.proto.PoseGraphOptions pose_graph_options
Not yet documented. Not yet documented.
cartographer.mapping.proto.MotionFilterOptions
==============================================
double max_time_seconds
Threshold above which range data is inserted based on time.
double max_distance_meters
Threshold above which range data is inserted based on linear motion.
double max_angle_radians
Threshold above which range data is inserted based on rotational motion.
cartographer.mapping.proto.PoseGraphOptions cartographer.mapping.proto.PoseGraphOptions
=========================================== ===========================================
@ -215,7 +228,7 @@ cartographer.mapping_2d.scan_matching.proto.RealTimeCorrelativeScanMatcherOption
cartographer.mapping_2d.scan_matching.proto.CeresScanMatcherOptions ceres_scan_matcher_options cartographer.mapping_2d.scan_matching.proto.CeresScanMatcherOptions ceres_scan_matcher_options
Not yet documented. Not yet documented.
cartographer.mapping_3d.proto.MotionFilterOptions motion_filter_options cartographer.mapping.proto.MotionFilterOptions motion_filter_options
Not yet documented. Not yet documented.
double imu_gravity_time_constant double imu_gravity_time_constant
@ -347,7 +360,7 @@ cartographer.mapping_2d.scan_matching.proto.RealTimeCorrelativeScanMatcherOption
cartographer.mapping_3d.scan_matching.proto.CeresScanMatcherOptions ceres_scan_matcher_options cartographer.mapping_3d.scan_matching.proto.CeresScanMatcherOptions ceres_scan_matcher_options
Not yet documented. Not yet documented.
cartographer.mapping_3d.proto.MotionFilterOptions motion_filter_options cartographer.mapping.proto.MotionFilterOptions motion_filter_options
Not yet documented. Not yet documented.
double imu_gravity_time_constant double imu_gravity_time_constant
@ -365,19 +378,6 @@ cartographer.mapping_3d.proto.SubmapsOptions submaps_options
Not yet documented. Not yet documented.
cartographer.mapping_3d.proto.MotionFilterOptions
=================================================
double max_time_seconds
Threshold above which range data is inserted based on time.
double max_distance_meters
Threshold above which range data is inserted based on linear motion.
double max_angle_radians
Threshold above which range data is inserted based on rotational motion.
cartographer.mapping_3d.proto.RangeDataInserterOptions cartographer.mapping_3d.proto.RangeDataInserterOptions
====================================================== ======================================================