5 #include <pinocchio/math/quaternion.hpp> 6 #include <pinocchio/spatial/se3.hpp> 8 #include <boost/variant.hpp> 10 #include <boost/test/unit_test.hpp> 11 #include <boost/utility/binary.hpp> 13 BOOST_AUTO_TEST_SUITE(BOOST_TEST_MODULE)
18 const int max_tests = 1e5;
19 for(
int k = 0; k < max_tests; ++k)
27 BOOST_CHECK(quat.coeffs().isApprox(quat_ref.coeffs()));
36 Eigen::Quaternion<double>
q;
38 for (
int i = 0;
i < (1 << 10); ++
i) {
40 BOOST_CHECK_MESSAGE((q.coeffs().array().abs() <= 1).all(),
41 "Quaternion coeffs out of bounds: " <<
i <<
' ' << q.coeffs().transpose());
50 typedef Eigen::Quaternion<double> Quaternion;
51 typedef Quaternion::Coefficients Vector4;
54 const int max_test = 1e6;
56 const int max_test = 1e2;
58 for(
int i = 0;
i < max_test; ++
i)
61 q.coeffs() = Vector4::Random() + Vector4::Constant(2);
72 BOOST_AUTO_TEST_SUITE_END()
JointCollectionTpl const Eigen::MatrixBase< ConfigVectorType > & q
Eigen::Quaternion< Scalar, Options > Quaternion
void uniformRandom(const Eigen::QuaternionBase< Derived > &q)
Uniformly random quaternion sphere.
Main pinocchio namespace.
void assignQuaternion(Eigen::QuaternionBase< D > &quat, const Eigen::MatrixBase< Matrix3 > &R)
bool isNormalized(const Eigen::QuaternionBase< Quaternion > &quat, const typename Quaternion::Coefficients::RealScalar &prec=Eigen::NumTraits< typename Quaternion::Coefficients::RealScalar >::dummy_precision())
Check whether the input quaternion is Normalized within the given precision.
ConstAngularRef rotation() const
BOOST_AUTO_TEST_CASE(test_assignQuaternion)