17 #ifndef SIMILARITYTRANSFORM_H_
18 #define SIMILARITYTRANSFORM_H_
22 #include <geometry_msgs/PoseWithCovariance.h>
24 #include <Eigen/Geometry>
32 namespace geometry_msgs {
45 return (Vector3() << p.x, p.y, p.z).finished();
51 return Eigen::Quaterniond(q.w, q.x, q.y, q.z);
66 const geometry_msgs::PoseWithCovariance::_covariance_type & gcov,
67 int start_row,
int start_col) {
68 Eigen::Map<const Matrix6> cov(gcov.data());
69 return Matrix3(cov.block<3, 3>(start_row, start_col));
83 template<
class Derived>
85 geometry_msgs::PoseWithCovariance::_covariance_type & gcov,
86 const Eigen::MatrixBase<Derived> &ecov,
int start_row,
int start_col) {
87 EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(Derived, 3, 3)
88 Eigen::Map<Matrix6> _gcov(gcov.data());
89 _gcov.block<3, 3>(start_row, start_col) = ecov;
92 if (start_row != start_col)
93 _gcov.block<3, 3>(start_col, start_row) = ecov.transpose();
97 template<
class Derived>
99 const Eigen::MatrixBase<Derived> &
p) {
100 EIGEN_STATIC_ASSERT_VECTOR_ONLY (Derived);
101 assert(p.size() == 3);
103 geometry_msgs::Point _p;
112 const Eigen::Quaterniond &
q) {
121 namespace similarity_transform {
123 typedef geometry_msgs::PoseWithCovariance
Pose;
151 bool compute(
Pose & pose,
double *scale =
nullptr ,
double *cond =
nullptr ,
152 double eps = std::numeric_limits<double>::epsilon() * 4 * 4);
158 #endif // SIMILARITYTRANSFORM_H_