Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Guilhem Saurel
pinocchio
Commits
4693e059
Commit
4693e059
authored
Feb 14, 2017
by
jcarpent
Browse files
[Multibody] Add check of data with respect to model
Call simply model.check(data)
parent
a9150f14
Changes
4
Hide whitespace changes
Inline
Side-by-side
bindings/python/multibody/model.hpp
View file @
4693e059
//
// Copyright (c) 2015-201
6
CNRS
// Copyright (c) 2015-201
7
CNRS
// Copyright (c) 2015 Wandercraft, 86 rue de Paris 91400 Orsay, France.
//
// This file is part of Pinocchio
...
...
@@ -24,6 +24,7 @@
#include
<eigenpy/memory.hpp>
#include
"pinocchio/multibody/model.hpp"
#include
"pinocchio/algorithm/check.hpp"
#include
"pinocchio/parsers/sample-models.hpp"
#include
"pinocchio/bindings/python/utils/eigen_container.hpp"
#include
"pinocchio/bindings/python/utils/printable.hpp"
...
...
@@ -147,6 +148,8 @@ namespace se3
.
staticmethod
(
"BuildEmptyModel"
)
.
def
(
"BuildHumanoidSimple"
,
&
ModelPythonVisitor
::
maker_humanoidSimple
)
.
staticmethod
(
"BuildHumanoidSimple"
)
.
def
(
"check"
,(
bool
(
Model
::*
)(
const
Data
&
)
const
)
&
Model
::
check
,
bp
::
arg
(
"data"
),
"Check consistency of data wrt model."
)
;
}
...
...
src/algorithm/check.hxx
View file @
4693e059
//
// Copyright (c) 2016 CNRS
// Copyright (c) 2016
-2017
CNRS
//
// This file is part of Pinocchio
// Pinocchio is free software: you can redistribute it
...
...
@@ -132,6 +132,8 @@ namespace se3
#undef CHECK_DATA
return
true
;
}
inline
bool
Model
::
check
(
const
Data
&
data
)
const
{
return
checkData
(
*
this
,
data
);
}
}
// namespace se3
...
...
src/multibody/model.hpp
View file @
4693e059
...
...
@@ -336,6 +336,13 @@ namespace se3
/// Run check(fusion::list) with DEFAULT_CHECKERS as argument.
inline
bool
check
()
const
;
/// Run checkData on data and current model.
///
/// \param[in] data to be checked wrt *this.
///
/// \return true if the data is valid, false otherwise.
inline
bool
check
(
const
Data
&
data
)
const
;
protected:
...
...
unittest/algo-check.cpp
View file @
4693e059
//
// Copyright (c) 2016-2017 CNRS
//
// This file is part of Pinocchio
// Pinocchio is free software: you can redistribute it
// and/or modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation, either version
// 3 of the License, or (at your option) any later version.
//
// Pinocchio is distributed in the hope that it will be
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Lesser Public License for more details. You should have
// received a copy of the GNU Lesser General Public License along with
// Pinocchio If not, see
// <http://www.gnu.org/licenses/>.
#include
<boost/fusion/container/generation/make_list.hpp>
#include
<pinocchio/multibody/model.hpp>
...
...
@@ -39,6 +55,8 @@ BOOST_AUTO_TEST_CASE ( test_check )
se3
::
Data
data
(
model
);
BOOST_CHECK
(
checkData
(
model
,
data
));
BOOST_CHECK
(
model
.
check
(
data
));
}
BOOST_AUTO_TEST_SUITE_END
()
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment