32 #include "cartographer/mapping/proto/trajectory.pb.h" 37 template <
typename Po
intsProcessorType>
41 PointsProcessorType::kConfigurationFileActionName,
48 template <
typename Po
intsProcessorType>
53 PointsProcessorType::kConfigurationFileActionName,
54 [file_writer_factory](
63 const mapping::proto::Trajectory& trajectory,
66 RegisterPlainPointsProcessor<CountingPointsProcessor>(builder);
67 RegisterPlainPointsProcessor<FixedRatioSamplingPointsProcessor>(builder);
68 RegisterPlainPointsProcessor<MinMaxRangeFiteringPointsProcessor>(builder);
69 RegisterPlainPointsProcessor<OutlierRemovingPointsProcessor>(builder);
70 RegisterPlainPointsProcessor<ColoringPointsProcessor>(builder);
71 RegisterPlainPointsProcessor<IntensityToColorPointsProcessor>(builder);
72 RegisterFileWritingPointsProcessor<PcdWritingPointsProcessor>(
73 file_writer_factory, builder);
74 RegisterFileWritingPointsProcessor<PlyWritingPointsProcessor>(
75 file_writer_factory, builder);
76 RegisterFileWritingPointsProcessor<XyzWriterPointsProcessor>(
77 file_writer_factory, builder);
78 RegisterFileWritingPointsProcessor<HybridGridPointsProcessor>(
79 file_writer_factory, builder);
85 [&trajectory, file_writer_factory](
89 trajectory, file_writer_factory, dictionary, next);
95 CHECK(
factories_.count(name) == 0) <<
"A points processor named '" << name
96 <<
"' has already been registered.";
102 std::vector<std::unique_ptr<PointsProcessor>>
105 std::vector<std::unique_ptr<PointsProcessor>> pipeline;
109 pipeline.emplace_back(common::make_unique<NullPointsProcessor>());
111 std::vector<std::unique_ptr<common::LuaParameterDictionary>> configurations =
115 for (
auto it = configurations.rbegin(); it != configurations.rend(); it++) {
116 const string action = (*it)->GetString(
"action");
119 <<
"Unknown action '" << action
120 <<
"'. Did you register the correspoinding PointsProcessor?";
121 pipeline.push_back(factory_it->second(it->get(), pipeline.back().get()));
std::function< std::unique_ptr< PointsProcessor >(common::LuaParameterDictionary *, PointsProcessor *next)> FactoryFunction
void RegisterBuiltInPointsProcessors(const mapping::proto::Trajectory &trajectory, FileWriterFactory file_writer_factory, PointsProcessorPipelineBuilder *builder)
std::function< std::unique_ptr< FileWriter >(const string &filename)> FileWriterFactory
std::vector< std::unique_ptr< LuaParameterDictionary > > GetArrayValuesAsDictionaries()
std::unordered_map< std::string, FactoryFunction > factories_
std::vector< std::unique_ptr< PointsProcessor > > CreatePipeline(common::LuaParameterDictionary *dictionary) const
PointsProcessorPipelineBuilder()
static std::unique_ptr< XRayPointsProcessor > FromDictionary(const mapping::proto::Trajectory &trajectory, FileWriterFactory file_writer_factory, common::LuaParameterDictionary *dictionary, PointsProcessor *next)
void Register(const std::string &name, FactoryFunction factory)
void RegisterPlainPointsProcessor(PointsProcessorPipelineBuilder *const builder)
static constexpr const char * kConfigurationFileActionName
void RegisterFileWritingPointsProcessor(FileWriterFactory file_writer_factory, PointsProcessorPipelineBuilder *const builder)