Skip to content
GitLab
Menu
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
6e78fa7c
Commit
6e78fa7c
authored
Jan 05, 2017
by
Joseph Mirabel
Committed by
Joseph Mirabel
Jan 05, 2017
Browse files
[C++] Add unit test for VectorSpaceOperation::randomConfiguration
parent
710c90f6
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/multibody/liegroup/vector-space.hpp
View file @
6e78fa7c
...
...
@@ -80,7 +80,7 @@ namespace se3
{
std
::
ostringstream
error
;
error
<<
"non bounded limit. Cannot uniformly sample joint at rank "
<<
i
;
assert
(
false
&&
"non bounded limit. Cannot uniformly sample joint revolute"
);
//
assert(false && "non bounded limit. Cannot uniformly sample joint revolute");
throw
std
::
runtime_error
(
error
.
str
());
}
res
[
i
]
=
lower_pos_limit
[
i
]
+
((
upper_pos_limit
[
i
]
-
lower_pos_limit
[
i
])
*
rand
())
/
RAND_MAX
;
...
...
unittest/liegroups.cpp
View file @
6e78fa7c
...
...
@@ -95,7 +95,7 @@ struct TestJoint{
BOOST_AUTO_TEST_SUITE
(
BOOST_TEST_MODULE
)
BOOST_AUTO_TEST_CASE
(
test_all_
joint
s
)
BOOST_AUTO_TEST_CASE
(
test_all_
liegroup
s
)
{
typedef
boost
::
variant
<
JointModelRX
,
JointModelRY
,
JointModelRZ
,
JointModelRevoluteUnaligned
,
JointModelSpherical
,
JointModelSphericalZYX
...
...
@@ -111,4 +111,22 @@ BOOST_AUTO_TEST_CASE ( test_all_joints )
// boost::mpl::for_each<JointModelVariant::types>(TestJoint());
}
BOOST_AUTO_TEST_CASE
(
test_vector_space
)
{
typedef
VectorSpaceOperation
<
3
>
VSO_t
;
VSO_t
::
ConfigVector_t
q
,
lo
(
VSO_t
::
ConfigVector_t
::
Constant
(
-
std
::
numeric_limits
<
double
>::
infinity
())),
// lo(VSO_t::ConfigVector_t::Constant( 0)),
// up(VSO_t::ConfigVector_t::Constant( std::numeric_limits<double>::infinity()));
up
(
VSO_t
::
ConfigVector_t
::
Constant
(
0
));
bool
error
=
false
;
try
{
VSO_t
::
randomConfiguration
(
lo
,
up
,
q
);
}
catch
(
const
std
::
runtime_error
&
)
{
error
=
true
;
}
BOOST_CHECK_MESSAGE
(
error
,
"Random configuration between infinite bounds should return an error"
);
}
BOOST_AUTO_TEST_SUITE_END
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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