probability_grid_range_data_inserter_2d.cc
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 
18 
19 #include <cstdlib>
20 
21 #include "Eigen/Core"
22 #include "Eigen/Geometry"
26 #include "glog/logging.h"
27 
28 namespace cartographer {
29 namespace mapping {
30 
31 proto::ProbabilityGridRangeDataInserterOptions2D
33  common::LuaParameterDictionary* parameter_dictionary) {
34  proto::ProbabilityGridRangeDataInserterOptions2D options;
35  options.set_hit_probability(
36  parameter_dictionary->GetDouble("hit_probability"));
37  options.set_miss_probability(
38  parameter_dictionary->GetDouble("miss_probability"));
39  options.set_insert_free_space(
40  parameter_dictionary->HasKey("insert_free_space")
41  ? parameter_dictionary->GetBool("insert_free_space")
42  : true);
43  CHECK_GT(options.hit_probability(), 0.5);
44  CHECK_LT(options.miss_probability(), 0.5);
45  return options;
46 }
47 
49  const proto::ProbabilityGridRangeDataInserterOptions2D& options)
50  : options_(options),
52  Odds(options.hit_probability()))),
54  Odds(options.miss_probability()))) {}
55 
57  const sensor::RangeData& range_data, GridInterface* const grid) const {
58  ProbabilityGrid* const probability_grid = static_cast<ProbabilityGrid*>(grid);
59  // By not finishing the update after hits are inserted, we give hits priority
60  // (i.e. no hits will be ignored because of a miss in the same cell).
61  CastRays(range_data, hit_table_, miss_table_, options_.insert_free_space(),
62  CHECK_NOTNULL(probability_grid));
63  probability_grid->FinishUpdate();
64 }
65 
66 } // namespace mapping
67 } // namespace cartographer
const proto::ProbabilityGridRangeDataInserterOptions2D options_
void CastRays(const sensor::RangeData &range_data, const std::vector< uint16 > &hit_table, const std::vector< uint16 > &miss_table, const bool insert_free_space, ProbabilityGrid *const probability_grid)
Definition: ray_casting.cc:166
std::vector< uint16 > ComputeLookupTableToApplyCorrespondenceCostOdds(float odds)
proto::ProbabilityGridRangeDataInserterOptions2D CreateProbabilityGridRangeDataInserterOptions2D(common::LuaParameterDictionary *parameter_dictionary)
float Odds(float probability)
ProbabilityGridRangeDataInserter2D(const proto::ProbabilityGridRangeDataInserterOptions2D &options)
proto::ProbabilityGridRangeDataInserterOptions2D options_
virtual void Insert(const sensor::RangeData &range_data, GridInterface *grid) const override


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