5 #ifndef __pinocchio_multibody_liegroup_vector_space_operation_hpp__
6 #define __pinocchio_multibody_liegroup_vector_space_operation_hpp__
11 #include <boost/integer/static_min_max.hpp>
15 template<
int Dim,
typename Scalar,
int Options = context::Options>
18 template<
int Dim,
typename _Scalar,
int _Options>
30 template<
int Dim,
typename _Scalar,
int _Options>
31 struct VectorSpaceOperationTpl
32 :
public LieGroupBase<VectorSpaceOperationTpl<Dim, _Scalar, _Options>>
42 assert(
size_.value() >= 0);
51 assert(
size_.value() >= 0);
56 size_.setValue(other.size_.value());
57 assert(
size_.value() >= 0);
72 return ConfigVector_t::Zero(
size_.value());
77 std::ostringstream oss;
82 template<
class ConfigL_t,
class ConfigR_t,
class Tangent_t>
84 const Eigen::MatrixBase<ConfigL_t> &
q0,
85 const Eigen::MatrixBase<ConfigR_t> &
q1,
86 const Eigen::MatrixBase<Tangent_t> &
d)
91 template<ArgumentPosition arg,
class ConfigL_t,
class ConfigR_t,
class JacobianOut_t>
93 const Eigen::MatrixBase<ConfigL_t> &,
94 const Eigen::MatrixBase<ConfigR_t> &,
95 const Eigen::MatrixBase<JacobianOut_t> &
J)
const
99 -JacobianMatrix_t::Identity(
size_.value(),
size_.value());
100 else if (arg ==
ARG1)
113 const JacobianIn_t & Jin,
114 JacobianOut_t & Jout,
141 template<
class ConfigIn_t,
class Velocity_t,
class ConfigOut_t>
143 const Eigen::MatrixBase<ConfigIn_t> &
q,
144 const Eigen::MatrixBase<Velocity_t> &
v,
145 const Eigen::MatrixBase<ConfigOut_t> &
qout)
150 template<
class Config_t,
class Jacobian_t>
152 const Eigen::MatrixBase<Config_t> &,
const Eigen::MatrixBase<Jacobian_t> &
J)
157 template<
class Config_t,
class Tangent_t,
class JacobianOut_t>
159 const Eigen::MatrixBase<Config_t> & ,
160 const Eigen::MatrixBase<Tangent_t> & ,
161 const Eigen::MatrixBase<JacobianOut_t> &
J,
171 Jout.diagonal().array() +=
Scalar(1);
174 Jout.diagonal().array() -=
Scalar(1);
177 assert(
false &&
"Wrong Op requesed value");
182 template<
class Config_t,
class Tangent_t,
class JacobianOut_t>
184 const Eigen::MatrixBase<Config_t> & ,
185 const Eigen::MatrixBase<Tangent_t> & ,
186 const Eigen::MatrixBase<JacobianOut_t> &
J,
196 Jout.diagonal().array() +=
Scalar(1);
199 Jout.diagonal().array() -=
Scalar(1);
202 assert(
false &&
"Wrong Op requesed value");
207 template<
class Config_t,
class Tangent_t,
class JacobianIn_t,
class JacobianOut_t>
211 const JacobianIn_t & Jin,
212 JacobianOut_t & Jout,
229 assert(
false &&
"Wrong Op requesed value");
234 template<
class Config_t,
class Tangent_t,
class JacobianIn_t,
class JacobianOut_t>
236 const Eigen::MatrixBase<Config_t> & ,
237 const Eigen::MatrixBase<Tangent_t> & ,
238 const Eigen::MatrixBase<JacobianIn_t> & Jin,
239 const Eigen::MatrixBase<JacobianOut_t> & Jout)
244 template<
class Config_t,
class Tangent_t,
class JacobianIn_t,
class JacobianOut_t>
246 const Eigen::MatrixBase<Config_t> & ,
247 const Eigen::MatrixBase<Tangent_t> & ,
248 const Eigen::MatrixBase<JacobianIn_t> & Jin,
249 const Eigen::MatrixBase<JacobianOut_t> & Jout)
254 template<
class Config_t,
class Tangent_t,
class Jacobian_t>
256 const Eigen::MatrixBase<Config_t> & ,
257 const Eigen::MatrixBase<Tangent_t> & ,
258 const Eigen::MatrixBase<Jacobian_t> & )
262 template<
class Config_t,
class Tangent_t,
class Jacobian_t>
264 const Eigen::MatrixBase<Config_t> & ,
265 const Eigen::MatrixBase<Tangent_t> & ,
266 const Eigen::MatrixBase<Jacobian_t> & )
274 template<
class Config_t>
279 template<
class Config_t>
286 template<
class Config_t>
292 template<
class ConfigL_t,
class ConfigR_t,
class ConfigOut_t>
294 const Eigen::MatrixBase<ConfigL_t> & lower_pos_limit,
295 const Eigen::MatrixBase<ConfigR_t> & upper_pos_limit,
296 const Eigen::MatrixBase<ConfigOut_t> &
qout)
const
299 for (
int i = 0;
i <
nq(); ++
i)
301 if (check_expression_if_real<Scalar, false>(
302 lower_pos_limit[
i] == -std::numeric_limits<typename ConfigL_t::Scalar>::infinity()
303 || upper_pos_limit[
i] == std::numeric_limits<typename ConfigR_t::Scalar>::infinity()))
305 std::ostringstream error;
306 error <<
"non bounded limit. Cannot uniformly sample joint at rank " <<
i;
307 throw std::range_error(error.str());
310 lower_pos_limit[
i] + ((upper_pos_limit[
i] - lower_pos_limit[
i]) *
rand()) / RAND_MAX;
316 return size_.value() == other.size_.value();
320 Eigen::internal::variable_if_dynamic<Index, Dim>
size_;
325 #endif // ifndef __pinocchio_multibody_liegroup_vector_space_operation_hpp__