probability_grid_points_processor.h
Go to the documentation of this file.
1 /*
2  * Copyright 2016 The Cartographer Authors
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef CARTOGRAPHER_IO_PROBABILITY_GRID_POINTS_PROCESSOR_H_
18 #define CARTOGRAPHER_IO_PROBABILITY_GRID_POINTS_PROCESSOR_H_
19 
20 #include <memory>
21 
23 #include "cartographer/io/image.h"
28 #include "cartographer/mapping/proto/2d/probability_grid_range_data_inserter_options_2d.pb.h"
29 #include "cartographer/mapping/proto/trajectory.pb.h"
30 
31 namespace cartographer {
32 namespace io {
33 
34 // Creates a probability grid with the specified 'resolution'. As all points are
35 // projected into the x-y plane the z component of the data is ignored.
36 // 'range_data_inserter' options are used to configure the range data ray
37 // tracing through the probability grid.
39  public:
40  constexpr static const char* kConfigurationFileActionName =
41  "write_probability_grid";
42  enum class DrawTrajectories { kNo, kYes };
44  double resolution,
45  const mapping::proto::ProbabilityGridRangeDataInserterOptions2D&
46  probability_grid_range_data_inserter_options,
47  const DrawTrajectories& draw_trajectories,
48  std::unique_ptr<FileWriter> file_writer,
49  const std::vector<mapping::proto::Trajectory>& trajectorios,
50  PointsProcessor* next);
52  delete;
54  const ProbabilityGridPointsProcessor&) = delete;
55 
56  static std::unique_ptr<ProbabilityGridPointsProcessor> FromDictionary(
57  const std::vector<mapping::proto::Trajectory>& trajectories,
58  const FileWriterFactory& file_writer_factory,
60 
62 
63  void Process(std::unique_ptr<PointsBatch> batch) override;
64  FlushResult Flush() override;
65 
66  private:
68  const std::vector<mapping::proto::Trajectory> trajectories_;
69  std::unique_ptr<FileWriter> file_writer_;
73 };
74 
75 // Draws 'probability_grid' into an image and fills in 'offset' with the cropped
76 // map limits. Returns 'nullptr' if probability_grid was empty.
77 std::unique_ptr<Image> DrawProbabilityGrid(
78  const mapping::ProbabilityGrid& probability_grid, Eigen::Array2i* offset);
79 
80 // Create an initially empty probability grid with 'resolution' and a small
81 // size, suitable for a PointsBatchProcessor.
82 mapping::ProbabilityGrid CreateProbabilityGrid(const double resolution);
83 
84 } // namespace io
85 } // namespace cartographer
86 
87 #endif // CARTOGRAPHER_IO_PROBABILITY_GRID_POINTS_PROCESSOR_H_
std::function< std::unique_ptr< FileWriter >(const std::string &filename)> FileWriterFactory
Definition: file_writer.h:66
const std::vector< mapping::proto::Trajectory > trajectories_
void Process(std::unique_ptr< PointsBatch > batch) override
std::unique_ptr< Image > DrawProbabilityGrid(const mapping::ProbabilityGrid &probability_grid, Eigen::Array2i *offset)
static std::unique_ptr< ProbabilityGridPointsProcessor > FromDictionary(const std::vector< mapping::proto::Trajectory > &trajectories, const FileWriterFactory &file_writer_factory, common::LuaParameterDictionary *dictionary, PointsProcessor *next)
mapping::ProbabilityGrid CreateProbabilityGrid(const double resolution)
mapping::ProbabilityGridRangeDataInserter2D range_data_inserter_
ProbabilityGridPointsProcessor & operator=(const ProbabilityGridPointsProcessor &)=delete
ProbabilityGridPointsProcessor(double resolution, const mapping::proto::ProbabilityGridRangeDataInserterOptions2D &probability_grid_range_data_inserter_options, const DrawTrajectories &draw_trajectories, std::unique_ptr< FileWriter > file_writer, const std::vector< mapping::proto::Trajectory > &trajectorios, PointsProcessor *next)


cartographer
Author(s): The Cartographer Authors
autogenerated on Mon Feb 28 2022 22:00:58