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
Humanoid Path Planner
hpp-centroidal-dynamics
Commits
ba06ab63
Commit
ba06ab63
authored
Jan 03, 2019
by
Guilhem Saurel
Browse files
fix libname
parent
b09c0750
Changes
2
Hide whitespace changes
Inline
Side-by-side
python/centroidal_dynamics_python.cpp
View file @
ba06ab63
...
@@ -58,7 +58,7 @@ boost::python::tuple wrapGetPolytopeInequalities(Equilibrium& self)
...
@@ -58,7 +58,7 @@ boost::python::tuple wrapGetPolytopeInequalities(Equilibrium& self)
BOOST_PYTHON_MODULE
(
centroidal_dynamics
)
BOOST_PYTHON_MODULE
(
hpp_
centroidal_dynamics
)
{
{
/** BEGIN eigenpy init**/
/** BEGIN eigenpy init**/
eigenpy
::
enableEigenPy
();
eigenpy
::
enableEigenPy
();
...
...
python/test/binding_tests.py
View file @
ba06ab63
from
centroidal_dynamics
import
*
from
hpp_
centroidal_dynamics
import
*
#testing constructors
#testing constructors
eq
=
Equilibrium
(
"test"
,
54.
,
4
)
eq
=
Equilibrium
(
"test"
,
54.
,
4
)
eq
=
Equilibrium
(
"test"
,
54.
,
4
,
SolverLP
.
SOLVER_LP_QPOASES
)
eq
=
Equilibrium
(
"test"
,
54.
,
4
,
SolverLP
.
SOLVER_LP_QPOASES
)
eq
=
Equilibrium
(
"test"
,
54.
,
4
,
SolverLP
.
SOLVER_LP_QPOASES
)
eq
=
Equilibrium
(
"test"
,
54.
,
4
,
SolverLP
.
SOLVER_LP_QPOASES
)
eq
=
Equilibrium
(
"test"
,
54.
,
4
,
SolverLP
.
SOLVER_LP_QPOASES
,
False
)
eq
=
Equilibrium
(
"test"
,
54.
,
4
,
SolverLP
.
SOLVER_LP_QPOASES
,
False
)
eq
=
Equilibrium
(
"test"
,
54.
,
4
,
SolverLP
.
SOLVER_LP_QPOASES
,
False
,
1
)
eq
=
Equilibrium
(
"test"
,
54.
,
4
,
SolverLP
.
SOLVER_LP_QPOASES
,
False
,
1
)
eq
=
Equilibrium
(
"test"
,
54.
,
4
,
SolverLP
.
SOLVER_LP_QPOASES
,
True
,
1
,
True
)
eq
=
Equilibrium
(
"test"
,
54.
,
4
,
SolverLP
.
SOLVER_LP_QPOASES
,
True
,
1
,
True
)
#whether useWarmStart is enable (True by default)
#whether useWarmStart is enable (True by default)
previous
=
eq
.
useWarmStart
()
previous
=
eq
.
useWarmStart
()
...
@@ -25,7 +25,7 @@ z = array([0.,0.,1.])
...
@@ -25,7 +25,7 @@ z = array([0.,0.,1.])
P
=
asmatrix
(
array
([
array
([
x
,
y
,
0
])
for
x
in
[
-
0.05
,
0.05
]
for
y
in
[
-
0.1
,
0.1
]]))
P
=
asmatrix
(
array
([
array
([
x
,
y
,
0
])
for
x
in
[
-
0.05
,
0.05
]
for
y
in
[
-
0.1
,
0.1
]]))
N
=
asmatrix
(
array
([
z
for
_
in
range
(
4
)]))
N
=
asmatrix
(
array
([
z
for
_
in
range
(
4
)]))
#setting contact positions and normals, as well as friction coefficients
#setting contact positions and normals, as well as friction coefficients
eq
.
setNewContacts
(
asmatrix
(
P
),
asmatrix
(
N
),
0.3
,
EquilibriumAlgorithm
.
EQUILIBRIUM_ALGORITHM_LP
)
eq
.
setNewContacts
(
asmatrix
(
P
),
asmatrix
(
N
),
0.3
,
EquilibriumAlgorithm
.
EQUILIBRIUM_ALGORITHM_LP
)
c
=
asmatrix
(
array
([
0.
,
0.
,
1.
])).
T
c
=
asmatrix
(
array
([
0.
,
0.
,
1.
])).
T
...
@@ -34,7 +34,7 @@ c= asmatrix(array([0.,0.,1.])).T
...
@@ -34,7 +34,7 @@ c= asmatrix(array([0.,0.,1.])).T
status
,
robustness
=
eq
.
computeEquilibriumRobustness
(
c
)
status
,
robustness
=
eq
.
computeEquilibriumRobustness
(
c
)
assert
(
status
==
LP_STATUS_OPTIMAL
),
"LP should not fail"
assert
(
status
==
LP_STATUS_OPTIMAL
),
"LP should not fail"
assert
(
robustness
>
0
),
"first test should be in equilibrirum"
assert
(
robustness
>
0
),
"first test should be in equilibrirum"
#computing robustness of a given configuration with non zero acceleration
#computing robustness of a given configuration with non zero acceleration
ddc
=
asmatrix
(
array
([
1000.
,
0.
,
0.
])).
T
ddc
=
asmatrix
(
array
([
1000.
,
0.
,
0.
])).
T
status
,
robustness
=
eq
.
computeEquilibriumRobustness
(
c
,
ddc
)
status
,
robustness
=
eq
.
computeEquilibriumRobustness
(
c
,
ddc
)
...
@@ -58,10 +58,10 @@ import numpy as np
...
@@ -58,10 +58,10 @@ import numpy as np
def
compute_w
(
c
,
ddc
,
dL
=
array
([
0.
,
0.
,
0.
]),
m
=
54.
,
g_vec
=
array
([
0.
,
0.
,
-
9.81
])):
def
compute_w
(
c
,
ddc
,
dL
=
array
([
0.
,
0.
,
0.
]),
m
=
54.
,
g_vec
=
array
([
0.
,
0.
,
-
9.81
])):
w1
=
m
*
(
ddc
-
g_vec
)
w1
=
m
*
(
ddc
-
g_vec
)
return
array
(
w1
.
tolist
()
+
(
cross
(
c
,
w1
)
+
dL
).
tolist
())
return
array
(
w1
.
tolist
()
+
(
cross
(
c
,
w1
)
+
dL
).
tolist
())
def
is_stable
(
H
,
c
=
array
([
0.
,
0.
,
1.
]),
ddc
=
array
([
0.
,
0.
,
0.
]),
dL
=
array
([
0.
,
0.
,
0.
]),
m
=
54.
,
g_vec
=
array
([
0.
,
0.
,
-
9.81
]),
robustness
=
0.
):
def
is_stable
(
H
,
c
=
array
([
0.
,
0.
,
1.
]),
ddc
=
array
([
0.
,
0.
,
0.
]),
dL
=
array
([
0.
,
0.
,
0.
]),
m
=
54.
,
g_vec
=
array
([
0.
,
0.
,
-
9.81
]),
robustness
=
0.
):
w
=
compute_w
(
c
,
ddc
,
dL
,
m
,
g_vec
)
w
=
compute_w
(
c
,
ddc
,
dL
,
m
,
g_vec
)
return
(
H
.
dot
(
-
w
)
<=-
robustness
).
all
()
return
(
H
.
dot
(
-
w
)
<=-
robustness
).
all
()
assert
(
is_stable
(
H
))
assert
(
is_stable
(
H
))
Write
Preview
Supports
Markdown
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