hpp-pinocchio  4.9.1
Wrapping of the kinematic/dynamic chain Pinocchio for HPP.
special-euclidean.hh
Go to the documentation of this file.
1 // Copyright (c) 2018, Joseph Mirabel
2 // Authors: Joseph Mirabel (joseph.mirabel@laas.fr)
3 //
4 // This file is part of hpp-pinocchio.
5 // hpp-pinocchio is free software: you can redistribute it
6 // and/or modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation, either version
8 // 3 of the License, or (at your option) any later version.
9 //
10 // hpp-pinocchio is distributed in the hope that it will be
11 // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
12 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // General Lesser Public License for more details. You should have
14 // received a copy of the GNU Lesser General Public License along with
15 // hpp-pinocchio. If not, see <http://www.gnu.org/licenses/>.
16 
17 #ifndef HPP_PINOCCHIO_LIEGROUP_SPECIAL_EUCLIDEAN_OPERATION_HH
18 #define HPP_PINOCCHIO_LIEGROUP_SPECIAL_EUCLIDEAN_OPERATION_HH
19 
20 #include <pinocchio/multibody/liegroup/special-euclidean.hpp>
21 
22 namespace hpp {
23  namespace pinocchio {
24  namespace liegroup {
25  template<int N>
27  {
28  typedef ::pinocchio::SpecialEuclideanOperationTpl<N, value_type> Base;
29  enum {
30  NT = N,
31  NR = Base::NV - N,
33  };
34 
35  template <class ConfigL_t, class ConfigR_t>
37  const Eigen::MatrixBase<ConfigL_t> & q0,
38  const Eigen::MatrixBase<ConfigR_t> & q1)
39  {
40  return Base::squaredDistance(q0, q1);
41  }
42 
43  // Intentionally not implemented as it does not make sense.
44  /*
45  template <class ConfigL_t, class ConfigR_t>
46  static double squaredDistance(
47  const Eigen::MatrixBase<ConfigL_t> & q0,
48  const Eigen::MatrixBase<ConfigR_t> & q1,
49  const typename ConfigL_t::Scalar& w)
50  {
51  typedef liegroup::CartesianProductOperation<
52  liegroup::VectorSpaceOperation<NT, false>,
53  liegroup::SpecialOrthogonalOperation<N>
54  > type;
55  return type::squaredDistance (q0, q1, w);
56  }
57  */
58 
59  template <class ConfigIn_t, class ConfigOut_t>
60  static void setBound(
61  const Eigen::MatrixBase<ConfigIn_t > & bound,
62  const Eigen::MatrixBase<ConfigOut_t> & out)
63  {
64  if (bound.size() == Base::NQ || bound.size() == BoundSize) {
65  const_cast<Eigen::MatrixBase<ConfigOut_t>&>(out).head(bound.size()) = bound;
66  } else {
67  HPP_THROW(std::invalid_argument, "Expected vector of size "
68  << BoundSize << " or " << Base::NQ
69  << ", got size " << bound.size());
70  }
71  }
72 
73  template <class JacobianIn_t, class JacobianOut_t>
75  const Eigen::MatrixBase<JacobianIn_t > & Jin,
76  const Eigen::MatrixBase<JacobianOut_t> & Jout)
77  {
78  const_cast<Eigen::MatrixBase<JacobianOut_t>&> (Jout) = Jin.template bottomLeftCorner<3,3>();
79  }
80 
81  template <class ConfigIn_t>
82  static bool isNormalized(const Eigen::MatrixBase<ConfigIn_t > & q, const value_type& eps)
83  {
84  EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(ConfigIn_t , Base::ConfigVector_t);
85  return (std::abs(q.template tail<4>().norm() - 1) < eps );
86  }
87  };
88  } // namespace liegroup
89  } // namespace pinocchio
90 } // namespace hpp
91 
92 #endif // HPP_PINOCCHIO_LIEGROUP_SPECIAL_EUCLIDEAN_OPERATION_HH
#define HPP_THROW(TYPE, MSG)
Utility functions.
static void setBound(const Eigen::MatrixBase< ConfigIn_t > &bound, const Eigen::MatrixBase< ConfigOut_t > &out)
Definition: special-euclidean.hh:60
::pinocchio::SpecialEuclideanOperationTpl< N, value_type > Base
Definition: special-euclidean.hh:28
static bool isNormalized(const Eigen::MatrixBase< ConfigIn_t > &q, const value_type &eps)
Definition: special-euclidean.hh:82
static void getRotationSubJacobian(const Eigen::MatrixBase< JacobianIn_t > &Jin, const Eigen::MatrixBase< JacobianOut_t > &Jout)
Definition: special-euclidean.hh:74
double value_type
Definition: fwd.hh:40
double squaredDistance(const Eigen::MatrixBase< ConfigL_t > &q0, const Eigen::MatrixBase< ConfigR_t > &q1)
Definition: special-euclidean.hh:36
Definition: special-euclidean.hh:26