ceres_pose.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_OPTIMIZATION_CERES_POSE_H_
18 #define CARTOGRAPHER_MAPPING_INTERNAL_OPTIMIZATION_CERES_POSE_H_
19 
20 #include <array>
21 #include <memory>
22 
23 #include "Eigen/Core"
25 #include "ceres/ceres.h"
26 
27 namespace cartographer {
28 namespace mapping {
29 namespace optimization {
30 
31 class CeresPose {
32  public:
33  CeresPose(
34  const transform::Rigid3d& rigid,
35  std::unique_ptr<ceres::LocalParameterization> translation_parametrization,
36  std::unique_ptr<ceres::LocalParameterization> rotation_parametrization,
37  ceres::Problem* problem);
38 
39  const transform::Rigid3d ToRigid() const;
40 
41  double* translation() { return data_->translation.data(); }
42  const double* translation() const { return data_->translation.data(); }
43 
44  double* rotation() { return data_->rotation.data(); }
45  const double* rotation() const { return data_->rotation.data(); }
46 
47  struct Data {
48  std::array<double, 3> translation;
49  // Rotation quaternion as (w, x, y, z).
50  std::array<double, 4> rotation;
51  };
52 
53  Data& data() { return *data_; }
54 
55  private:
56  std::shared_ptr<Data> data_;
57 };
58 
60 
61 } // namespace optimization
62 } // namespace mapping
63 } // namespace cartographer
64 
65 #endif // CARTOGRAPHER_MAPPING_INTERNAL_OPTIMIZATION_CERES_POSE_H_
CeresPose(const transform::Rigid3d &rigid, std::unique_ptr< ceres::LocalParameterization > translation_parametrization, std::unique_ptr< ceres::LocalParameterization > rotation_parametrization, ceres::Problem *problem)
Definition: ceres_pose.cc:30
CeresPose::Data FromPose(const transform::Rigid3d &pose)
Definition: ceres_pose.cc:23
const transform::Rigid3d ToRigid() const
Definition: ceres_pose.cc:42
transform::Rigid3d pose


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