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
loco-3d
Multicontact-api
Commits
cbe03c98
Commit
cbe03c98
authored
May 07, 2020
by
Pierre Fernbach
Browse files
[Python] add API & tests for contactSequence::haveContactModelDefined
parent
0934f9ef
Changes
2
Hide whitespace changes
Inline
Side-by-side
include/multicontact-api/bindings/python/scenario/contact-sequence.hpp
View file @
cbe03c98
...
...
@@ -160,6 +160,8 @@ struct ContactSequencePythonVisitor : public bp::def_visitor<ContactSequencePyth
.
def
(
"haveFriction"
,
&
CS
::
haveFriction
,
"check that all the contact patch used in the sequence have"
"a friction coefficient initialized."
)
.
def
(
"haveContactModelDefined"
,
&
CS
::
haveContactModelDefined
,
"haveContactModelDefined check that all the contact patch have a contact_model defined"
)
.
def
(
"haveZMPtrajectories"
,
&
CS
::
haveZMPtrajectories
,
"check that all the contact phases have a ZMP trajectory."
)
.
def
(
"getAllEffectorsInContact"
,
&
getAllEffectorsInContactAsList
,
...
...
unittest/python/scenario.py
View file @
cbe03c98
...
...
@@ -1677,6 +1677,41 @@ class ContactSequenceTest(unittest.TestCase):
consistent
=
cs4
.
haveTimings
()
self
.
assertFalse
(
consistent
)
def
test_contact_sequence_have_contact_model
(
self
):
cs1
=
ContactSequence
(
0
)
cp0
=
buildRandomContactPhase
(
0
,
2
)
cp1
=
buildRandomContactPhase
(
2
,
4.
)
cs1
.
append
(
cp0
)
cs1
.
append
(
cp1
)
self
.
assertFalse
(
cs1
.
haveContactModelDefined
())
mp1
=
ContactModel
(
0.5
,
ContactType
.
CONTACT_PLANAR
)
pos
=
np
.
random
.
rand
(
3
,
5
)
mp1
.
contact_points_positions
=
pos
mp2
=
ContactModel
(
1.
,
ContactType
.
CONTACT_POINT
)
pos
=
np
.
random
.
rand
(
3
,
5
)
mp1
.
contact_points_positions
=
pos
cs1
.
contactPhases
[
0
].
contactPatch
(
"right-leg"
).
contact_model
=
mp1
cs1
.
contactPhases
[
0
].
contactPatch
(
"left-leg"
).
contact_model
=
mp2
cs1
.
contactPhases
[
1
].
contactPatch
(
"right-leg"
).
contact_model
=
mp1
cs1
.
contactPhases
[
1
].
contactPatch
(
"left-leg"
).
contact_model
=
mp2
self
.
assertTrue
(
cs1
.
haveContactModelDefined
())
cp2
=
buildRandomContactPhase
(
6.
,
8.
)
cs1
.
append
(
cp2
)
self
.
assertFalse
(
cs1
.
haveContactModelDefined
())
mp3
=
ContactModel
(
0.2
)
cs1
.
contactPhases
[
2
].
contactPatch
(
"right-leg"
).
contact_model
=
mp3
cs1
.
contactPhases
[
2
].
contactPatch
(
"left-leg"
).
contact_model
=
mp2
self
.
assertFalse
(
cs1
.
haveContactModelDefined
())
mp3
.
contact_type
=
ContactType
.
CONTACT_PLANAR
# do not change the contact model already in the seqence
self
.
assertFalse
(
cs1
.
haveContactModelDefined
())
cs1
.
contactPhases
[
2
].
contactPatch
(
"right-leg"
).
contact_model
.
contact_type
=
ContactType
.
CONTACT_PLANAR
self
.
assertTrue
(
cs1
.
haveContactModelDefined
())
def
test_contact_sequence_concatenate_config_traj
(
self
):
cs1
=
ContactSequence
(
0
)
cp0
=
buildRandomContactPhase
(
0
,
2
)
...
...
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