algo-check.cpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2016-2017 CNRS
3 //
4 
5 #include <boost/fusion/container/generation/make_list.hpp>
6 #include <pinocchio/multibody/model.hpp>
7 #include "pinocchio/multibody/data.hpp"
8 #include "pinocchio/parsers/sample-models.hpp"
9 #include <pinocchio/algorithm/crba.hpp>
10 #include <pinocchio/algorithm/aba.hpp>
11 #include <pinocchio/algorithm/check.hpp>
12 #include <pinocchio/algorithm/default-check.hpp>
13 #include <iostream>
14 
15 using namespace pinocchio;
16 
17 #include <boost/test/unit_test.hpp>
18 #include <boost/utility/binary.hpp>
19 
20 // Dummy checker.
21 struct Check1 : public AlgorithmCheckerBase<Check1>
22 {
23  bool checkModel_impl( const Model& ) const { return true; }
24 };
25 
26 BOOST_AUTO_TEST_SUITE ( BOOST_TEST_MODULE )
27 
28 BOOST_AUTO_TEST_CASE ( test_check )
29 {
30  using namespace boost::fusion;
31 
33 
34  BOOST_CHECK(model.check (Check1()));
35  BOOST_CHECK(model.check (CRBAChecker()));
36  BOOST_CHECK(! model.check (ABAChecker())); // some inertias are negative ... check fail.
37  BOOST_FOREACH(Inertia& Y,model.inertias)
38  Y.mass() = Y.inertia().data()[0] = Y.inertia().data()[3] = Y.inertia().data()[5] = 1.0 ;
39  BOOST_CHECK(model.check (ABAChecker())); // some inertias are negative ... check fail.
40 
41  BOOST_CHECK(model.check(makeAlgoCheckerList(Check1(),ParentChecker(),CRBAChecker()) ));
42  BOOST_CHECK(model.check(DEFAULT_CHECKERS));
43 
44  pinocchio::Data data(model);
45  BOOST_CHECK(checkData(model,data));
46  BOOST_CHECK(model.check(data));
47 
48 }
49 
50 BOOST_AUTO_TEST_SUITE_END ()
51 
bool check(const AlgorithmCheckerBase< D > &checker=AlgorithmCheckerBase< D >()) const
Check the validity of the attributes of Model with respect to the specification of some algorithms...
data
const Symmetric3 & inertia() const
CRTP class describing the API of the checkers.
Definition: check.hpp:22
const Vector6 & data() const
Main pinocchio namespace.
Definition: timings.cpp:30
BOOST_AUTO_TEST_CASE(test_check)
Definition: algo-check.cpp:28
bool checkModel_impl(const Model &) const
Definition: algo-check.cpp:23
void humanoidRandom(ModelTpl< Scalar, Options, JointCollectionTpl > &model, bool usingFF=true)
Create a humanoid kinematic tree with 6-DOF limbs and random joint placements.
JointCollectionTpl & model
bool checkData(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const DataTpl< Scalar, Options, JointCollectionTpl > &data)
#define DEFAULT_CHECKERS


pinocchio
Author(s):
autogenerated on Tue Jun 1 2021 02:45:02