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
Humanoid Path Planner
hpp-rbprm-corba
Commits
750cf576
Commit
750cf576
authored
Mar 19, 2020
by
Pierre Fernbach
Browse files
[Tests][Python] add unit test for guide & contact for talos
parent
6694918d
Changes
6
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
750cf576
...
...
@@ -72,5 +72,6 @@ endif()
PKG_CONFIG_APPEND_LIBS
(
${
PROJECT_NAME
}
)
ADD_SUBDIRECTORY
(
src
)
ADD_SUBDIRECTORY
(
tests
)
CONFIG_FILES
(
include/
${
CUSTOM_HEADER_DIR
}
/doc.hh
)
tests/CMakeLists.txt
0 → 100644
View file @
750cf576
ADD_SUBDIRECTORY
(
python
)
tests/python/CMakeLists.txt
0 → 100644
View file @
750cf576
SET
(
${
PROJECT_NAME
}
_PYTHON_TESTS
test_talos_walk_contacts
test_talos_walk_path
)
FOREACH
(
TEST
${${
PROJECT_NAME
}
_PYTHON_TESTS
}
)
ADD_PYTHON_UNIT_TEST
(
"py-
${
TEST
}
"
"tests/python/
${
TEST
}
.py"
)
ENDFOREACH
(
TEST
${${
PROJECT_NAME
}
_PYTHON_TESTS
}
)
tests/python/test_talos.py
deleted
100644 → 0
View file @
6694918d
# Copyright (c) 20120, CNRS
# Authors: Pierre Fernbach <pfernbac@laas.fr>
tests/python/test_talos_walk_contacts.py
0 → 100644
View file @
750cf576
# Copyright (c) 2020, CNRS
# Authors: Pierre Fernbach <pfernbac@laas.fr>
import
subprocess
from
importlib
import
import_module
import
os
import
unittest
import
time
PATH
=
"hpp.corbaserver.rbprm.scenarios.demos"
class
TestTalosWalkContact
(
unittest
.
TestCase
):
def
test_talos_walk_contacts
(
self
):
subprocess
.
run
([
"killall"
,
"hpp-rbprm-server"
])
process
=
subprocess
.
Popen
(
"hpp-rbprm-server"
)
time
.
sleep
(
3
)
module_scenario
=
import_module
(
PATH
+
".talos_flatGround"
)
if
not
hasattr
(
module_scenario
,
'ContactGenerator'
):
self
.
assertTrue
(
False
)
ContactGenerator
=
getattr
(
module_scenario
,
'ContactGenerator'
)
cg
=
ContactGenerator
()
cg
.
run
()
self
.
assertTrue
(
len
(
cg
.
configs
)
>
5
)
self
.
assertTrue
(
len
(
cg
.
configs
)
<
10
)
self
.
assertEqual
(
cg
.
q_init
,
cg
.
configs
[
0
])
self
.
assertEqual
(
cg
.
q_goal
,
cg
.
configs
[
-
1
])
process
.
kill
()
if
__name__
==
'__main__'
:
unittest
.
main
()
tests/python/test_talos_walk_path.py
0 → 100644
View file @
750cf576
# Copyright (c) 2020, CNRS
# Authors: Pierre Fernbach <pfernbac@laas.fr>
import
subprocess
from
importlib
import
import_module
import
os
import
unittest
import
time
PATH
=
"hpp.corbaserver.rbprm.scenarios.demos"
class
TestTalosWalkPath
(
unittest
.
TestCase
):
def
test_talos_walk_path
(
self
):
subprocess
.
run
([
"killall"
,
"hpp-rbprm-server"
])
process
=
subprocess
.
Popen
(
"hpp-rbprm-server"
)
time
.
sleep
(
3
)
module_scenario
=
import_module
(
PATH
+
".talos_flatGround_path"
)
if
not
hasattr
(
module_scenario
,
'PathPlanner'
):
self
.
assertTrue
(
False
)
PathPlanner
=
getattr
(
module_scenario
,
'PathPlanner'
)
planner
=
PathPlanner
()
planner
.
run
()
ps
=
planner
.
ps
self
.
assertEqual
(
ps
.
numberPaths
(),
2
)
self
.
assertEqual
(
ps
.
pathLength
(
0
),
ps
.
pathLength
(
1
))
self
.
assertTrue
(
ps
.
pathLength
(
1
)
>
6.
)
self
.
assertTrue
(
ps
.
pathLength
(
1
)
<
7.
)
self
.
assertEqual
(
planner
.
q_init
,
ps
.
configAtParam
(
1
,
0
))
self
.
assertEqual
(
planner
.
q_goal
,
ps
.
configAtParam
(
1
,
ps
.
pathLength
(
1
)))
process
.
kill
()
if
__name__
==
'__main__'
:
unittest
.
main
()
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