algo-check.cpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2016-2022 CNRS INRIA
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()));
37 
38  BOOST_CHECK(model.check(makeAlgoCheckerList(Check1(),ParentChecker(),CRBAChecker()) ));
39  BOOST_CHECK(model.check(DEFAULT_CHECKERS));
40 
41  pinocchio::Data data(model);
42  BOOST_CHECK(checkData(model,data));
43  BOOST_CHECK(model.check(data));
44 
45  BOOST_FOREACH(Inertia& Y,model.inertias)
46  {
47  Y.inertia().data().fill(-1.);
48  }
49  BOOST_CHECK(! model.check (ABAChecker())); // some inertias are negative ... check fail.
50 
51 }
52 
53 BOOST_AUTO_TEST_SUITE_END ()
54 
const Symmetric3 & inertia() const
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...
#define BOOST_TEST_MODULE
CRTP class describing the API of the checkers.
Definition: check.hpp:22
Main pinocchio namespace.
Definition: timings.cpp:28
const Vector6 & data() const
BOOST_AUTO_TEST_CASE(test_check)
Definition: algo-check.cpp:28
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)
bool checkModel_impl(const Model &) const
Definition: algo-check.cpp:23
#define DEFAULT_CHECKERS


pinocchio
Author(s):
autogenerated on Fri Jun 23 2023 02:38:28