5 #ifndef __pinocchio_autodiff_cppad_math_quaternion_hpp__ 6 #define __pinocchio_autodiff_cppad_math_quaternion_hpp__ 8 #include "pinocchio/math/quaternion.hpp" 17 template<
typename _Scalar>
22 template<
typename Matrix3,
typename QuaternionDerived>
23 static inline void run(Eigen::QuaternionBase<QuaternionDerived> &
q,
26 typedef typename Eigen::internal::traits<QuaternionDerived>::Coefficients QuatCoefficients;
29 typedef Eigen::Quaternion<ADScalar,QuatCoefficientsPlainType::Options> QuaternionPlain;
30 QuaternionPlain quat_t_positive;
32 ADScalar
t = mat.trace();
35 QuaternionPlain quat_t_negative_0, quat_t_negative_1, quat_t_negative_2;
42 for(Eigen::DenseIndex k = 0; k < 4; ++k)
44 ADScalar t_is_negative_cond1 = CppAD::CondExpGt<Scalar>(mat.coeff(1,1), mat.coeff(0,0),
45 quat_t_negative_1.coeffs().coeff(k),
46 quat_t_negative_0.coeffs().coeff(k));
48 ADScalar t_is_negative_cond2 = CppAD::CondExpGt<Scalar>(mat.coeff(2,2), mat.coeff(0,0),
49 quat_t_negative_2.coeffs().coeff(k),
50 CppAD::CondExpGt<Scalar>(mat.coeff(1,1), mat.coeff(0,0),
51 CppAD::CondExpGt<Scalar>(mat.coeff(2,2), mat.coeff(1,1),
52 quat_t_negative_2.coeffs().coeff(k),
54 t_is_negative_cond1));
55 q.coeffs().coeffRef(k) = CppAD::CondExpGt<Scalar>(
t,ADScalar(0),
56 quat_t_positive.coeffs().coeff(k),
68 #endif // ifndef __pinocchio_autodiff_casadi_math_quaternion_hpp__ static void run(Scalar t, Eigen::QuaternionBase< QuaternionDerived > &q, const Matrix3 &mat)
JointCollectionTpl const Eigen::MatrixBase< ConfigVectorType > & q
static void run(Eigen::QuaternionBase< QuaternionDerived > &q, const Matrix3 &mat)
Main pinocchio namespace.
PINOCCHIO_EIGEN_PLAIN_TYPE(ConfigVectorType) integrate(const ModelTpl< Scalar
Integrate a configuration vector for the specified model for a tangent vector during one unit time...
CppAD::AD< Scalar > ADScalar
static void run(Scalar t, Eigen::QuaternionBase< QuaternionDerived > &q, const Matrix3 &mat)