cost_helpers.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2018 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_OPTIMIZATION_COST_FUNCTIONS_COST_HELPERS_H_
00018 #define CARTOGRAPHER_MAPPING_INTERNAL_OPTIMIZATION_COST_FUNCTIONS_COST_HELPERS_H_
00019 
00020 #include "Eigen/Core"
00021 #include "Eigen/Geometry"
00022 #include "cartographer/transform/rigid_transform.h"
00023 #include "cartographer/transform/transform.h"
00024 
00025 namespace cartographer {
00026 namespace mapping {
00027 namespace optimization {
00028 
00029 // Computes the error between the given relative pose and the difference of
00030 // poses 'start' and 'end' which are both in an arbitrary common frame.
00031 //
00032 // 'start' and 'end' poses have the format [x, y, rotation].
00033 template <typename T>
00034 static std::array<T, 3> ComputeUnscaledError(
00035     const transform::Rigid2d& relative_pose, const T* const start,
00036     const T* const end);
00037 template <typename T>
00038 std::array<T, 3> ScaleError(const std::array<T, 3>& error,
00039                             double translation_weight, double rotation_weight);
00040 
00041 // Computes the error between the given relative pose and the difference of
00042 // poses 'start' and 'end' which are both in an arbitrary common frame.
00043 //
00044 // 'start' and 'end' translation has the format [x, y, z].
00045 // 'start' and 'end' rotation are quaternions in the format [w, n_1, n_2, n_3].
00046 template <typename T>
00047 static std::array<T, 6> ComputeUnscaledError(
00048     const transform::Rigid3d& relative_pose, const T* const start_rotation,
00049     const T* const start_translation, const T* const end_rotation,
00050     const T* const end_translation);
00051 
00052 template <typename T>
00053 std::array<T, 6> ScaleError(const std::array<T, 6>& error,
00054                             double translation_weight, double rotation_weight);
00055 
00056 // Computes spherical linear interpolation of unit quaternions.
00057 //
00058 // 'start' and 'end' are quaternions in the format [w, n_1, n_2, n_3].
00059 template <typename T>
00060 std::array<T, 4> SlerpQuaternions(const T* const start, const T* const end,
00061                                   double factor);
00062 
00063 // Interpolates 3D poses. Linear interpolation is performed for translation and
00064 // spherical-linear one for rotation.
00065 template <typename T>
00066 std::tuple<std::array<T, 4> /* rotation */, std::array<T, 3> /* translation */>
00067 InterpolateNodes3D(const T* const prev_node_rotation,
00068                    const T* const prev_node_translation,
00069                    const T* const next_node_rotation,
00070                    const T* const next_node_translation,
00071                    const double interpolation_parameter);
00072 
00073 // Embeds 2D poses into 3D and interpolates them. Linear interpolation is
00074 // performed for translation and spherical-linear one for rotation.
00075 template <typename T>
00076 std::tuple<std::array<T, 4> /* rotation */, std::array<T, 3> /* translation */>
00077 InterpolateNodes2D(const T* const prev_node_pose,
00078                    const Eigen::Quaterniond& prev_node_gravity_alignment,
00079                    const T* const next_node_pose,
00080                    const Eigen::Quaterniond& next_node_gravity_alignment,
00081                    const double interpolation_parameter);
00082 
00083 }  // namespace optimization
00084 }  // namespace mapping
00085 }  // namespace cartographer
00086 
00087 #include "cartographer/mapping/internal/optimization/cost_functions/cost_helpers_impl.h"
00088 
00089 #endif  // CARTOGRAPHER_MAPPING_INTERNAL_OPTIMIZATION_COST_FUNCTIONS_COST_HELPERS_H_


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