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
loco-3d
Multicontact-api
Commits
540b764d
Commit
540b764d
authored
Jan 29, 2020
by
Pierre Fernbach
Browse files
refactor isTimeCOnsistent -> haveTimings
parent
9f661dfb
Changes
4
Hide whitespace changes
Inline
Side-by-side
include/multicontact-api/bindings/python/scenario/contact-sequence.hpp
View file @
540b764d
...
...
@@ -95,8 +95,8 @@ struct ContactSequencePythonVisitor : public bp::def_visitor<ContactSequencePyth
"Raise value_error if the phaseDuration is provided but the last phase do not have a time-range "
"defined
\n
"
"Raise value_error if eeName is not in contact in the last phase of the sequence
\n
"
))
.
def
(
"
isTimeConsistent"
,
&
CS
::
isTimeConsistent
,
"
isTimeConsistent
Check if all the time intervals are defined and consistent"
.
def
(
"
haveTimings"
,
&
CS
::
haveTimings
,
"Check if all the time intervals are defined and consistent"
"(ie. the time always increase and the final time of one phase is equal to the initial one of the newt "
"phase)
\n
"
"Return true if the sequence is consistent, false otherwise"
)
...
...
include/multicontact-api/scenario/contact-sequence.hpp
View file @
540b764d
...
...
@@ -220,11 +220,11 @@ struct ContactSequenceTpl : public serialization::Serializable<ContactSequenceTp
}
/**
* @brief
isTimeConsistent
Check if all the time intervals are defined and consistent
* @brief
haveTimings
Check if all the time intervals are defined and consistent
* (ie. the time always increase and the final time of one phase is equal to the initial one of the newt phase)
* @return true if the sequence is consistent, false otherwise
*/
bool
isTimeConsistent
()
const
{
bool
haveTimings
()
const
{
double
current_t
=
m_contact_phases
.
front
().
timeInitial
();
if
(
current_t
<
0.
)
{
std
::
cout
<<
"Initial time is negative."
<<
std
::
endl
;
...
...
unittest/python/scenario.py
View file @
540b764d
...
...
@@ -1533,7 +1533,7 @@ class ContactSequenceTest(unittest.TestCase):
cp1
=
buildRandomContactPhase
(
2
,
4.
)
cs1
.
append
(
cp0
)
cs1
.
append
(
cp1
)
consistent
=
cs1
.
isTimeConsistent
()
consistent
=
cs1
.
haveTimings
()
self
.
assertTrue
(
consistent
)
cs2
=
ContactSequence
(
0
)
...
...
@@ -1541,7 +1541,7 @@ class ContactSequenceTest(unittest.TestCase):
cp3
=
buildRandomContactPhase
(
1.5
,
4.
)
cs2
.
append
(
cp2
)
cs2
.
append
(
cp3
)
consistent
=
cs2
.
isTimeConsistent
()
consistent
=
cs2
.
haveTimings
()
self
.
assertFalse
(
consistent
)
cs3
=
ContactSequence
(
0
)
...
...
@@ -1549,7 +1549,7 @@ class ContactSequenceTest(unittest.TestCase):
cp5
=
buildRandomContactPhase
()
cs3
.
append
(
cp4
)
cs3
.
append
(
cp5
)
consistent
=
cs3
.
isTimeConsistent
()
consistent
=
cs3
.
haveTimings
()
self
.
assertFalse
(
consistent
)
cs4
=
ContactSequence
(
0
)
...
...
@@ -1557,7 +1557,7 @@ class ContactSequenceTest(unittest.TestCase):
cp7
=
buildRandomContactPhase
(
1
,
3
)
cs4
.
append
(
cp6
)
cs4
.
append
(
cp7
)
consistent
=
cs4
.
isTimeConsistent
()
consistent
=
cs4
.
haveTimings
()
self
.
assertFalse
(
consistent
)
...
...
unittest/scenario.cpp
View file @
540b764d
...
...
@@ -1610,7 +1610,7 @@ BOOST_AUTO_TEST_CASE(contact_sequence_is_time_consistent) {
ContactPhase
cp1
=
buildRandomContactPhase
(
2
,
4.
);
cs1
.
append
(
cp0
);
cs1
.
append
(
cp1
);
bool
consistent
=
cs1
.
isTimeConsistent
();
bool
consistent
=
cs1
.
haveTimings
();
BOOST_CHECK
(
consistent
);
ContactSequence
cs2
=
ContactSequence
(
0
);
...
...
@@ -1618,7 +1618,7 @@ BOOST_AUTO_TEST_CASE(contact_sequence_is_time_consistent) {
ContactPhase
cp3
=
buildRandomContactPhase
(
1.5
,
4.
);
cs2
.
append
(
cp2
);
cs2
.
append
(
cp3
);
consistent
=
cs2
.
isTimeConsistent
();
consistent
=
cs2
.
haveTimings
();
BOOST_CHECK
(
!
consistent
);
ContactSequence
cs3
=
ContactSequence
(
0
);
...
...
@@ -1626,7 +1626,7 @@ BOOST_AUTO_TEST_CASE(contact_sequence_is_time_consistent) {
ContactPhase
cp5
=
buildRandomContactPhase
();
cs3
.
append
(
cp4
);
cs3
.
append
(
cp5
);
consistent
=
cs3
.
isTimeConsistent
();
consistent
=
cs3
.
haveTimings
();
BOOST_CHECK
(
!
consistent
);
ContactSequence
cs4
=
ContactSequence
(
0
);
...
...
@@ -1634,7 +1634,7 @@ BOOST_AUTO_TEST_CASE(contact_sequence_is_time_consistent) {
ContactPhase
cp7
=
buildRandomContactPhase
(
1
,
3
);
cs4
.
append
(
cp6
);
cs4
.
append
(
cp7
);
consistent
=
cs4
.
isTimeConsistent
();
consistent
=
cs4
.
haveTimings
();
BOOST_CHECK
(
!
consistent
);
}
...
...
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