real_time_correlative_scan_matcher_2d.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2016 The Cartographer Authors
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *      http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #ifndef CARTOGRAPHER_MAPPING_INTERNAL_2D_SCAN_MATCHING_REAL_TIME_CORRELATIVE_SCAN_MATCHER_2D_H_
00018 #define CARTOGRAPHER_MAPPING_INTERNAL_2D_SCAN_MATCHING_REAL_TIME_CORRELATIVE_SCAN_MATCHER_2D_H_
00019 
00020 // This is an implementation of the algorithm described in "Real-Time
00021 // Correlative Scan Matching" by Olson.
00022 //
00023 // The correlative scan matching algorithm is exhaustively evaluating the scan
00024 // matching search space. As described by the paper, the basic steps are:
00025 //
00026 // 1) Evaluate the probability p(z|xi, m) over the entire 3D search window using
00027 // the low-resolution table.
00028 // 2) Find the best voxel in the low-resolution 3D space that has not already
00029 // been considered. Denote this value as Li. If Li < Hbest, terminate: Hbest is
00030 // the best scan matching alignment.
00031 // 3) Evaluate the search volume inside voxel i using the high resolution table.
00032 // Suppose the log-likelihood of this voxel is Hi. Note that Hi <= Li since the
00033 // low-resolution map overestimates the log likelihoods. If Hi > Hbest, set
00034 // Hbest = Hi.
00035 //
00036 // This can be made even faster by transforming the scan exactly once over some
00037 // discretized range.
00038 
00039 #include <iostream>
00040 #include <memory>
00041 #include <vector>
00042 
00043 #include "Eigen/Core"
00044 #include "cartographer/mapping/2d/grid_2d.h"
00045 #include "cartographer/mapping/internal/2d/scan_matching/correlative_scan_matcher_2d.h"
00046 #include "cartographer/mapping/proto/scan_matching/real_time_correlative_scan_matcher_options.pb.h"
00047 
00048 namespace cartographer {
00049 namespace mapping {
00050 namespace scan_matching {
00051 
00052 // An implementation of "Real-Time Correlative Scan Matching" by Olson.
00053 class RealTimeCorrelativeScanMatcher2D {
00054  public:
00055   explicit RealTimeCorrelativeScanMatcher2D(
00056       const proto::RealTimeCorrelativeScanMatcherOptions& options);
00057 
00058   RealTimeCorrelativeScanMatcher2D(const RealTimeCorrelativeScanMatcher2D&) =
00059       delete;
00060   RealTimeCorrelativeScanMatcher2D& operator=(
00061       const RealTimeCorrelativeScanMatcher2D&) = delete;
00062 
00063   // Aligns 'point_cloud' within the 'grid' given an
00064   // 'initial_pose_estimate' then updates 'pose_estimate' with the result and
00065   // returns the score.
00066   double Match(const transform::Rigid2d& initial_pose_estimate,
00067                const sensor::PointCloud& point_cloud, const Grid2D& grid,
00068                transform::Rigid2d* pose_estimate) const;
00069 
00070   // Computes the score for each Candidate2D in a collection. The cost is
00071   // computed as the sum of probabilities or normalized TSD values, different
00072   // from the Ceres CostFunctions: http://ceres-solver.org/modeling.html
00073   //
00074   // Visible for testing.
00075   void ScoreCandidates(const Grid2D& grid,
00076                        const std::vector<DiscreteScan2D>& discrete_scans,
00077                        const SearchParameters& search_parameters,
00078                        std::vector<Candidate2D>* candidates) const;
00079 
00080  private:
00081   std::vector<Candidate2D> GenerateExhaustiveSearchCandidates(
00082       const SearchParameters& search_parameters) const;
00083 
00084   const proto::RealTimeCorrelativeScanMatcherOptions options_;
00085 };
00086 
00087 }  // namespace scan_matching
00088 }  // namespace mapping
00089 }  // namespace cartographer
00090 
00091 #endif  // CARTOGRAPHER_MAPPING_INTERNAL_2D_SCAN_MATCHING_REAL_TIME_CORRELATIVE_SCAN_MATCHER_2D_H_


cartographer
Author(s): The Cartographer Authors
autogenerated on Thu May 9 2019 02:27:35