ceres_pose.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 namespace cartographer {
20 namespace mapping {
21 namespace optimization {
22 
24  return CeresPose::Data{{{pose.translation().x(), pose.translation().y(),
25  pose.translation().z()}},
26  {{pose.rotation().w(), pose.rotation().x(),
27  pose.rotation().y(), pose.rotation().z()}}};
28 }
29 
31  const transform::Rigid3d& pose,
32  std::unique_ptr<ceres::LocalParameterization> translation_parametrization,
33  std::unique_ptr<ceres::LocalParameterization> rotation_parametrization,
34  ceres::Problem* problem)
35  : data_(std::make_shared<CeresPose::Data>(FromPose(pose))) {
36  problem->AddParameterBlock(data_->translation.data(), 3,
37  translation_parametrization.release());
38  problem->AddParameterBlock(data_->rotation.data(), 4,
39  rotation_parametrization.release());
40 }
41 
43  return transform::Rigid3d::FromArrays(data_->rotation, data_->translation);
44 }
45 
46 } // namespace optimization
47 } // namespace mapping
48 } // namespace cartographer
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 Quaternion & rotation() const
static Rigid3 FromArrays(const std::array< double, 4 > &rotation, const std::array< double, 3 > &translation)
const Vector & translation() const
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