Line |
Branch |
Exec |
Source |
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/multibody/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 |
24 |
|
|
{ |
25 |
|
✗ |
return true; |
26 |
|
|
} |
27 |
|
|
}; |
28 |
|
|
|
29 |
|
|
BOOST_AUTO_TEST_SUITE(BOOST_TEST_MODULE) |
30 |
|
|
|
31 |
|
✗ |
BOOST_AUTO_TEST_CASE(test_check) |
32 |
|
|
{ |
33 |
|
|
using namespace boost::fusion; |
34 |
|
|
|
35 |
|
✗ |
pinocchio::Model model; |
36 |
|
✗ |
buildModels::humanoidRandom(model); |
37 |
|
|
|
38 |
|
✗ |
BOOST_CHECK(model.check(Check1())); |
39 |
|
✗ |
BOOST_CHECK(model.check(CRBAChecker())); |
40 |
|
✗ |
BOOST_CHECK(model.check(ABAChecker())); |
41 |
|
|
|
42 |
|
✗ |
BOOST_CHECK(model.check(makeAlgoCheckerList(Check1(), ParentChecker(), CRBAChecker()))); |
43 |
|
✗ |
BOOST_CHECK(model.check(DEFAULT_CHECKERS)); |
44 |
|
|
|
45 |
|
✗ |
pinocchio::Data data(model); |
46 |
|
✗ |
BOOST_CHECK(checkData(model, data)); |
47 |
|
✗ |
BOOST_CHECK(model.check(data)); |
48 |
|
|
|
49 |
|
✗ |
BOOST_FOREACH (Inertia & Y, model.inertias) |
50 |
|
|
{ |
51 |
|
✗ |
Y.inertia().data().fill(-1.); |
52 |
|
|
} |
53 |
|
✗ |
BOOST_CHECK(!model.check(ABAChecker())); // some inertias are negative ... check fail. |
54 |
|
|
} |
55 |
|
|
|
56 |
|
|
BOOST_AUTO_TEST_SUITE_END() |
57 |
|
|
|