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
test-hpp
Commits
5043a015
Commit
5043a015
authored
Sep 08, 2014
by
Joseph Mirabel
Committed by
Joseph Mirabel
Nov 18, 2014
Browse files
Add script to test projections statistically.
parent
387d6c16
Changes
1
Hide whitespace changes
Inline
Side-by-side
script/test_constraints.py
0 → 100644
View file @
5043a015
##
## hpp-wholebody-step-server should be launched
##
from
hpp.corbaserver
import
Client
,
ProblemSolver
from
hpp.corbaserver.wholebody_step
import
Client
as
WSClient
from
hpp.corbaserver.hrp2
import
Robot
Robot
.
urdfSuffix
=
'_capsule'
Robot
.
srdfSuffix
=
'_capsule'
robot
=
Robot
(
'hrp2'
)
p
=
ProblemSolver
(
robot
)
wcl
=
WSClient
()
q0
=
robot
.
getInitialConfig
()
constraintName
=
"balance"
wcl
.
problem
.
addStaticStabilityConstraints
(
constraintName
,
q0
,
robot
.
leftAnkle
,
robot
.
rightAnkle
)
balanceConstraints
=
[
constraintName
+
"/relative-com"
,
constraintName
+
"/relative-orientation"
,
constraintName
+
"/relative-position"
,
constraintName
+
"/orientation-left-foot"
,
constraintName
+
"/position-left-foot"
]
for
a
in
[
"x"
,
"y"
,
"z"
]:
robot
.
setJointBounds
(
"base_joint_"
+
a
,
[
-
4
,
4
])
def
testConstraint
(
constraints
,
nbIter
=
100
):
success
=
0
p
.
resetConstraints
()
p
.
setNumericalConstraints
(
'test'
,
constraints
)
for
i
in
range
(
nbIter
):
res
=
p
.
applyConstraints
(
robot
.
shootRandomConfig
())
if
res
[
0
]:
success
=
success
+
1
print
"Constraint "
,
constraints
,
" succeeds "
,
success
*
100
/
nbIter
,
" %"
for
constraint
in
balanceConstraints
:
testConstraint
([
constraint
])
testConstraint
(
balanceConstraints
)
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