6 #include <boost/test/unit_test.hpp> 9 #include "pinocchio/math/fwd.hpp" 10 #include "pinocchio/multibody/joint/joints.hpp" 11 #include "pinocchio/algorithm/rnea.hpp" 12 #include "pinocchio/algorithm/aba.hpp" 13 #include "pinocchio/algorithm/crba.hpp" 14 #include "pinocchio/algorithm/jacobian.hpp" 15 #include "pinocchio/algorithm/compute-all-terms.hpp" 19 template<
typename Jo
intModel_>
struct init;
21 template<
typename Jo
intModel_>
24 static JointModel_
run()
27 jmodel.setIndexes(0,0,0);
32 template<
typename Scalar,
int Options>
37 static JointModel
run()
40 JointModel jmodel(Vector3::Random().normalized());
47 template<
typename Scalar,
int Options>
52 static JointModel
run()
55 JointModel jmodel(Vector3::Random().normalized());
62 template<
typename Scalar,
int Options>
67 static JointModel
run()
70 JointModel jmodel(Vector3::Random().normalized());
77 template<
typename Scalar,
int Options,
template<
typename,
int>
class JointCollection>
82 static JointModel
run()
92 template<
typename Scalar,
int Options,
template<
typename,
int>
class JointCollection>
97 static JointModel
run()
109 template<
typename Jo
intModel_>
118 JointModel jmodel(jmodel_ref,1.,0.);
125 BOOST_AUTO_TEST_SUITE(joint_model_base_test)
127 template<
typename TestDerived>
130 template<
typename Jo
intModel>
134 return TestDerived::test(jmodel);
140 template<
typename Jo
intModel>
144 BOOST_CHECK(jmodel_copy == jmodel);
147 BOOST_CHECK(jmodel_any != jmodel);
148 BOOST_CHECK(!jmodel_any.
isEqual(jmodel));
160 BOOST_CHECK(joint_revolutex != joint_revolutey);
167 BOOST_CHECK(jmodel_any != jmodelx);
172 template<
typename Jo
intModel>
176 BOOST_CHECK(jmodel == jmodel);
177 BOOST_CHECK(jmodel.template cast<Scalar>().
isEqual(jmodel));
178 BOOST_CHECK(jmodel.template cast<Scalar>() == jmodel);
179 BOOST_CHECK(jmodel.template cast<long double>().template cast<double>() == jmodel);
193 template<
typename Jo
intModel>
196 typedef typename JointModel::JointDataDerived
JointData;
198 std::cout <<
"shortname: " << jmodel.
shortname() << std::endl;
199 std::cout <<
"classname: " << jmodel.
classname() << std::endl;
200 std::cout <<
"disp:\n" << jmodel << std::endl;
204 std::cout <<
"shortname: " << jdata.
shortname() << std::endl;
205 std::cout <<
"classname: " << jdata.
classname() << std::endl;
206 std::cout <<
"disp:\n" << jdata << std::endl;
218 BOOST_AUTO_TEST_SUITE_END()
static std::string classname()
pinocchio::JointModelMimic< JointModel_ > JointModel
void operator()(const pinocchio::JointModelBase< JointModel > &) const
void setIndexes(JointIndex id, int q, int v)
JointModelDerived & addJoint(const JointModelBase< JointModel > &jmodel, const SE3 &placement=SE3::Identity())
Add a joint to the vector of joints.
pinocchio::JointModelRevoluteUnboundedUnalignedTpl< Scalar, Options > JointModel
std::string shortname() const
NewScalar cast(const Scalar &value)
JointDataTpl< double > JointData
Eigen::Matrix< Scalar, 3, 1, _Options > Vector3
bool isEqual(const JointModelTpl< Scalar, Options, JointCollectionTpl > &jmodel_generic, const JointModelBase< JointModelDerived > &jmodel)
Visit a JointModelTpl<Scalar,...> to compare it to JointModelDerived.
JointDataDerived createData() const
JointModelRevoluteTpl< double, 0, 1 > JointModelRY
std::string shortname() const
bool isEqual(const JointModelBase< OtherDerived > &) const
Eigen::Matrix< Scalar, 3, 1, Options > Vector3
BOOST_AUTO_TEST_CASE(isEqual)
boost::variant< JointModelRX, JointModelRY, JointModelRZ, JointModelMimicRX, JointModelMimicRY, JointModelMimicRZ, JointModelFreeFlyer, JointModelPlanar, JointModelRevoluteUnaligned, JointModelSpherical, JointModelSphericalZYX, JointModelPX, JointModelPY, JointModelPZ, JointModelPrismaticUnaligned, JointModelTranslation, JointModelRUBX, JointModelRUBY, JointModelRUBZ, JointModelRevoluteUnboundedUnaligned, boost::recursive_wrapper< JointModelComposite > > JointModelVariant
JointModelDerived & derived()
Eigen::Matrix< Scalar, 3, 1, _Options > Vector3
pinocchio::JointModelCompositeTpl< Scalar, Options, JointCollection > JointModel
pinocchio::JointModelRevoluteUnalignedTpl< Scalar, Options > JointModel
void setIndexes(JointIndex id, int nq, int nv)
static std::string classname()
Main pinocchio namespace.
static void test(const JointModelBase< JointModel > &jmodel)
JointModelTpl< double > JointModel
pinocchio::JointModelPrismaticUnalignedTpl< Scalar, Options > JointModel
bool isEqual(const JointModelBase< JointModelDerived > &other) const
JointCollectionDefault::JointModelVariant JointModelVariant
pinocchio::JointModelTpl< Scalar, Options, JointCollection > JointModel
static void test(const JointModelBase< JointModel > &jmodel)
JointModelRevoluteTpl< double, 0, 0 > JointModelRX
static void test(const JointModelBase< JointModel > &jmodel)