5 #ifndef __pinocchio_multibody_liegroup_vector_space_operation_hpp__ 6 #define __pinocchio_multibody_liegroup_vector_space_operation_hpp__ 8 #include "pinocchio/multibody/liegroup/liegroup-base.hpp" 11 #include <boost/integer/static_min_max.hpp> 17 template<
int Dim,
typename _Scalar,
int _Options>
28 template<
int Dim,
typename _Scalar,
int _Options>
30 :
public LieGroupBase< VectorSpaceOperationTpl<Dim,_Scalar,_Options> >
40 assert(size_.value() >= 0);
48 assert(size_.value() >= 0);
62 return ConfigVector_t::Zero(size_.value());
67 std::ostringstream oss; oss <<
"R^" <<
nq();
71 template <
class ConfigL_t,
class ConfigR_t,
class Tangent_t>
73 const Eigen::MatrixBase<ConfigR_t> &
q1,
74 const Eigen::MatrixBase<Tangent_t> &
d)
79 template <ArgumentPosition arg,
class ConfigL_t,
class ConfigR_t,
class JacobianOut_t>
81 const Eigen::MatrixBase<ConfigR_t> &,
82 const Eigen::MatrixBase<JacobianOut_t> &
J)
const 90 template <ArgumentPosition arg,
class ConfigL_t,
class ConfigR_t,
class JacobianIn_t,
class JacobianOut_t>
93 const JacobianIn_t & Jin,
100 if (arg ==
ARG0) Jout = - Jin;
104 if (arg ==
ARG0) Jout -= Jin;
108 if (arg ==
ARG0) Jout += Jin;
114 template <
class ConfigIn_t,
class Velocity_t,
class ConfigOut_t>
116 const Eigen::MatrixBase<Velocity_t> &
v,
117 const Eigen::MatrixBase<ConfigOut_t> & qout)
122 template <
class Config_t,
class Jacobian_t>
124 const Eigen::MatrixBase<Jacobian_t> &
J)
129 template <
class Config_t,
class Tangent_t,
class JacobianOut_t>
131 const Eigen::MatrixBase<Tangent_t> & ,
132 const Eigen::MatrixBase<JacobianOut_t> &
J,
142 Jout.diagonal().array() +=
Scalar(1);
145 Jout.diagonal().array() -=
Scalar(1);
148 assert(
false &&
"Wrong Op requesed value");
153 template <
class Config_t,
class Tangent_t,
class JacobianOut_t>
155 const Eigen::MatrixBase<Tangent_t> & ,
156 const Eigen::MatrixBase<JacobianOut_t> &
J,
166 Jout.diagonal().array() +=
Scalar(1);
169 Jout.diagonal().array() -=
Scalar(1);
172 assert(
false &&
"Wrong Op requesed value");
177 template <
class Config_t,
class Tangent_t,
class JacobianIn_t,
class JacobianOut_t>
180 const JacobianIn_t & Jin,
181 JacobianOut_t & Jout,
197 assert(
false &&
"Wrong Op requesed value");
202 template <
class Config_t,
class Tangent_t,
class JacobianIn_t,
class JacobianOut_t>
204 const Eigen::MatrixBase<Tangent_t> & ,
205 const Eigen::MatrixBase<JacobianIn_t> & Jin,
206 const Eigen::MatrixBase<JacobianOut_t> & Jout)
const 211 template <
class Config_t,
class Tangent_t,
class JacobianIn_t,
class JacobianOut_t>
213 const Eigen::MatrixBase<Tangent_t> & ,
214 const Eigen::MatrixBase<JacobianIn_t> & Jin,
215 const Eigen::MatrixBase<JacobianOut_t> & Jout)
const 220 template <
class Config_t,
class Tangent_t,
class Jacobian_t>
222 const Eigen::MatrixBase<Tangent_t> & ,
223 const Eigen::MatrixBase<Jacobian_t> & )
const {}
225 template <
class Config_t,
class Tangent_t,
class Jacobian_t>
227 const Eigen::MatrixBase<Tangent_t> & ,
228 const Eigen::MatrixBase<Jacobian_t> & )
const {}
236 template <
class Config_t>
240 template <
class Config_t>
246 template <
class Config_t>
252 template <
class ConfigL_t,
class ConfigR_t,
class ConfigOut_t>
253 void randomConfiguration_impl
254 (
const Eigen::MatrixBase<ConfigL_t> & lower_pos_limit,
255 const Eigen::MatrixBase<ConfigR_t> & upper_pos_limit,
256 const Eigen::MatrixBase<ConfigOut_t> & qout)
const 259 for (
int i = 0;
i <
nq (); ++
i)
261 if(lower_pos_limit[
i] == -std::numeric_limits<typename ConfigL_t::Scalar>::infinity() ||
262 upper_pos_limit[
i] == std::numeric_limits<typename ConfigR_t::Scalar>::infinity() )
264 std::ostringstream error;
265 error <<
"non bounded limit. Cannot uniformly sample joint at rank " <<
i;
267 throw std::range_error(error.str());
269 res[
i] = lower_pos_limit[
i] + (( upper_pos_limit[
i] - lower_pos_limit[
i]) *
rand())/RAND_MAX;
275 return size_.value() == other.
size_.value();
280 Eigen::internal::variable_if_dynamic<Index, Dim>
size_;
285 #endif // ifndef __pinocchio_multibody_liegroup_vector_space_operation_hpp__ JointCollectionTpl const Eigen::MatrixBase< ConfigVectorType > const Eigen::MatrixBase< TangentVectorType > & v
Eigen::Matrix< Scalar, NQ, 1, Options > ConfigVector_t
void dDifference_product_impl(const ConfigL_t &, const ConfigR_t &, const JacobianIn_t &Jin, JacobianOut_t &Jout, bool, const AssignmentOperatorType op) const
ArgumentPosition
Argument position. Used as template parameter to refer to an argument.
void dIntegrateTransport_dv_impl(const Eigen::MatrixBase< Config_t > &, const Eigen::MatrixBase< Tangent_t > &, const Eigen::MatrixBase< JacobianIn_t > &Jin, const Eigen::MatrixBase< JacobianOut_t > &Jout) const
int nq(const JointModelTpl< Scalar, Options, JointCollectionTpl > &jmodel)
Visit a JointModelTpl through JointNqVisitor to get the dimension of the joint configuration space...
ConfigVector_t neutral() const
std::size_t size(custom_string const &s)
#define PINOCCHIO_LIE_GROUP_TPL_PUBLIC_INTERFACE(Derived)
VectorSpaceOperationTpl(int size=boost::static_signed_max< 0, Dim >::value)
void random_impl(const Eigen::MatrixBase< Config_t > &qout) const
traits< LieGroupDerived >::Scalar Scalar
JointCollectionTpl const Eigen::MatrixBase< ConfigVectorType > & q
#define PINOCCHIO_EIGEN_CONST_CAST(TYPE, OBJ)
Macro for an automatic const_cast.
static void normalize_impl(const Eigen::MatrixBase< Config_t > &)
static void integrateCoeffWiseJacobian_impl(const Eigen::MatrixBase< Config_t > &, const Eigen::MatrixBase< Jacobian_t > &J)
static void integrate_impl(const Eigen::MatrixBase< ConfigIn_t > &q, const Eigen::MatrixBase< Velocity_t > &v, const Eigen::MatrixBase< ConfigOut_t > &qout)
static void dIntegrate_dq_impl(const Eigen::MatrixBase< Config_t > &, const Eigen::MatrixBase< Tangent_t > &, const Eigen::MatrixBase< JacobianOut_t > &J, const AssignmentOperatorType op=SETTO)
VectorSpaceOperationTpl(const VectorSpaceOperationTpl &other)
void dIntegrateTransport_dv_impl(const Eigen::MatrixBase< Config_t > &, const Eigen::MatrixBase< Tangent_t > &, const Eigen::MatrixBase< Jacobian_t > &) const
JointCollectionTpl const Eigen::MatrixBase< ConfigVectorIn1 > const Eigen::MatrixBase< ConfigVectorIn2 > & q1
static void dIntegrate_dv_impl(const Eigen::MatrixBase< Config_t > &, const Eigen::MatrixBase< Tangent_t > &, const Eigen::MatrixBase< JacobianOut_t > &J, const AssignmentOperatorType op=SETTO)
static bool isNormalized_impl(const Eigen::MatrixBase< Config_t > &, const Scalar &)
Main pinocchio namespace.
JointCollectionTpl const Eigen::MatrixBase< ConfigVectorIn1 > & q0
void dDifference_impl(const Eigen::MatrixBase< ConfigL_t > &, const Eigen::MatrixBase< ConfigR_t > &, const Eigen::MatrixBase< JacobianOut_t > &J) const
Common traits structure to fully define base classes for CRTP.
void dIntegrate_product_impl(const Config_t &, const Tangent_t &, const JacobianIn_t &Jin, JacobianOut_t &Jout, bool, const ArgumentPosition, const AssignmentOperatorType op) const
Eigen::internal::variable_if_dynamic< Index, Dim > size_
void dIntegrateTransport_dq_impl(const Eigen::MatrixBase< Config_t > &, const Eigen::MatrixBase< Tangent_t > &, const Eigen::MatrixBase< JacobianIn_t > &Jin, const Eigen::MatrixBase< JacobianOut_t > &Jout) const
void dIntegrateTransport_dq_impl(const Eigen::MatrixBase< Config_t > &, const Eigen::MatrixBase< Tangent_t > &, const Eigen::MatrixBase< Jacobian_t > &) const
bool isEqual_impl(const VectorSpaceOperationTpl &other) const
static void difference_impl(const Eigen::MatrixBase< ConfigL_t > &q0, const Eigen::MatrixBase< ConfigR_t > &q1, const Eigen::MatrixBase< Tangent_t > &d)