mapping_2d/scan_matching/translation_delta_cost_functor.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_2D_SCAN_MATCHING_TRANSLATION_DELTA_COST_FUNCTOR_H_
18 #define CARTOGRAPHER_MAPPING_2D_SCAN_MATCHING_TRANSLATION_DELTA_COST_FUNCTOR_H_
19 
20 #include "Eigen/Core"
22 
23 namespace cartographer {
24 namespace mapping_2d {
25 namespace scan_matching {
26 
27 // Computes the cost of translating the initial pose estimate. Cost increases
28 // with the solution's distance from the initial estimate.
30  public:
31  // Constructs a new TranslationDeltaCostFunctor from the given
32  // 'initial_pose_estimate' (x, y, theta).
34  const double scaling_factor,
35  const transform::Rigid2d& initial_pose_estimate)
36  : scaling_factor_(scaling_factor),
37  x_(initial_pose_estimate.translation().x()),
38  y_(initial_pose_estimate.translation().y()) {}
39 
42  delete;
43 
44  template <typename T>
45  bool operator()(const T* const pose, T* residual) const {
46  residual[0] = scaling_factor_ * (pose[0] - x_);
47  residual[1] = scaling_factor_ * (pose[1] - y_);
48  return true;
49  }
50 
51  private:
52  const double scaling_factor_;
53  const double x_;
54  const double y_;
55 };
56 
57 } // namespace scan_matching
58 } // namespace mapping_2d
59 } // namespace cartographer
60 
61 #endif // CARTOGRAPHER_MAPPING_2D_SCAN_MATCHING_TRANSLATION_DELTA_COST_FUNCTOR_H_
transform::Rigid3d pose
TranslationDeltaCostFunctor(const double scaling_factor, const transform::Rigid2d &initial_pose_estimate)
TranslationDeltaCostFunctor & operator=(const TranslationDeltaCostFunctor &)=delete


cartographer
Author(s):
autogenerated on Mon Jun 10 2019 12:51:39