precomputation_grid_3d.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_MAPPING_INTERNAL_3D_SCAN_MATCHING_PRECOMPUTATION_GRID_3D_H_
18 #define CARTOGRAPHER_MAPPING_INTERNAL_3D_SCAN_MATCHING_PRECOMPUTATION_GRID_3D_H_
19 
21 
22 namespace cartographer {
23 namespace mapping {
24 namespace scan_matching {
25 
26 class PrecomputationGrid3D : public HybridGridBase<uint8> {
27  public:
28  explicit PrecomputationGrid3D(const float resolution)
29  : HybridGridBase<uint8>(resolution) {}
30 
31  // Maps values from [0, 255] to [kMinProbability, kMaxProbability].
32  static float ToProbability(float value) {
33  return kMinProbability +
34  value * ((kMaxProbability - kMinProbability) / 255.f);
35  }
36 };
37 
38 // Converts a HybridGrid to a PrecomputationGrid3D representing the same data,
39 // but only using 8 bit instead of 2 x 16 bit.
41 
42 // Returns a grid of the same resolution containing the maximum value of
43 // original voxels in 'grid'. This maximum is over the 8 voxels that have
44 // any combination of index components optionally increased by 'shift'.
45 // If 'shift' is 2 ** (depth - 1), where depth 0 is the original grid, and this
46 // is using the precomputed grid of one depth before, this results in
47 // precomputation grids analogous to the 2D case.
49  bool half_resolution,
50  const Eigen::Array3i& shift);
51 
52 } // namespace scan_matching
53 } // namespace mapping
54 } // namespace cartographer
55 
56 #endif // CARTOGRAPHER_MAPPING_INTERNAL_3D_SCAN_MATCHING_PRECOMPUTATION_GRID_3D_H_
PrecomputationGrid3D ConvertToPrecomputationGrid(const HybridGrid &hybrid_grid)
ValueType value(const Eigen::Array3i &index) const
Definition: hybrid_grid.h:263
constexpr float kMinProbability
constexpr float kMaxProbability
PrecomputationGrid3D PrecomputeGrid(const PrecomputationGrid3D &grid, const bool half_resolution, const Eigen::Array3i &shift)
uint8_t uint8
Definition: port.h:34


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